Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
353f4f45bc | ||
|
|
5bac91f92f | ||
|
|
bbe9563ceb | ||
|
|
5ec74604c6 | ||
|
|
8e06efe61e | ||
|
|
0756874ddb | ||
|
|
dded5e2648 | ||
|
|
fbe60f6ba2 | ||
|
|
8dd9799666 | ||
|
|
f2c755c8bb | ||
|
|
01ca86de8b | ||
|
|
943fabd0d1 |
No files matched your search
@@ -1,3 +1,9 @@
|
|||||||
|
## v2.1.0
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
- #117 - ruby 2.7 compatibility
|
||||||
|
|
||||||
## v2.0.2
|
## v2.0.2
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem "json"
|
|
||||||
gem "rspec"
|
gem "rspec"
|
||||||
gem "rake"
|
gem "rake"
|
||||||
gem "simplecov"
|
gem "simplecov", "~> 0.15.0"
|
||||||
gem "yard"
|
if RbConfig::CONFIG["host"]["msys"]
|
||||||
gem "rdoc"
|
gem "json", "2.1.0"
|
||||||
gem "redcarpet"
|
else
|
||||||
gem "syntax"
|
gem "json"
|
||||||
|
gem "yard"
|
||||||
|
gem "rdoc"
|
||||||
|
gem "redcarpet"
|
||||||
|
gem "syntax"
|
||||||
|
end
|
||||||
+20
-20
@@ -2,31 +2,31 @@ GEM
|
|||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
docile (1.3.2)
|
docile (1.1.5)
|
||||||
json (2.2.0)
|
json (2.3.0)
|
||||||
rake (12.3.2)
|
rake (13.0.1)
|
||||||
rdoc (6.1.1)
|
rdoc (6.2.1)
|
||||||
redcarpet (3.4.0)
|
redcarpet (3.5.0)
|
||||||
rspec (3.8.0)
|
rspec (3.9.0)
|
||||||
rspec-core (~> 3.8.0)
|
rspec-core (~> 3.9.0)
|
||||||
rspec-expectations (~> 3.8.0)
|
rspec-expectations (~> 3.9.0)
|
||||||
rspec-mocks (~> 3.8.0)
|
rspec-mocks (~> 3.9.0)
|
||||||
rspec-core (3.8.2)
|
rspec-core (3.9.1)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.9.1)
|
||||||
rspec-expectations (3.8.4)
|
rspec-expectations (3.9.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-mocks (3.8.1)
|
rspec-mocks (3.9.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.8.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-support (3.8.2)
|
rspec-support (3.9.2)
|
||||||
simplecov (0.15.0)
|
simplecov (0.15.1)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
json (>= 1.8, < 3)
|
json (>= 1.8, < 3)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.10.2)
|
||||||
syntax (1.2.2)
|
syntax (1.2.2)
|
||||||
yard (0.9.20)
|
yard (0.9.24)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
@@ -38,9 +38,9 @@ DEPENDENCIES
|
|||||||
rdoc
|
rdoc
|
||||||
redcarpet
|
redcarpet
|
||||||
rspec
|
rspec
|
||||||
simplecov
|
simplecov (~> 0.15.0)
|
||||||
syntax
|
syntax
|
||||||
yard
|
yard
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.17.3
|
2.1.4
|
||||||
+10
-8
@@ -6,7 +6,6 @@ rescue Bundler::BundlerError => e
|
|||||||
end
|
end
|
||||||
|
|
||||||
require "rspec/core/rake_task"
|
require "rspec/core/rake_task"
|
||||||
require "yard"
|
|
||||||
require "rake/clean"
|
require "rake/clean"
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
|
|
||||||
@@ -37,11 +36,6 @@ task :dspec, [:example_string] => :build_dist do |task, args|
|
|||||||
FileUtils.rm_f(Dir.glob(".rscons-*"))
|
FileUtils.rm_f(Dir.glob(".rscons-*"))
|
||||||
end
|
end
|
||||||
|
|
||||||
YARD::Rake::YardocTask.new do |yard|
|
|
||||||
yard.files = ['lib/**/*.rb']
|
|
||||||
yard.options = ["-ogen/yard"]
|
|
||||||
end
|
|
||||||
|
|
||||||
task :gen_large_project, [:size] => :build_dist do |task, args|
|
task :gen_large_project, [:size] => :build_dist do |task, args|
|
||||||
size = (args.size || 10000).to_i
|
size = (args.size || 10000).to_i
|
||||||
FileUtils.rm_rf("large_project")
|
FileUtils.rm_rf("large_project")
|
||||||
@@ -88,8 +82,16 @@ EOF
|
|||||||
FileUtils.cp("dist/rscons", "large_project")
|
FileUtils.cp("dist/rscons", "large_project")
|
||||||
end
|
end
|
||||||
|
|
||||||
task :user_guide do
|
unless RbConfig::CONFIG["host"]["msys"]
|
||||||
system("ruby", "-Ilib", "rb/gen_user_guide.rb")
|
require "yard"
|
||||||
|
YARD::Rake::YardocTask.new do |yard|
|
||||||
|
yard.files = ['lib/**/*.rb']
|
||||||
|
yard.options = ["-ogen/yard"]
|
||||||
|
end
|
||||||
|
|
||||||
|
task :user_guide do
|
||||||
|
system("ruby", "-Ilib", "rb/gen_user_guide.rb")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
task :default => :spec
|
task :default => :spec
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
configure do
|
configure do
|
||||||
|
check_d_compiler
|
||||||
check_d_import "std.stdio", check_d_import_path: ["./usr1"]
|
check_d_import "std.stdio", check_d_import_path: ["./usr1"]
|
||||||
check_d_import "frobulous", check_d_import_path: ["./usr2"]
|
check_d_import "frobulous", check_d_import_path: ["./usr2"]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
configure do
|
configure do
|
||||||
|
check_d_compiler
|
||||||
check_d_import "std.stdio"
|
check_d_import "std.stdio"
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
configure do
|
||||||
|
check_c_compiler "foo123c", fail: false, on_fail: "Install the foo123 package"
|
||||||
|
check_d_compiler "foo123d", fail: false
|
||||||
|
check_cxx_compiler "foo123cxx", on_fail: lambda {puts "Install the foo123cxx package"}
|
||||||
|
end
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
build do
|
|
||||||
Environment.new do |env|
|
|
||||||
env.Program("program.exe", "program.c")
|
|
||||||
env.Install("install/program.exe", "program.exe")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
|
||||||
{
|
|
||||||
sleep(2);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
+49
-36
@@ -246,6 +246,15 @@ configure do
|
|||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Global configuration options may be supplied to the compiler checks as well.
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
configure do
|
||||||
|
check_c_compiler "x86_64-elf-gcc", on_fail: "Install x86_64-elf cross toolchain first!"
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
###> Checking for a Header File
|
###> Checking for a Header File
|
||||||
|
|
||||||
The following methods can be used to check for the presence of a header file:
|
The following methods can be used to check for the presence of a header file:
|
||||||
@@ -272,18 +281,6 @@ end
|
|||||||
|
|
||||||
Optionally specifies an array of paths to look for the header file in.
|
Optionally specifies an array of paths to look for the header file in.
|
||||||
|
|
||||||
##### `:fail`
|
|
||||||
|
|
||||||
If the `:fail` option is set to `false`, then the absence of the header file
|
|
||||||
will not result in the configure option failing.
|
|
||||||
The `:fail` option defaults to `true` if the `:set_define` option is not
|
|
||||||
defined, and defaults to `false` if the `:set_define` option is defined.
|
|
||||||
|
|
||||||
##### `:set_define`
|
|
||||||
|
|
||||||
If set, a build define of the specified String will be added to the
|
|
||||||
`CPPDEFINES` construction variable array if the requested header is found.
|
|
||||||
|
|
||||||
###> Checking for a D Import
|
###> Checking for a D Import
|
||||||
|
|
||||||
The `check_d_import` method can be used to check for the presence of D import.
|
The `check_d_import` method can be used to check for the presence of D import.
|
||||||
@@ -327,18 +324,6 @@ end
|
|||||||
|
|
||||||
Optionally specifies an array of paths to look for the library in.
|
Optionally specifies an array of paths to look for the library in.
|
||||||
|
|
||||||
##### `:fail`
|
|
||||||
|
|
||||||
If the `:fail` option is set to `false`, then the absence of the library
|
|
||||||
will not result in the configure option failing.
|
|
||||||
The `:fail` option defaults to `true` if the `:set_define` option is not
|
|
||||||
defined, and defaults to `false` if the `:set_define` option is defined.
|
|
||||||
|
|
||||||
##### `:set_define`
|
|
||||||
|
|
||||||
If set, a build define of the specified String will be added to the
|
|
||||||
`CPPDEFINES` construction variable array if the requested library is found.
|
|
||||||
|
|
||||||
##### `:use`
|
##### `:use`
|
||||||
|
|
||||||
If not set, the library will be used by default in all `Environment` objects.
|
If not set, the library will be used by default in all `Environment` objects.
|
||||||
@@ -387,18 +372,6 @@ used to look for package configuration flags for the specified package.
|
|||||||
If the `:program` option is given, the program specified will be used to look
|
If the `:program` option is given, the program specified will be used to look
|
||||||
for configuration flags.
|
for configuration flags.
|
||||||
|
|
||||||
##### `:fail`
|
|
||||||
|
|
||||||
If the `:fail` option is set to `false`, then the absence of the package or
|
|
||||||
program requested will not result in the configure option failing.
|
|
||||||
The `:fail` option defaults to `true` if the `:set_define` option is not
|
|
||||||
defined, and defaults to `false` if the `:set_define` option is defined.
|
|
||||||
|
|
||||||
##### `:set_define`
|
|
||||||
|
|
||||||
If set, a build define of the specified String will be added to the
|
|
||||||
`CPPDEFINES` construction variable array if the requested package is found.
|
|
||||||
|
|
||||||
##### `:use`
|
##### `:use`
|
||||||
|
|
||||||
If not set, the library will be used by default in all `Environment` objects.
|
If not set, the library will be used by default in all `Environment` objects.
|
||||||
@@ -457,6 +430,46 @@ configure do
|
|||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
###> Global Configuration Check Options
|
||||||
|
|
||||||
|
#### `:fail`
|
||||||
|
|
||||||
|
If the `:fail` option is set to `false`, then the absence of the package or
|
||||||
|
program requested will not result in the configure option failing.
|
||||||
|
The `:fail` option defaults to `true` if the `:set_define` option is not
|
||||||
|
defined, and defaults to `false` if the `:set_define` option is defined.
|
||||||
|
|
||||||
|
#### `:on_fail`
|
||||||
|
|
||||||
|
The `:on_fail` option can be set to a String or a Proc object. If the
|
||||||
|
configuration operation fails (or would fail), the given message is printed
|
||||||
|
or the Proc is called.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
configure do
|
||||||
|
check_c_compiler "special-gcc", on_fail: "First install special gcc!"
|
||||||
|
end
|
||||||
|
|
||||||
|
configure do
|
||||||
|
package_hint = lambda do
|
||||||
|
puts "The following packages must be installed to build this project:"
|
||||||
|
puts "- libsdl2-dev"
|
||||||
|
puts "- libsdl2-image-dev"
|
||||||
|
puts "- libsdl2-net-dev"
|
||||||
|
end
|
||||||
|
check_lib "SDL2", on_fail: package_hint
|
||||||
|
check_lib "SDL2_image", on_fail: package_hint
|
||||||
|
check_lib "SDL2_net", on_fail: package_hint
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `:set_define`
|
||||||
|
|
||||||
|
If set, a build define of the specified String will be added to the
|
||||||
|
`CPPDEFINES` construction variable array if the requested package is found.
|
||||||
|
|
||||||
##> Build Operations
|
##> Build Operations
|
||||||
|
|
||||||
The `build` block is used to create Environments and register build targets.
|
The `build` block is used to create Environments and register build targets.
|
||||||
|
|||||||
+2
-2
@@ -81,7 +81,7 @@ module Rscons
|
|||||||
end
|
end
|
||||||
if ENV["SHELL"] and ENV["SHELL"] != "" and test_shell[ENV["SHELL"], "-c"]
|
if ENV["SHELL"] and ENV["SHELL"] != "" and test_shell[ENV["SHELL"], "-c"]
|
||||||
[ENV["SHELL"], "-c"]
|
[ENV["SHELL"], "-c"]
|
||||||
elsif Object.const_get("RUBY_PLATFORM") =~ /mingw/
|
elsif Object.const_get("RUBY_PLATFORM") =~ /mingw|msys/
|
||||||
if test_shell["sh", "-c"]
|
if test_shell["sh", "-c"]
|
||||||
# Using Rscons from MSYS should use MSYS's shell.
|
# Using Rscons from MSYS should use MSYS's shell.
|
||||||
["sh", "-c"]
|
["sh", "-c"]
|
||||||
@@ -102,7 +102,7 @@ module Rscons
|
|||||||
# @return [Array<String>] Command used to execute commands.
|
# @return [Array<String>] Command used to execute commands.
|
||||||
def command_executer
|
def command_executer
|
||||||
@command_executer ||=
|
@command_executer ||=
|
||||||
if Object.const_get("RUBY_PLATFORM") =~ /mingw/
|
if Object.const_get("RUBY_PLATFORM") =~ /mingw|msys/
|
||||||
if ENV.keys.find {|key| key =~ /MSYS/}
|
if ENV.keys.find {|key| key =~ /MSYS/}
|
||||||
begin
|
begin
|
||||||
if IO.popen(["env", "echo", "success"]) {|io| io.read.strip} == "success"
|
if IO.popen(["env", "echo", "success"]) {|io| io.read.strip} == "success"
|
||||||
|
|||||||
+1
-1
@@ -84,7 +84,7 @@ module Rscons
|
|||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
# Whether to output ANSI color escape codes.
|
# Whether to output ANSI color escape codes.
|
||||||
def do_ansi?(io)
|
def do_ansi?(io)
|
||||||
if RUBY_PLATFORM =~ /mingw/
|
if RUBY_PLATFORM =~ /mingw|msys/
|
||||||
(ENV["TERM"] == "xterm") && %w[fifo characterSpecial].include?(io.stat.ftype)
|
(ENV["TERM"] == "xterm") && %w[fifo characterSpecial].include?(io.stat.ftype)
|
||||||
else
|
else
|
||||||
io.tty?
|
io.tty?
|
||||||
|
|||||||
+44
-43
@@ -62,6 +62,10 @@ module Rscons
|
|||||||
# @return [void]
|
# @return [void]
|
||||||
def check_c_compiler(*ccc)
|
def check_c_compiler(*ccc)
|
||||||
$stdout.write("Checking for C compiler... ")
|
$stdout.write("Checking for C compiler... ")
|
||||||
|
options = {}
|
||||||
|
if ccc.last.is_a?(Hash)
|
||||||
|
options = ccc.slice!(-1)
|
||||||
|
end
|
||||||
if ccc.empty?
|
if ccc.empty?
|
||||||
# Default C compiler search array.
|
# Default C compiler search array.
|
||||||
ccc = %w[gcc clang]
|
ccc = %w[gcc clang]
|
||||||
@@ -69,7 +73,7 @@ module Rscons
|
|||||||
cc = ccc.find do |cc|
|
cc = ccc.find do |cc|
|
||||||
test_c_compiler(cc)
|
test_c_compiler(cc)
|
||||||
end
|
end
|
||||||
complete(cc ? 0 : 1, success_message: cc)
|
complete(cc ? 0 : 1, options.merge(success_message: cc))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check for a working C++ compiler.
|
# Check for a working C++ compiler.
|
||||||
@@ -80,6 +84,10 @@ module Rscons
|
|||||||
# @return [void]
|
# @return [void]
|
||||||
def check_cxx_compiler(*ccc)
|
def check_cxx_compiler(*ccc)
|
||||||
$stdout.write("Checking for C++ compiler... ")
|
$stdout.write("Checking for C++ compiler... ")
|
||||||
|
options = {}
|
||||||
|
if ccc.last.is_a?(Hash)
|
||||||
|
options = ccc.slice!(-1)
|
||||||
|
end
|
||||||
if ccc.empty?
|
if ccc.empty?
|
||||||
# Default C++ compiler search array.
|
# Default C++ compiler search array.
|
||||||
ccc = %w[g++ clang++]
|
ccc = %w[g++ clang++]
|
||||||
@@ -87,7 +95,7 @@ module Rscons
|
|||||||
cc = ccc.find do |cc|
|
cc = ccc.find do |cc|
|
||||||
test_cxx_compiler(cc)
|
test_cxx_compiler(cc)
|
||||||
end
|
end
|
||||||
complete(cc ? 0 : 1, success_message: cc)
|
complete(cc ? 0 : 1, options.merge(success_message: cc))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check for a working D compiler.
|
# Check for a working D compiler.
|
||||||
@@ -98,6 +106,10 @@ module Rscons
|
|||||||
# @return [void]
|
# @return [void]
|
||||||
def check_d_compiler(*cdc)
|
def check_d_compiler(*cdc)
|
||||||
$stdout.write("Checking for D compiler... ")
|
$stdout.write("Checking for D compiler... ")
|
||||||
|
options = {}
|
||||||
|
if cdc.last.is_a?(Hash)
|
||||||
|
options = cdc.slice!(-1)
|
||||||
|
end
|
||||||
if cdc.empty?
|
if cdc.empty?
|
||||||
# Default D compiler search array.
|
# Default D compiler search array.
|
||||||
cdc = %w[gdc ldc2]
|
cdc = %w[gdc ldc2]
|
||||||
@@ -105,7 +117,7 @@ module Rscons
|
|||||||
dc = cdc.find do |dc|
|
dc = cdc.find do |dc|
|
||||||
test_d_compiler(dc)
|
test_d_compiler(dc)
|
||||||
end
|
end
|
||||||
complete(dc ? 0 : 1, success_message: dc)
|
complete(dc ? 0 : 1, options.merge(success_message: dc))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check for a package or configure program output.
|
# Check for a package or configure program output.
|
||||||
@@ -387,11 +399,15 @@ module Rscons
|
|||||||
else
|
else
|
||||||
!options[:set_define]
|
!options[:set_define]
|
||||||
end
|
end
|
||||||
|
color = should_fail ? :red : :yellow
|
||||||
|
Ansi.write($stdout, color, "#{fail_message}\n")
|
||||||
|
if options[:on_fail].is_a?(String)
|
||||||
|
$stdout.puts(options[:on_fail])
|
||||||
|
elsif options[:on_fail].is_a?(Proc)
|
||||||
|
options[:on_fail].call
|
||||||
|
end
|
||||||
if should_fail
|
if should_fail
|
||||||
Ansi.write($stdout, :red, "#{fail_message}\n")
|
|
||||||
raise ConfigureFailure.new
|
raise ConfigureFailure.new
|
||||||
else
|
|
||||||
Ansi.write($stdout, :yellow, "#{fail_message}\n")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -408,22 +424,17 @@ module Rscons
|
|||||||
def test_c_compiler(cc)
|
def test_c_compiler(cc)
|
||||||
File.open("#{@work_dir}/cfgtest.c", "wb") do |fh|
|
File.open("#{@work_dir}/cfgtest.c", "wb") do |fh|
|
||||||
fh.puts <<-EOF
|
fh.puts <<-EOF
|
||||||
#include <stdio.h>
|
int fun(int val) {
|
||||||
int main(int argc, char * argv[]) {
|
return val * 2;
|
||||||
printf("Success.\\n");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
command = %W[#{cc} -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.c]
|
command = %W[#{cc} -c -o #{@work_dir}/cfgtest.o #{@work_dir}/cfgtest.c]
|
||||||
merge = {"CC" => cc}
|
merge = {"CC" => cc}
|
||||||
_, _, 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"])
|
store_merge(merge)
|
||||||
if status == 0 and stdout =~ /Success/
|
true
|
||||||
store_merge(merge)
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -437,23 +448,18 @@ module Rscons
|
|||||||
def test_cxx_compiler(cc)
|
def test_cxx_compiler(cc)
|
||||||
File.open("#{@work_dir}/cfgtest.cxx", "wb") do |fh|
|
File.open("#{@work_dir}/cfgtest.cxx", "wb") do |fh|
|
||||||
fh.puts <<-EOF
|
fh.puts <<-EOF
|
||||||
#include <iostream>
|
template<typename T>
|
||||||
using namespace std;
|
T fun(T val) {
|
||||||
int main(int argc, char * argv[]) {
|
return val * 2;
|
||||||
cout << "Success." << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
command = %W[#{cc} -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.cxx]
|
command = %W[#{cc} -c -o #{@work_dir}/cfgtest.o #{@work_dir}/cfgtest.cxx]
|
||||||
merge = {"CXX" => cc}
|
merge = {"CXX" => cc}
|
||||||
_, _, 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"])
|
store_merge(merge)
|
||||||
if status == 0 and stdout =~ /Success/
|
true
|
||||||
store_merge(merge)
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -467,9 +473,8 @@ module Rscons
|
|||||||
def test_d_compiler(dc)
|
def test_d_compiler(dc)
|
||||||
File.open("#{@work_dir}/cfgtest.d", "wb") do |fh|
|
File.open("#{@work_dir}/cfgtest.d", "wb") do |fh|
|
||||||
fh.puts <<-EOF
|
fh.puts <<-EOF
|
||||||
import std.stdio;
|
import core.math;
|
||||||
int main() {
|
int fun() {
|
||||||
writeln("Success.");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@@ -477,29 +482,25 @@ module Rscons
|
|||||||
[:gdc, :ldc2].find do |dc_test|
|
[:gdc, :ldc2].find do |dc_test|
|
||||||
case dc_test
|
case dc_test
|
||||||
when :gdc
|
when :gdc
|
||||||
command = %W[#{dc} -o #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.d]
|
command = %W[#{dc} -c -o #{@work_dir}/cfgtest.o #{@work_dir}/cfgtest.d]
|
||||||
merge = {"DC" => dc}
|
merge = {"DC" => dc}
|
||||||
when :ldc2
|
when :ldc2
|
||||||
command = %W[#{dc} -of #{@work_dir}/cfgtest.exe #{@work_dir}/cfgtest.d]
|
# ldc2 on Windows expect an object file suffix of .obj.
|
||||||
|
ldc_objsuffix = RUBY_PLATFORM =~ /mingw|msys/ ? ".obj" : ".o"
|
||||||
|
command = %W[#{dc} -c -of #{@work_dir}/cfgtest#{ldc_objsuffix} #{@work_dir}/cfgtest.d]
|
||||||
env = BasicEnvironment.new
|
env = BasicEnvironment.new
|
||||||
merge = {
|
merge = {
|
||||||
"DC" => dc,
|
"DC" => dc,
|
||||||
"DCCMD" => env["DCCMD"].map {|e| if e == "-o"; "-of"; else; e; end},
|
"DCCMD" => env["DCCMD"].map {|e| e.sub(/^-o$/, "-of")},
|
||||||
"LDCMD" => env["LDCMD"].map {|e| if e == "-o"; "-of"; else; e; end},
|
"LDCMD" => env["LDCMD"].map {|e| e.sub(/^-o$/, "-of")},
|
||||||
"DDEPGEN" => ["-deps=${_DEPFILE}"],
|
"DDEPGEN" => ["-deps=${_DEPFILE}"],
|
||||||
}
|
}
|
||||||
if RUBY_PLATFORM =~ /mingw/
|
merge["OBJSUFFIX"] = [ldc_objsuffix]
|
||||||
# ldc2 on Windows expect an object file suffix of .obj.
|
|
||||||
merge["OBJSUFFIX"] = %w[.obj]
|
|
||||||
end
|
|
||||||
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"])
|
store_merge(merge)
|
||||||
if status == 0 and stdout =~ /Success/
|
true
|
||||||
store_merge(merge)
|
|
||||||
true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module Rscons
|
module Rscons
|
||||||
|
|
||||||
on_windows = RUBY_PLATFORM =~ /mingw|cygwin/
|
on_windows = RUBY_PLATFORM =~ /mingw|msys|cygwin/
|
||||||
pic_flags = on_windows ? [] : %w[-fPIC]
|
pic_flags = on_windows ? [] : %w[-fPIC]
|
||||||
|
|
||||||
# Default Rscons construction variables.
|
# Default Rscons construction variables.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
require "fileutils"
|
require "fileutils"
|
||||||
require "set"
|
require "set"
|
||||||
require "shellwords"
|
require "shellwords"
|
||||||
require "thwait"
|
|
||||||
|
|
||||||
module Rscons
|
module Rscons
|
||||||
# The Environment class is the main programmatic interface to Rscons. It
|
# The Environment class is the main programmatic interface to Rscons. It
|
||||||
@@ -702,10 +701,7 @@ module Rscons
|
|||||||
!thread.alive?
|
!thread.alive?
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if @threads.empty?
|
Util.wait_for_thread(*@threads.keys)
|
||||||
raise "No threads to wait for"
|
|
||||||
end
|
|
||||||
ThreadsWait.new(*@threads.keys).next_wait
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+33
-4
@@ -9,7 +9,7 @@ module Rscons
|
|||||||
#
|
#
|
||||||
# @return [Boolean] Whether the given path is an absolute filesystem path.
|
# @return [Boolean] Whether the given path is an absolute filesystem path.
|
||||||
def absolute_path?(path)
|
def absolute_path?(path)
|
||||||
if RUBY_PLATFORM =~ /mingw/
|
if RUBY_PLATFORM =~ /mingw|msys/
|
||||||
path =~ %r{^(?:\w:)?[\\/]}
|
path =~ %r{^(?:\w:)?[\\/]}
|
||||||
else
|
else
|
||||||
path.start_with?("/")
|
path.start_with?("/")
|
||||||
@@ -68,8 +68,8 @@ module Rscons
|
|||||||
case RbConfig::CONFIG["host_os"]
|
case RbConfig::CONFIG["host_os"]
|
||||||
when /linux/
|
when /linux/
|
||||||
return File.read("/proc/cpuinfo").scan(/^processor\s*:/).size
|
return File.read("/proc/cpuinfo").scan(/^processor\s*:/).size
|
||||||
when /mswin|mingw/
|
when /mswin|mingw|msys/
|
||||||
if `wmic cpu get NumberOfLogicalProcessors /value` =~ /NumberOfLogicalProcessors=(\d+)/
|
if `wmic cpu get NumberOfLogicalProcessors -value` =~ /NumberOfLogicalProcessors=(\d+)/
|
||||||
return $1.to_i
|
return $1.to_i
|
||||||
end
|
end
|
||||||
when /darwin/
|
when /darwin/
|
||||||
@@ -191,6 +191,32 @@ module Rscons
|
|||||||
deps
|
deps
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Wait for any of a number of threads to complete.
|
||||||
|
#
|
||||||
|
# @param threads [Array<Thread>]
|
||||||
|
# Threads to wait for.
|
||||||
|
#
|
||||||
|
# @return [Thread]
|
||||||
|
# The Thread that completed.
|
||||||
|
def wait_for_thread(*threads)
|
||||||
|
if threads.empty?
|
||||||
|
raise "No threads to wait for"
|
||||||
|
end
|
||||||
|
queue = Queue.new
|
||||||
|
threads.each do |thread|
|
||||||
|
# Create a wait thread for each thread we're waiting for.
|
||||||
|
Thread.new do
|
||||||
|
begin
|
||||||
|
thread.join
|
||||||
|
ensure
|
||||||
|
queue.push(thread)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# Wait for any thread to complete.
|
||||||
|
queue.pop
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Check if a directory contains a certain executable.
|
# Check if a directory contains a certain executable.
|
||||||
@@ -199,11 +225,14 @@ module Rscons
|
|||||||
# Directory to look in.
|
# Directory to look in.
|
||||||
# @param executable [String]
|
# @param executable [String]
|
||||||
# Executable to look for.
|
# Executable to look for.
|
||||||
|
#
|
||||||
|
# @return [String, nil]
|
||||||
|
# Executable found.
|
||||||
def test_path_for_executable(path_entry, executable)
|
def test_path_for_executable(path_entry, executable)
|
||||||
is_executable = lambda do |path|
|
is_executable = lambda do |path|
|
||||||
File.file?(path) and File.executable?(path)
|
File.file?(path) and File.executable?(path)
|
||||||
end
|
end
|
||||||
if RbConfig::CONFIG["host_os"] =~ /mswin|windows|mingw/i
|
if RbConfig::CONFIG["host_os"] =~ /mswin|windows|mingw|msys/i
|
||||||
if File.directory?(path_entry)
|
if File.directory?(path_entry)
|
||||||
executable = executable.downcase
|
executable = executable.downcase
|
||||||
dir_entries = Dir.entries(path_entry)
|
dir_entries = Dir.entries(path_entry)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module Rscons
|
module Rscons
|
||||||
# Project version.
|
# Project version.
|
||||||
VERSION = "2.0.2"
|
VERSION = "2.2.0"
|
||||||
end
|
end
|
||||||
+86
-80
@@ -143,7 +143,7 @@ EOF
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
stdout, stderr, status = nil, nil, nil
|
stdout, stderr, status = nil, nil, nil
|
||||||
Bundler.with_clean_env do
|
Bundler.with_unbundled_env do
|
||||||
env = ENV.to_h
|
env = ENV.to_h
|
||||||
path = ["#{@build_test_run_dir}/_bin", "#{env["PATH"]}"]
|
path = ["#{@build_test_run_dir}/_bin", "#{env["PATH"]}"]
|
||||||
if options[:path]
|
if options[:path]
|
||||||
@@ -187,6 +187,10 @@ EOF
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def nr(str)
|
||||||
|
str.gsub("\r", "")
|
||||||
|
end
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# Tests
|
# Tests
|
||||||
###########################################################################
|
###########################################################################
|
||||||
@@ -196,7 +200,7 @@ EOF
|
|||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?('build/e.1/simple.c.o')).to be_truthy
|
expect(File.exists?('build/e.1/simple.c.o')).to be_truthy
|
||||||
expect(`./simple.exe`).to eq "This is a simple C program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C program\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows specifying a Builder object as the source to another build target" do
|
it "allows specifying a Builder object as the source to another build target" do
|
||||||
@@ -204,7 +208,7 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "builder_as_source.rb")
|
result = run_rscons(rsconscript: "builder_as_source.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("simple.o")).to be_truthy
|
expect(File.exists?("simple.o")).to be_truthy
|
||||||
expect(`./simple.exe`).to eq "This is a simple C program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C program\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'prints commands as they are executed' do
|
it 'prints commands as they are executed' do
|
||||||
@@ -232,18 +236,18 @@ EOF
|
|||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?('build/e.1/header.c.o')).to be_truthy
|
expect(File.exists?('build/e.1/header.c.o')).to be_truthy
|
||||||
expect(`./header.exe`).to eq "The value is 2\n"
|
expect(nr(`./header.exe`)).to eq "The value is 2\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'rebuilds a C module when a header it depends on changes' do
|
it 'rebuilds a C module when a header it depends on changes' do
|
||||||
test_dir('header')
|
test_dir('header')
|
||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(`./header.exe`).to eq "The value is 2\n"
|
expect(nr(`./header.exe`)).to eq "The value is 2\n"
|
||||||
file_sub('header.h') {|line| line.sub(/2/, '5')}
|
file_sub('header.h') {|line| line.sub(/2/, '5')}
|
||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(`./header.exe`).to eq "The value is 5\n"
|
expect(nr(`./header.exe`)).to eq "The value is 5\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not rebuild a C module when its dependencies have not changed' do
|
it 'does not rebuild a C module when its dependencies have not changed' do
|
||||||
@@ -254,7 +258,7 @@ EOF
|
|||||||
%r{Compiling header.c},
|
%r{Compiling header.c},
|
||||||
%r{Linking header.exe},
|
%r{Linking header.exe},
|
||||||
])
|
])
|
||||||
expect(`./header.exe`).to eq "The value is 2\n"
|
expect(nr(`./header.exe`)).to eq "The value is 2\n"
|
||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(result.stdout).to eq ""
|
expect(result.stdout).to eq ""
|
||||||
@@ -268,7 +272,7 @@ EOF
|
|||||||
%r{Compiling header.c},
|
%r{Compiling header.c},
|
||||||
%r{Linking header.exe},
|
%r{Linking header.exe},
|
||||||
])
|
])
|
||||||
expect(`./header.exe`).to eq "The value is 2\n"
|
expect(nr(`./header.exe`)).to eq "The value is 2\n"
|
||||||
sleep 0.05
|
sleep 0.05
|
||||||
file_sub('header.c') {|line| line}
|
file_sub('header.c') {|line| line}
|
||||||
result = run_rscons
|
result = run_rscons
|
||||||
@@ -328,7 +332,7 @@ EOF
|
|||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?('foo.yml')).to be_truthy
|
expect(File.exists?('foo.yml')).to be_truthy
|
||||||
expect(IO.read('foo.yml')).to eq("---\nkey: value\n")
|
expect(nr(IO.read('foo.yml'))).to eq("---\nkey: value\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises an error when a side-effect file is registered for a build target that is not registered" do
|
it "raises an error when a side-effect file is registered for a build target that is not registered" do
|
||||||
@@ -337,20 +341,6 @@ EOF
|
|||||||
expect(result.stderr).to match /Could not find a registered build target "foo"/
|
expect(result.stderr).to match /Could not find a registered build target "foo"/
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows replacing a running executable when performing an 'install' operation" do
|
|
||||||
test_dir("install_running_exe")
|
|
||||||
result = run_rscons(op: "install")
|
|
||||||
expect(result.stderr).to eq ""
|
|
||||||
fcontents = File.read("program.c", mode: "rb")
|
|
||||||
File.open("program.c", "wb") do |fh|
|
|
||||||
fh.write(fcontents.sub(/2/, '3'))
|
|
||||||
end
|
|
||||||
pid = Process.spawn("install/program.exe")
|
|
||||||
result = run_rscons(op: "install")
|
|
||||||
expect(result.stderr).to eq ""
|
|
||||||
Process.wait(pid)
|
|
||||||
end
|
|
||||||
|
|
||||||
context "clean operation" do
|
context "clean operation" do
|
||||||
it 'cleans built files' do
|
it 'cleans built files' do
|
||||||
test_dir("simple")
|
test_dir("simple")
|
||||||
@@ -428,7 +418,7 @@ EOF
|
|||||||
%r{Linking program.exe},
|
%r{Linking program.exe},
|
||||||
])
|
])
|
||||||
expect(File.exists?('inc.h')).to be_truthy
|
expect(File.exists?('inc.h')).to be_truthy
|
||||||
expect(`./program.exe`).to eq "The value is 5678\n"
|
expect(nr(`./program.exe`)).to eq "The value is 5678\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'supports custom builders with multiple targets' do
|
it 'supports custom builders with multiple targets' do
|
||||||
@@ -444,13 +434,13 @@ EOF
|
|||||||
])
|
])
|
||||||
expect(File.exists?("inc.c")).to be_truthy
|
expect(File.exists?("inc.c")).to be_truthy
|
||||||
expect(File.exists?("inc.h")).to be_truthy
|
expect(File.exists?("inc.h")).to be_truthy
|
||||||
expect(`./program.exe`).to eq "The value is 42\n"
|
expect(nr(`./program.exe`)).to eq "The value is 42\n"
|
||||||
|
|
||||||
File.open("inc.c", "w") {|fh| fh.puts "int THE_VALUE = 33;"}
|
File.open("inc.c", "w") {|fh| fh.puts "int THE_VALUE = 33;"}
|
||||||
result = run_rscons(rsconscript: "multiple_targets.rb")
|
result = run_rscons(rsconscript: "multiple_targets.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
verify_lines(lines(result.stdout), [%r{CHGen inc.c}])
|
verify_lines(lines(result.stdout), [%r{CHGen inc.c}])
|
||||||
expect(`./program.exe`).to eq "The value is 42\n"
|
expect(nr(`./program.exe`)).to eq "The value is 42\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'raises an error when a custom builder returns an invalid value from #run' do
|
it 'raises an error when a custom builder returns an invalid value from #run' do
|
||||||
@@ -518,7 +508,7 @@ EOF
|
|||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?('build/e.1/simple.cc.o')).to be_truthy
|
expect(File.exists?('build/e.1/simple.cc.o')).to be_truthy
|
||||||
expect(`./simple.exe`).to eq "This is a simple C++ program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C++ program\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "links with the C++ linker when object files were built from C++ sources" do
|
it "links with the C++ linker when object files were built from C++ sources" do
|
||||||
@@ -526,7 +516,7 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "link_objects.rb")
|
result = run_rscons(rsconscript: "link_objects.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("simple.o")).to be_truthy
|
expect(File.exists?("simple.o")).to be_truthy
|
||||||
expect(`./simple.exe`).to eq "This is a simple C++ program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C++ program\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'allows overriding construction variables for individual builder calls' do
|
it 'allows overriding construction variables for individual builder calls' do
|
||||||
@@ -539,7 +529,7 @@ EOF
|
|||||||
%r{gcc -o two_sources.exe one.o build/e.1/two.c.o},
|
%r{gcc -o two_sources.exe one.o build/e.1/two.c.o},
|
||||||
])
|
])
|
||||||
expect(File.exists?("two_sources.exe")).to be_truthy
|
expect(File.exists?("two_sources.exe")).to be_truthy
|
||||||
expect(`./two_sources.exe`).to eq "This is a C program with two sources.\n"
|
expect(nr(`./two_sources.exe`)).to eq "This is a C program with two sources.\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'builds a static library archive' do
|
it 'builds a static library archive' do
|
||||||
@@ -554,7 +544,7 @@ EOF
|
|||||||
%r{gcc -o library.exe lib.a build/e.1/three.c.o},
|
%r{gcc -o library.exe lib.a build/e.1/three.c.o},
|
||||||
])
|
])
|
||||||
expect(File.exists?("library.exe")).to be_truthy
|
expect(File.exists?("library.exe")).to be_truthy
|
||||||
expect(`ar t lib.a`).to eq "one.c.o\ntwo.c.o\n"
|
expect(nr(`ar t lib.a`)).to eq "one.c.o\ntwo.c.o\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'supports build hooks to override construction variables' do
|
it 'supports build hooks to override construction variables' do
|
||||||
@@ -566,7 +556,7 @@ EOF
|
|||||||
%r{gcc -c -o build/e.1/src/two/two.c.o -MMD -MF build/e.1/src/two/two.c.o.mf -Isrc/one -Isrc/two -O2 src/two/two.c},
|
%r{gcc -c -o build/e.1/src/two/two.c.o -MMD -MF build/e.1/src/two/two.c.o.mf -Isrc/one -Isrc/two -O2 src/two/two.c},
|
||||||
%r{gcc -o build_hook.exe build/e.1/src/one/one.c.o build/e.1/src/two/two.c.o},
|
%r{gcc -o build_hook.exe build/e.1/src/one/one.c.o build/e.1/src/two/two.c.o},
|
||||||
])
|
])
|
||||||
expect(`./build_hook.exe`).to eq "Hello from two()\n"
|
expect(nr(`./build_hook.exe`)).to eq "Hello from two()\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'supports build hooks to override the entire vars hash' do
|
it 'supports build hooks to override the entire vars hash' do
|
||||||
@@ -592,7 +582,7 @@ EOF
|
|||||||
%r{Linking simple.exe},
|
%r{Linking simple.exe},
|
||||||
])
|
])
|
||||||
expect(File.exists?('build/e.1/simple.c.o')).to be_truthy
|
expect(File.exists?('build/e.1/simple.c.o')).to be_truthy
|
||||||
expect(`./simple.exe`).to eq "This is a simple C program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C program\n"
|
||||||
|
|
||||||
File.open("program.ld", "w") {|fh| fh.puts("2")}
|
File.open("program.ld", "w") {|fh| fh.puts("2")}
|
||||||
result = run_rscons(rsconscript: "user_dependencies.rb")
|
result = run_rscons(rsconscript: "user_dependencies.rb")
|
||||||
@@ -609,15 +599,17 @@ EOF
|
|||||||
expect(result.stdout).to eq ""
|
expect(result.stdout).to eq ""
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports building D sources with gdc" do
|
unless RUBY_PLATFORM =~ /mingw|msys/
|
||||||
test_dir("d")
|
it "supports building D sources with gdc" do
|
||||||
result = run_rscons
|
test_dir("d")
|
||||||
expect(result.stderr).to eq ""
|
result = run_rscons
|
||||||
slines = lines(result.stdout)
|
expect(result.stderr).to eq ""
|
||||||
verify_lines(slines, [%r{gdc -c -o build/e.1/main.d.o -MMD -MF build/e.1/main.d.o.mf main.d}])
|
slines = lines(result.stdout)
|
||||||
verify_lines(slines, [%r{gdc -c -o build/e.1/mod.d.o -MMD -MF build/e.1/mod.d.o.mf mod.d}])
|
verify_lines(slines, [%r{gdc -c -o build/e.1/main.d.o -MMD -MF build/e.1/main.d.o.mf main.d}])
|
||||||
verify_lines(slines, [%r{gdc -o hello-d.exe build/e.1/main.d.o build/e.1/mod.d.o}])
|
verify_lines(slines, [%r{gdc -c -o build/e.1/mod.d.o -MMD -MF build/e.1/mod.d.o.mf mod.d}])
|
||||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
verify_lines(slines, [%r{gdc -o hello-d.exe build/e.1/main.d.o build/e.1/mod.d.o}])
|
||||||
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports building D sources with ldc2" do
|
it "supports building D sources with ldc2" do
|
||||||
@@ -625,8 +617,8 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "build-ldc2.rb")
|
result = run_rscons(rsconscript: "build-ldc2.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
slines = lines(result.stdout)
|
slines = lines(result.stdout)
|
||||||
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.d.o(bj)? -deps=build/e.1/main.d.o.mf main.d}])
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.d.o(bj)? -deps=build/e.1/main.d.o(bj)?.mf main.d}])
|
||||||
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.d.o(bj)? -deps=build/e.1/mod.d.o.mf mod.d}])
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.d.o(bj)? -deps=build/e.1/mod.d.o(bj)?.mf mod.d}])
|
||||||
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.d.o(bj)? build/e.1/mod.d.o(bj)?}])
|
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.d.o(bj)? build/e.1/mod.d.o(bj)?}])
|
||||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
||||||
end
|
end
|
||||||
@@ -636,8 +628,8 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "build-ldc2.rb")
|
result = run_rscons(rsconscript: "build-ldc2.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
slines = lines(result.stdout)
|
slines = lines(result.stdout)
|
||||||
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.d.o(bj)? -deps=build/e.1/main.d.o.mf main.d}])
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.d.o(bj)? -deps=build/e.1/main.d.o(bj)?.mf main.d}])
|
||||||
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.d.o(bj)? -deps=build/e.1/mod.d.o.mf mod.d}])
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.d.o(bj)? -deps=build/e.1/mod.d.o(bj)?.mf mod.d}])
|
||||||
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.d.o(bj)? build/e.1/mod.d.o(bj)?}])
|
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.d.o(bj)? build/e.1/mod.d.o(bj)?}])
|
||||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 42!"
|
||||||
contents = File.read("mod.d", mode: "rb").sub("42", "33")
|
contents = File.read("mod.d", mode: "rb").sub("42", "33")
|
||||||
@@ -647,13 +639,13 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "build-ldc2.rb")
|
result = run_rscons(rsconscript: "build-ldc2.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
slines = lines(result.stdout)
|
slines = lines(result.stdout)
|
||||||
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.d.o(bj)? -deps=build/e.1/main.d.o.mf main.d}])
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/main.d.o(bj)? -deps=build/e.1/main.d.o(bj)?.mf main.d}])
|
||||||
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.d.o(bj)? -deps=build/e.1/mod.d.o.mf mod.d}])
|
verify_lines(slines, [%r{ldc2 -c -of build/e.1/mod.d.o(bj)? -deps=build/e.1/mod.d.o(bj)?.mf mod.d}])
|
||||||
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.d.o(bj)? build/e.1/mod.d.o(bj)?}])
|
verify_lines(slines, [%r{ldc2 -of hello-d.exe build/e.1/main.d.o(bj)? build/e.1/mod.d.o(bj)?}])
|
||||||
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 33!"
|
expect(`./hello-d.exe`.rstrip).to eq "Hello from D, value is 33!"
|
||||||
end
|
end
|
||||||
|
|
||||||
unless ENV["omit_gdc_tests"]
|
unless RUBY_PLATFORM =~ /mingw|msys/
|
||||||
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")
|
||||||
@@ -689,7 +681,7 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "shared_library_d.rb")
|
result = run_rscons(rsconscript: "shared_library_d.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
slines = lines(result.stdout)
|
slines = lines(result.stdout)
|
||||||
if RUBY_PLATFORM =~ /mingw/
|
if RUBY_PLATFORM =~ /mingw|msys/
|
||||||
verify_lines(slines, [%r{Linking mine.dll}])
|
verify_lines(slines, [%r{Linking mine.dll}])
|
||||||
else
|
else
|
||||||
verify_lines(slines, [%r{Linking libmine.so}])
|
verify_lines(slines, [%r{Linking libmine.so}])
|
||||||
@@ -715,7 +707,7 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "preprocess.rb")
|
result = run_rscons(rsconscript: "preprocess.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.read("simplepp.c")).to match /# \d+ "simple.c"/
|
expect(File.read("simplepp.c")).to match /# \d+ "simple.c"/
|
||||||
expect(`./simple.exe`).to eq "This is a simple C program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C program\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports preprocessing C++ sources" do
|
it "supports preprocessing C++ sources" do
|
||||||
@@ -723,7 +715,7 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "preprocess.rb")
|
result = run_rscons(rsconscript: "preprocess.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.read("simplepp.cc")).to match /# \d+ "simple.cc"/
|
expect(File.read("simplepp.cc")).to match /# \d+ "simple.cc"/
|
||||||
expect(`./simple.exe`).to eq "This is a simple C++ program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C++ program\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports invoking builders with no sources" do
|
it "supports invoking builders with no sources" do
|
||||||
@@ -741,14 +733,14 @@ EOF
|
|||||||
%r{Linking program.exe},
|
%r{Linking program.exe},
|
||||||
])
|
])
|
||||||
expect(File.exists?('inc.h')).to be_truthy
|
expect(File.exists?('inc.h')).to be_truthy
|
||||||
expect(`./program.exe`).to eq "The value is 678\n"
|
expect(nr(`./program.exe`)).to eq "The value is 678\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports lambdas as construction variable values" do
|
it "supports lambdas as construction variable values" do
|
||||||
test_dir "custom_builder"
|
test_dir "custom_builder"
|
||||||
result = run_rscons(rsconscript: "cvar_lambda.rb")
|
result = run_rscons(rsconscript: "cvar_lambda.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(`./program.exe`).to eq "The value is 5678\n"
|
expect(nr(`./program.exe`)).to eq "The value is 5678\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports registering build targets from within a build hook" do
|
it "supports registering build targets from within a build hook" do
|
||||||
@@ -757,7 +749,7 @@ EOF
|
|||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("build/e.1/simple.c.o")).to be_truthy
|
expect(File.exists?("build/e.1/simple.c.o")).to be_truthy
|
||||||
expect(File.exists?("build/e.1/simple.c.o.txt")).to be_truthy
|
expect(File.exists?("build/e.1/simple.c.o.txt")).to be_truthy
|
||||||
expect(`./simple.exe`).to eq "This is a simple C program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C program\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports multiple values for CXXSUFFIX" do
|
it "supports multiple values for CXXSUFFIX" do
|
||||||
@@ -767,7 +759,7 @@ EOF
|
|||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("build/e.1/simple.cc.o")).to be_truthy
|
expect(File.exists?("build/e.1/simple.cc.o")).to be_truthy
|
||||||
expect(File.exists?("build/e.1/other.cccc.o")).to be_truthy
|
expect(File.exists?("build/e.1/other.cccc.o")).to be_truthy
|
||||||
expect(`./simple.exe`).to eq "This is a simple C++ program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C++ program\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports multiple values for CSUFFIX" do
|
it "supports multiple values for CSUFFIX" do
|
||||||
@@ -777,7 +769,7 @@ EOF
|
|||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("build/e.1/src/one/one.yargh.o")).to be_truthy
|
expect(File.exists?("build/e.1/src/one/one.yargh.o")).to be_truthy
|
||||||
expect(File.exists?("build/e.1/src/two/two.c.o")).to be_truthy
|
expect(File.exists?("build/e.1/src/two/two.c.o")).to be_truthy
|
||||||
expect(`./program.exe`).to eq "Hello from two()\n"
|
expect(nr(`./program.exe`)).to eq "Hello from two()\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports multiple values for OBJSUFFIX" do
|
it "supports multiple values for OBJSUFFIX" do
|
||||||
@@ -787,7 +779,7 @@ EOF
|
|||||||
expect(File.exists?("two_sources.exe")).to be_truthy
|
expect(File.exists?("two_sources.exe")).to be_truthy
|
||||||
expect(File.exists?("one.oooo")).to be_truthy
|
expect(File.exists?("one.oooo")).to be_truthy
|
||||||
expect(File.exists?("two.ooo")).to be_truthy
|
expect(File.exists?("two.ooo")).to be_truthy
|
||||||
expect(`./two_sources.exe`).to eq "This is a C program with two sources.\n"
|
expect(nr(`./two_sources.exe`)).to eq "This is a C program with two sources.\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports multiple values for LIBSUFFIX" do
|
it "supports multiple values for LIBSUFFIX" do
|
||||||
@@ -795,7 +787,7 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "libsuffix.rb")
|
result = run_rscons(rsconscript: "libsuffix.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("two_sources.exe")).to be_truthy
|
expect(File.exists?("two_sources.exe")).to be_truthy
|
||||||
expect(`./two_sources.exe`).to eq "This is a C program with two sources.\n"
|
expect(nr(`./two_sources.exe`)).to eq "This is a C program with two sources.\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports multiple values for ASSUFFIX" do
|
it "supports multiple values for ASSUFFIX" do
|
||||||
@@ -810,7 +802,7 @@ EOF
|
|||||||
%r{Linking two_sources.exe},
|
%r{Linking two_sources.exe},
|
||||||
])
|
])
|
||||||
expect(File.exists?("two_sources.exe")).to be_truthy
|
expect(File.exists?("two_sources.exe")).to be_truthy
|
||||||
expect(`./two_sources.exe`).to eq "This is a C program with two sources.\n"
|
expect(nr(`./two_sources.exe`)).to eq "This is a C program with two sources.\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports dumping an Environment's construction variables" do
|
it "supports dumping an Environment's construction variables" do
|
||||||
@@ -849,7 +841,7 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "cvar_array.rb")
|
result = run_rscons(rsconscript: "cvar_array.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("build/e.1/simple.c.o")).to be_truthy
|
expect(File.exists?("build/e.1/simple.c.o")).to be_truthy
|
||||||
expect(`./simple.exe`).to eq "This is a simple C program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C program\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports registering multiple build targets with the same target path" do
|
it "supports registering multiple build targets with the same target path" do
|
||||||
@@ -940,7 +932,7 @@ EOF
|
|||||||
result = run_rscons
|
result = run_rscons
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
slines = lines(result.stdout)
|
slines = lines(result.stdout)
|
||||||
if RUBY_PLATFORM =~ /mingw/
|
if RUBY_PLATFORM =~ /mingw|msys/
|
||||||
verify_lines(slines, [%r{Linking mine.dll}])
|
verify_lines(slines, [%r{Linking mine.dll}])
|
||||||
expect(File.exists?("mine.dll")).to be_truthy
|
expect(File.exists?("mine.dll")).to be_truthy
|
||||||
else
|
else
|
||||||
@@ -952,7 +944,7 @@ EOF
|
|||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(result.stdout).to eq ""
|
expect(result.stdout).to eq ""
|
||||||
|
|
||||||
ld_library_path_prefix = (RUBY_PLATFORM =~ /mingw/ ? "" : "LD_LIBRARY_PATH=. ")
|
ld_library_path_prefix = (RUBY_PLATFORM =~ /mingw|msys/ ? "" : "LD_LIBRARY_PATH=. ")
|
||||||
expect(`#{ld_library_path_prefix}./test-shared.exe`).to match /Hi from one/
|
expect(`#{ld_library_path_prefix}./test-shared.exe`).to match /Hi from one/
|
||||||
expect(`./test-static.exe`).to match /Hi from one/
|
expect(`./test-static.exe`).to match /Hi from one/
|
||||||
end
|
end
|
||||||
@@ -971,7 +963,7 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "shared_library_cxx.rb")
|
result = run_rscons(rsconscript: "shared_library_cxx.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
slines = lines(result.stdout)
|
slines = lines(result.stdout)
|
||||||
if RUBY_PLATFORM =~ /mingw/
|
if RUBY_PLATFORM =~ /mingw|msys/
|
||||||
verify_lines(slines, [%r{Linking mine.dll}])
|
verify_lines(slines, [%r{Linking mine.dll}])
|
||||||
else
|
else
|
||||||
verify_lines(slines, [%r{Linking libmine.so}])
|
verify_lines(slines, [%r{Linking libmine.so}])
|
||||||
@@ -981,7 +973,7 @@ EOF
|
|||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(result.stdout).to eq ""
|
expect(result.stdout).to eq ""
|
||||||
|
|
||||||
ld_library_path_prefix = (RUBY_PLATFORM =~ /mingw/ ? "" : "LD_LIBRARY_PATH=. ")
|
ld_library_path_prefix = (RUBY_PLATFORM =~ /mingw|msys/ ? "" : "LD_LIBRARY_PATH=. ")
|
||||||
expect(`#{ld_library_path_prefix}./test-shared.exe`).to match /Hi from one/
|
expect(`#{ld_library_path_prefix}./test-shared.exe`).to match /Hi from one/
|
||||||
expect(`./test-static.exe`).to match /Hi from one/
|
expect(`./test-static.exe`).to match /Hi from one/
|
||||||
end
|
end
|
||||||
@@ -1112,7 +1104,7 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "command_builder.rb")
|
result = run_rscons(rsconscript: "command_builder.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
verify_lines(lines(result.stdout), [%r{BuildIt simple.exe}])
|
verify_lines(lines(result.stdout), [%r{BuildIt simple.exe}])
|
||||||
expect(`./simple.exe`).to eq "This is a simple C program\n"
|
expect(nr(`./simple.exe`)).to eq "This is a simple C program\n"
|
||||||
|
|
||||||
result = run_rscons(rsconscript: "command_builder.rb")
|
result = run_rscons(rsconscript: "command_builder.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
@@ -1593,7 +1585,7 @@ EOF
|
|||||||
result = run_rscons(rsconscript: "shared_library_set_shld.rb")
|
result = run_rscons(rsconscript: "shared_library_set_shld.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
slines = lines(result.stdout)
|
slines = lines(result.stdout)
|
||||||
if RUBY_PLATFORM =~ /mingw/
|
if RUBY_PLATFORM =~ /mingw|msys/
|
||||||
verify_lines(slines, [%r{Linking mine.dll}])
|
verify_lines(slines, [%r{Linking mine.dll}])
|
||||||
else
|
else
|
||||||
verify_lines(slines, [%r{Linking libmine.so}])
|
verify_lines(slines, [%r{Linking libmine.so}])
|
||||||
@@ -1801,12 +1793,14 @@ EOF
|
|||||||
{"check_d_compiler.rb" => "when no arguments are given",
|
{"check_d_compiler.rb" => "when no arguments are given",
|
||||||
"check_d_compiler_find_first.rb" => "when arguments are given"}.each_pair do |rsconscript, desc|
|
"check_d_compiler_find_first.rb" => "when arguments are given"}.each_pair do |rsconscript, desc|
|
||||||
context desc do
|
context desc do
|
||||||
it "finds the first listed D compiler" do
|
unless RUBY_PLATFORM =~ /mingw|msys/
|
||||||
test_dir "configure"
|
it "finds the first listed D compiler" do
|
||||||
result = run_rscons(rsconscript: rsconscript, op: "configure")
|
test_dir "configure"
|
||||||
expect(result.stderr).to eq ""
|
result = run_rscons(rsconscript: rsconscript, op: "configure")
|
||||||
expect(result.status).to eq 0
|
expect(result.stderr).to eq ""
|
||||||
expect(result.stdout).to match /Checking for D compiler\.\.\. gdc/
|
expect(result.status).to eq 0
|
||||||
|
expect(result.stdout).to match /Checking for D compiler\.\.\. gdc/
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "finds the second listed D compiler" do
|
it "finds the second listed D compiler" do
|
||||||
@@ -1830,13 +1824,15 @@ EOF
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "successfully tests a compiler with an unknown name that uses gdc-compatible options" do
|
unless RUBY_PLATFORM =~ /mingw|msys/
|
||||||
test_dir "configure"
|
it "successfully tests a compiler with an unknown name that uses gdc-compatible options" do
|
||||||
create_exe "mycompiler", %[exec gdc "$@"]
|
test_dir "configure"
|
||||||
result = run_rscons(rsconscript: "check_d_compiler_custom.rb", op: "configure")
|
create_exe "mycompiler", %[exec gdc "$@"]
|
||||||
expect(result.stderr).to eq ""
|
result = run_rscons(rsconscript: "check_d_compiler_custom.rb", op: "configure")
|
||||||
expect(result.status).to eq 0
|
expect(result.stderr).to eq ""
|
||||||
expect(result.stdout).to match /Checking for D compiler\.\.\. mycompiler/
|
expect(result.status).to eq 0
|
||||||
|
expect(result.stdout).to match /Checking for D compiler\.\.\. mycompiler/
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "successfully tests a compiler with an unknown name that uses ldc2-compatible options" do
|
it "successfully tests a compiler with an unknown name that uses ldc2-compatible options" do
|
||||||
@@ -2226,6 +2222,16 @@ EOF
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "on_fail option" do
|
||||||
|
it "prints on_fail messages and calls on_fail procs on failure" do
|
||||||
|
test_dir "configure"
|
||||||
|
result = run_rscons(rsconscript: "on_fail.rb", op: %w[configure])
|
||||||
|
expect(result.status).to_not eq 0
|
||||||
|
expect(result.stdout).to match /Install the foo123 package/
|
||||||
|
expect(result.stdout).to match /Install the foo123cxx package/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it "does everything" do
|
it "does everything" do
|
||||||
test_dir "configure"
|
test_dir "configure"
|
||||||
create_exe "pkg-config", "echo '-DMYPACKAGE'"
|
create_exe "pkg-config", "echo '-DMYPACKAGE'"
|
||||||
@@ -2379,7 +2385,7 @@ EOF
|
|||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(result.stdout).to match %r{Compiling/Linking}
|
expect(result.stdout).to match %r{Compiling/Linking}
|
||||||
expect(File.exists?("test.exe")).to be_truthy
|
expect(File.exists?("test.exe")).to be_truthy
|
||||||
ld_library_path_prefix = (RUBY_PLATFORM =~ /mingw/ ? "" : "LD_LIBRARY_PATH=. ")
|
ld_library_path_prefix = (RUBY_PLATFORM =~ /mingw|msys/ ? "" : "LD_LIBRARY_PATH=. ")
|
||||||
expect(`#{ld_library_path_prefix}./test.exe`).to match /three/
|
expect(`#{ld_library_path_prefix}./test.exe`).to match /three/
|
||||||
|
|
||||||
result = run_rscons(rsconscript: "c_shared_library.rb")
|
result = run_rscons(rsconscript: "c_shared_library.rb")
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ EOF
|
|||||||
expect(RbConfig::CONFIG).to receive(:[]).with("host_os").and_return("mingw")
|
expect(RbConfig::CONFIG).to receive(:[]).with("host_os").and_return("mingw")
|
||||||
end
|
end
|
||||||
it "returns the number of logical processors that wmic reports" do
|
it "returns the number of logical processors that wmic reports" do
|
||||||
expect(Util).to receive(:`).with("wmic cpu get NumberOfLogicalProcessors /value").and_return("NumberOfLogicalProcessors=7")
|
expect(Util).to receive(:`).with("wmic cpu get NumberOfLogicalProcessors -value").and_return("NumberOfLogicalProcessors=7")
|
||||||
expect(Util.determine_n_threads).to eq(7)
|
expect(Util.determine_n_threads).to eq(7)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user