add build test for check_cfg - close #59
This commit is contained in:
parent
04c0a6a86f
commit
9975eec165
7
build_tests/configure/check_cfg.rb
Normal file
7
build_tests/configure/check_cfg.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
configure do
|
||||||
|
check_cfg program: "my-config"
|
||||||
|
end
|
||||||
|
|
||||||
|
Rscons::Environment.new(echo: :command) do |env|
|
||||||
|
env.Program("myconfigtest", "simple.c")
|
||||||
|
end
|
6
build_tests/configure/simple.c
Normal file
6
build_tests/configure/simple.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
printf("This is a simple C program\n");
|
||||||
|
}
|
@ -85,7 +85,7 @@ module Rscons
|
|||||||
if package = options[:package]
|
if package = options[:package]
|
||||||
Ansi.write($stdout, "Checking for package '", :cyan, package, :reset, "'... ")
|
Ansi.write($stdout, "Checking for package '", :cyan, package, :reset, "'... ")
|
||||||
elsif program = options[:program]
|
elsif program = options[:program]
|
||||||
Ansi.write($stdout, "Checking ", :cyan, program, :reset, "... ")
|
Ansi.write($stdout, "Checking '", :cyan, program, :reset, "'... ")
|
||||||
end
|
end
|
||||||
program ||= "pkg-config"
|
program ||= "pkg-config"
|
||||||
args = options[:args] || %w[--cflags --libs]
|
args = options[:args] || %w[--cflags --libs]
|
||||||
|
@ -1756,6 +1756,22 @@ EOF
|
|||||||
expect(result.stdout).to match /Checking for program 'program-that-is-not-found'... not found/
|
expect(result.stdout).to match /Checking for program 'program-that-is-not-found'... not found/
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "check_cfg" 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(rsconsfile: "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(rsconsfile: "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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user