test all known compiler invocation commands - close #66
This commit is contained in:
parent
e3e2e46d6e
commit
8d7fd4bda8
@ -216,28 +216,22 @@ module Rscons
|
|||||||
fh.puts <<-EOF
|
fh.puts <<-EOF
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
printf("Hello.\\n");
|
printf("Success.\\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
case cc
|
command = %W[#{cc} -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.c]
|
||||||
when "gcc"
|
merge = {"CC" => cc}
|
||||||
command = %W[gcc -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.c]
|
|
||||||
merge = {"CC" => "gcc"}
|
|
||||||
when "clang"
|
|
||||||
command = %W[clang -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.c]
|
|
||||||
merge = {"CC" => "clang"}
|
|
||||||
else
|
|
||||||
$stderr.puts "Unknown C compiler (#{cc})"
|
|
||||||
raise ConfigureFailure.new
|
|
||||||
end
|
|
||||||
_, _, status = log_and_test_command(command)
|
_, _, status = log_and_test_command(command)
|
||||||
if status == 0
|
if status == 0
|
||||||
|
stdout, _, status = log_and_test_command(["#{@work_dir}/cfgtest.exe"])
|
||||||
|
if status == 0 and stdout =~ /Success/
|
||||||
store_merge(merge)
|
store_merge(merge)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Test a C++ compiler.
|
# Test a C++ compiler.
|
||||||
#
|
#
|
||||||
@ -252,28 +246,22 @@ module Rscons
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
cout << "Hello." << endl;
|
cout << "Success." << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
case cc
|
command = %W[#{cc} -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.cxx]
|
||||||
when "g++"
|
merge = {"CXX" => cc}
|
||||||
command = %W[g++ -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.cxx]
|
|
||||||
merge = {"CXX" => "g++"}
|
|
||||||
when "clang++"
|
|
||||||
command = %W[clang++ -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.cxx]
|
|
||||||
merge = {"CXX" => "clang++"}
|
|
||||||
else
|
|
||||||
$stderr.puts "Unknown C++ compiler (#{cc})"
|
|
||||||
raise ConfigureFailure.new
|
|
||||||
end
|
|
||||||
_, _, status = log_and_test_command(command)
|
_, _, status = log_and_test_command(command)
|
||||||
if status == 0
|
if status == 0
|
||||||
|
stdout, _, status = log_and_test_command(["#{@work_dir}/cfgtest.exe"])
|
||||||
|
if status == 0 and stdout =~ /Success/
|
||||||
store_merge(merge)
|
store_merge(merge)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Test a D compiler.
|
# Test a D compiler.
|
||||||
#
|
#
|
||||||
@ -287,33 +275,35 @@ module Rscons
|
|||||||
fh.puts <<-EOF
|
fh.puts <<-EOF
|
||||||
import std.stdio;
|
import std.stdio;
|
||||||
int main() {
|
int main() {
|
||||||
writeln("Hello.");
|
writeln("Success.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
case dc
|
[:gdc, :ldc2].find do |dc_test|
|
||||||
when "gdc"
|
case dc_test
|
||||||
command = %W[gdc -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.d]
|
when :gdc
|
||||||
merge = {"DC" => "gdc"}
|
command = %W[#{dc} -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.d]
|
||||||
when "ldc2"
|
merge = {"DC" => dc}
|
||||||
command = %W[ldc2 -of #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.d]
|
when :ldc2
|
||||||
|
command = %W[#{dc} -of #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.d]
|
||||||
env = Environment.new
|
env = Environment.new
|
||||||
merge = {
|
merge = {
|
||||||
"DC" => "ldc2",
|
"DC" => dc,
|
||||||
"DCCMD" => env["DCCMD"].map {|e| if e == "-o"; "-of"; else; e; end},
|
"DCCMD" => env["DCCMD"].map {|e| if e == "-o"; "-of"; else; e; end},
|
||||||
"LDCMD" => env["LDCMD"].map {|e| if e == "-o"; "-of"; else; e; end},
|
"LDCMD" => env["LDCMD"].map {|e| if e == "-o"; "-of"; else; e; end},
|
||||||
}
|
}
|
||||||
else
|
|
||||||
$stderr.puts "Unknown D compiler (#{dc})"
|
|
||||||
raise ConfigureFailure.new
|
|
||||||
end
|
end
|
||||||
_, _, status = log_and_test_command(command)
|
_, _, status = log_and_test_command(command)
|
||||||
if status == 0
|
if status == 0
|
||||||
|
stdout, _, status = log_and_test_command(["#{@work_dir}/cfgtest.exe"])
|
||||||
|
if status == 0 and stdout =~ /Success/
|
||||||
store_merge(merge)
|
store_merge(merge)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Execute a test command and log the result.
|
# Execute a test command and log the result.
|
||||||
def log_and_test_command(command)
|
def log_and_test_command(command)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user