|
|
@ -145,7 +145,11 @@ EOF
|
|
|
|
stdout, stderr, status = nil, nil, nil
|
|
|
|
stdout, stderr, status = nil, nil, nil
|
|
|
|
Bundler.with_clean_env do
|
|
|
|
Bundler.with_clean_env do
|
|
|
|
env = ENV.to_h
|
|
|
|
env = ENV.to_h
|
|
|
|
env["PATH"] = "#{@build_test_run_dir}/_bin#{File::PATH_SEPARATOR}#{env["PATH"]}"
|
|
|
|
path = ["#{@build_test_run_dir}/_bin", "#{env["PATH"]}"]
|
|
|
|
|
|
|
|
if options[:path]
|
|
|
|
|
|
|
|
path = Array(options[:path]) + path
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
env["PATH"] = path.join(File::PATH_SEPARATOR)
|
|
|
|
stdout, stderr, status = Open3.capture3(env, *command)
|
|
|
|
stdout, stderr, status = Open3.capture3(env, *command)
|
|
|
|
File.open("#{@build_test_run_dir}/.stdout", "wb") do |fh|
|
|
|
|
File.open("#{@build_test_run_dir}/.stdout", "wb") do |fh|
|
|
|
|
fh.write(stdout)
|
|
|
|
fh.write(stdout)
|
|
|
@ -591,51 +595,51 @@ EOF
|
|
|
|
expect(result.stdout).to eq ""
|
|
|
|
expect(result.stdout).to eq ""
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "supports building D sources with gdc" do
|
|
|
|
|
|
|
|
test_dir("d")
|
|
|
|
|
|
|
|
result = run_rscons
|
|
|
|
|
|
|
|
expect(result.stderr).to eq ""
|
|
|
|
|
|
|
|
slines = lines(result.stdout)
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{gdc -c -o build/e.1/main.o -MMD -MF build/e.1/main.mf main.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{gdc -c -o build/e.1/mod.o -MMD -MF build/e.1/mod.mf mod.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{gdc -o hello-d.exe build/e.1/main.o build/e.1/mod.o}])
|
|
|
|
|
|
|
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "supports building D sources with ldc2" do
|
|
|
|
|
|
|
|
test_dir("d")
|
|
|
|
|
|
|
|
result = run_rscons(rsconscript: "build-ldc2.rb")
|
|
|
|
|
|
|
|
expect(result.stderr).to eq ""
|
|
|
|
|
|
|
|
slines = lines(result.stdout)
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.o(bj)? -deps=build/e.1/main.mf main.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.o(bj)? -deps=build/e.1/mod.mf mod.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.o(bj)? build/e.1/mod.o(bj)?}])
|
|
|
|
|
|
|
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "rebuilds D modules with ldc2 when deep dependencies change" do
|
|
|
|
|
|
|
|
test_dir("d")
|
|
|
|
|
|
|
|
result = run_rscons(rsconscript: "build-ldc2.rb")
|
|
|
|
|
|
|
|
expect(result.stderr).to eq ""
|
|
|
|
|
|
|
|
slines = lines(result.stdout)
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.o(bj)? -deps=build/e.1/main.mf main.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.o(bj)? -deps=build/e.1/mod.mf mod.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.o(bj)? build/e.1/mod.o(bj)?}])
|
|
|
|
|
|
|
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
|
|
|
|
|
|
|
contents = File.read("mod.d", mode: "rb").sub("42", "33")
|
|
|
|
|
|
|
|
File.open("mod.d", "wb") do |fh|
|
|
|
|
|
|
|
|
fh.write(contents)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
result = run_rscons(rsconscript: "build-ldc2.rb")
|
|
|
|
|
|
|
|
expect(result.stderr).to eq ""
|
|
|
|
|
|
|
|
slines = lines(result.stdout)
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.o(bj)? -deps=build/e.1/main.mf main.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.o(bj)? -deps=build/e.1/mod.mf mod.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.o(bj)? build/e.1/mod.o(bj)?}])
|
|
|
|
|
|
|
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 33!"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
unless ENV["omit_gdc_tests"]
|
|
|
|
unless ENV["omit_gdc_tests"]
|
|
|
|
it "supports building D sources with gdc" do
|
|
|
|
|
|
|
|
test_dir("d")
|
|
|
|
|
|
|
|
result = run_rscons
|
|
|
|
|
|
|
|
expect(result.stderr).to eq ""
|
|
|
|
|
|
|
|
slines = lines(result.stdout)
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{gdc -c -o build/e.1/main.o -MMD -MF build/e.1/main.mf main.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{gdc -c -o build/e.1/mod.o -MMD -MF build/e.1/mod.mf mod.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{gdc -o hello-d.exe build/e.1/main.o build/e.1/mod.o}])
|
|
|
|
|
|
|
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "supports building D sources with ldc2" do
|
|
|
|
|
|
|
|
test_dir("d")
|
|
|
|
|
|
|
|
result = run_rscons(rsconscript: "build-ldc2.rb")
|
|
|
|
|
|
|
|
expect(result.stderr).to eq ""
|
|
|
|
|
|
|
|
slines = lines(result.stdout)
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.o(bj)? -deps=build/e.1/main.mf main.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.o(bj)? -deps=build/e.1/mod.mf mod.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.o(bj)? build/e.1/mod.o(bj)?}])
|
|
|
|
|
|
|
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "rebuilds D modules with ldc2 when deep dependencies change" do
|
|
|
|
|
|
|
|
test_dir("d")
|
|
|
|
|
|
|
|
result = run_rscons(rsconscript: "build-ldc2.rb")
|
|
|
|
|
|
|
|
expect(result.stderr).to eq ""
|
|
|
|
|
|
|
|
slines = lines(result.stdout)
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.o(bj)? -deps=build/e.1/main.mf main.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.o(bj)? -deps=build/e.1/mod.mf mod.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.o(bj)? build/e.1/mod.o(bj)?}])
|
|
|
|
|
|
|
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
|
|
|
|
|
|
|
contents = File.read("mod.d", mode: "rb").sub("42", "33")
|
|
|
|
|
|
|
|
File.open("mod.d", "wb") do |fh|
|
|
|
|
|
|
|
|
fh.write(contents)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
result = run_rscons(rsconscript: "build-ldc2.rb")
|
|
|
|
|
|
|
|
expect(result.stderr).to eq ""
|
|
|
|
|
|
|
|
slines = lines(result.stdout)
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.o(bj)? -deps=build/e.1/main.mf main.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.o(bj)? -deps=build/e.1/mod.mf mod.d}])
|
|
|
|
|
|
|
|
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.o(bj)? build/e.1/mod.o(bj)?}])
|
|
|
|
|
|
|
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 33!"
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "links with the D linker when object files were built from D sources" do
|
|
|
|
it "links with the D linker when object files were built from D sources" do
|
|
|
|
test_dir("d")
|
|
|
|
test_dir("d")
|
|
|
|
result = run_rscons(rsconscript: "link_objects.rb")
|
|
|
|
result = run_rscons(rsconscript: "link_objects.rb")
|
|
|
@ -669,11 +673,7 @@ EOF
|
|
|
|
test_dir("shared_library")
|
|
|
|
test_dir("shared_library")
|
|
|
|
|
|
|
|
|
|
|
|
result = run_rscons(rsconscript: "shared_library_d.rb")
|
|
|
|
result = run_rscons(rsconscript: "shared_library_d.rb")
|
|
|
|
# Currently gdc produces an error while trying to build the shared
|
|
|
|
expect(result.stderr).to eq ""
|
|
|
|
# library. Since this isn't really an rscons problem, I'm commenting out
|
|
|
|
|
|
|
|
# this check. I'm not sure what I want to do about D support at this
|
|
|
|
|
|
|
|
# point anyway...
|
|
|
|
|
|
|
|
#expect(result.stderr).to eq ""
|
|
|
|
|
|
|
|
slines = lines(result.stdout)
|
|
|
|
slines = lines(result.stdout)
|
|
|
|
if RUBY_PLATFORM =~ /mingw/
|
|
|
|
if RUBY_PLATFORM =~ /mingw/
|
|
|
|
verify_lines(slines, [%r{Linking mine.dll}])
|
|
|
|
verify_lines(slines, [%r{Linking mine.dll}])
|
|
|
@ -2050,6 +2050,16 @@ EOF
|
|
|
|
expect(result.stdout).to match /Checking for program 'find'... .*find/
|
|
|
|
expect(result.stdout).to match /Checking for program 'find'... .*find/
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "with non-existent PATH entries" do
|
|
|
|
|
|
|
|
it "succeeds when the requested program is found" do
|
|
|
|
|
|
|
|
test_dir "configure"
|
|
|
|
|
|
|
|
result = run_rscons(rsconscript: "check_program_success.rb", op: "configure", path: "/foo/bar")
|
|
|
|
|
|
|
|
expect(result.stderr).to eq ""
|
|
|
|
|
|
|
|
expect(result.status).to eq 0
|
|
|
|
|
|
|
|
expect(result.stdout).to match /Checking for program 'find'... .*find/
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
it "fails when the requested program is not found" do
|
|
|
|
it "fails when the requested program is not found" do
|
|
|
|
test_dir "configure"
|
|
|
|
test_dir "configure"
|
|
|
|
result = run_rscons(rsconscript: "check_program_failure.rb", op: "configure")
|
|
|
|
result = run_rscons(rsconscript: "check_program_failure.rb", op: "configure")
|
|
|
@ -2192,8 +2202,8 @@ EOF
|
|
|
|
expect(result.stdout).to match /Setting build directory\.\.\. bb/
|
|
|
|
expect(result.stdout).to match /Setting build directory\.\.\. bb/
|
|
|
|
expect(result.stdout).to match %r{Setting prefix\.\.\. /my/prefix}
|
|
|
|
expect(result.stdout).to match %r{Setting prefix\.\.\. /my/prefix}
|
|
|
|
expect(result.stdout).to match /Checking for C compiler\.\.\. gcc/
|
|
|
|
expect(result.stdout).to match /Checking for C compiler\.\.\. gcc/
|
|
|
|
expect(result.stdout).to match /Checking for C\+\+ compiler\.\.\. g++/
|
|
|
|
expect(result.stdout).to match /Checking for C\+\+ compiler\.\.\. g\+\+/
|
|
|
|
expect(result.stdout).to match /Checking for D compiler\.\.\. gdc/
|
|
|
|
expect(result.stdout).to match /Checking for D compiler\.\.\. (gdc|ldc2)/
|
|
|
|
expect(result.stdout).to match /Checking for package 'mypackage'\.\.\. found/
|
|
|
|
expect(result.stdout).to match /Checking for package 'mypackage'\.\.\. found/
|
|
|
|
expect(result.stdout).to match /Checking for C header 'stdio.h'\.\.\. found/
|
|
|
|
expect(result.stdout).to match /Checking for C header 'stdio.h'\.\.\. found/
|
|
|
|
expect(result.stdout).to match /Checking for C\+\+ header 'iostream'\.\.\. found/
|
|
|
|
expect(result.stdout).to match /Checking for C\+\+ header 'iostream'\.\.\. found/
|
|
|
|