add spec for check_cfg with a :package argument
This commit is contained in:
parent
b88131eb2f
commit
9e0ce5a55c
7
build_tests/configure/check_cfg_package.rb
Normal file
7
build_tests/configure/check_cfg_package.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
configure do
|
||||||
|
check_cfg package: "mypackage"
|
||||||
|
end
|
||||||
|
|
||||||
|
Rscons::Environment.new(echo: :command) do |env|
|
||||||
|
env.Program("myconfigtest", "simple.c")
|
||||||
|
end
|
@ -65,6 +65,7 @@ describe Rscons do
|
|||||||
def create_exe(exe_name, contents)
|
def create_exe(exe_name, contents)
|
||||||
exe_file = "#{@build_test_run_dir}/_bin/#{exe_name}"
|
exe_file = "#{@build_test_run_dir}/_bin/#{exe_name}"
|
||||||
File.open(exe_file, "wb") do |fh|
|
File.open(exe_file, "wb") do |fh|
|
||||||
|
fh.puts("#!/bin/sh")
|
||||||
fh.puts(contents)
|
fh.puts(contents)
|
||||||
end
|
end
|
||||||
FileUtils.chmod(0755, exe_file)
|
FileUtils.chmod(0755, exe_file)
|
||||||
@ -1790,18 +1791,35 @@ EOF
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "check_cfg" do
|
context "check_cfg" do
|
||||||
it "stores flags and uses them during a build operation" do
|
context "when passed a package" do
|
||||||
test_dir "configure"
|
it "stores flags and uses them during a build operation" do
|
||||||
create_exe "my-config", "echo '-DMYCONFIG -lm'"
|
test_dir "configure"
|
||||||
result = run_rscons(rsconscript: "check_cfg.rb", op: "configure")
|
create_exe "pkg-config", "echo '-DMYPACKAGE'"
|
||||||
expect(result.stderr).to eq ""
|
result = run_rscons(rsconscript: "check_cfg_package.rb", op: "configure")
|
||||||
expect(result.status).to eq 0
|
expect(result.stderr).to eq ""
|
||||||
expect(result.stdout).to match /Checking 'my-config'\.\.\. found/
|
expect(result.status).to eq 0
|
||||||
result = run_rscons(rsconscript: "check_cfg.rb", op: "build")
|
expect(result.stdout).to match /Checking for package 'mypackage'\.\.\. found/
|
||||||
expect(result.stderr).to eq ""
|
result = run_rscons(rsconscript: "check_cfg_package.rb", op: "build")
|
||||||
expect(result.status).to eq 0
|
expect(result.stderr).to eq ""
|
||||||
expect(result.stdout).to match /gcc.*-o.*\.o.*-DMYCONFIG/
|
expect(result.status).to eq 0
|
||||||
expect(result.stdout).to match /gcc.*-o myconfigtest.*-lm/
|
expect(result.stdout).to match /gcc.*-o.*\.o.*-DMYPACKAGE/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when passed a program" do
|
||||||
|
it "stores flags and uses them during a build operation" do
|
||||||
|
test_dir "configure"
|
||||||
|
create_exe "my-config", "echo '-DMYCONFIG -lm'"
|
||||||
|
result = run_rscons(rsconscript: "check_cfg.rb", op: "configure")
|
||||||
|
expect(result.stderr).to eq ""
|
||||||
|
expect(result.status).to eq 0
|
||||||
|
expect(result.stdout).to match /Checking 'my-config'\.\.\. found/
|
||||||
|
result = run_rscons(rsconscript: "check_cfg.rb", op: "build")
|
||||||
|
expect(result.stderr).to eq ""
|
||||||
|
expect(result.status).to eq 0
|
||||||
|
expect(result.stdout).to match /gcc.*-o.*\.o.*-DMYCONFIG/
|
||||||
|
expect(result.stdout).to match /gcc.*-o myconfigtest.*-lm/
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user