Allow `bintest` even if build name is not `host`
MODIFY
build_config/boxing.rb
build_config/boxing.rb
@@ -6,6 +6,7 @@ MRuby::Build.new('no-boxing') do |conf|
c.defines += %w(MRB_NO_BOXING)
end
conf.enable_test
+ conf.enable_bintest
end
MRuby::Build.new('word_boxing') do |conf|
@@ -16,6 +17,7 @@ MRuby::Build.new('word_boxing') do |conf|
c.defines += %w(MRB_WORD_BOXING)
end
conf.enable_test
+ conf.enable_bintest
end
MRuby::Build.new('nan_boxing') do |conf|
@@ -26,4 +28,5 @@ MRuby::Build.new('nan_boxing') do |conf|
c.defines += %w(MRB_NAN_BOXING)
end
conf.enable_test
+ conf.enable_bintest
end

MODIFY
lib/mruby/build.rb
lib/mruby/build.rb
@@ -206,7 +206,6 @@ EOS
end
def enable_bintest
- raise "bintest works only on 'host' target" unless name == "host"
@enable_bintest = true
end
@@ -339,7 +338,8 @@ EOS
puts ">>> Bintest #{name} <<<"
targets = @gems.select { |v| File.directory? "#{v.dir}/bintest" }.map { |v| filename v.dir }
targets << filename(".") if File.directory? "./bintest"
- sh "ruby test/bintest.rb#{verbose_flag} #{targets.join ' '}"
+ env = {"BUILD_DIR" => @build_dir}
+ sh env, "ruby test/bintest.rb#{verbose_flag} #{targets.join ' '}"
end
def print_build_summary

MODIFY
mrbgems/mruby-bin-debugger/bintest/mrdb.rb
mrbgems/mruby-bin-debugger/bintest/mrdb.rb
@@ -13,14 +13,14 @@ class BinTest_MrubyBinDebugger
script.flush
# compile
- `./bin/mrbc -g -o "#{bin.path}" "#{script.path}"`
+ `#{cmd("mrbc")} -g -o "#{bin.path}" "#{script.path}"`
# add mrdb quit
testcase << {:cmd=>"quit"}
stdin_data = testcase.map{|t| t[:cmd]}.join("\n") << "\n"
- ["bin/mrdb #{script.path}","bin/mrdb -b #{bin.path}"].each do |cmd|
+ ["#{cmd('mrdb')} #{script.path}", "#{cmd('mrdb')} -b #{bin.path}"].each do |cmd|
o, s = Open3.capture2(cmd, :stdin_data => stdin_data)
exp_vals = testcase.map{|t| t.fetch(:exp, nil)}

MODIFY
mrbgems/mruby-bin-debugger/bintest/print.rb
mrbgems/mruby-bin-debugger/bintest/print.rb
@@ -13,7 +13,7 @@ class BinTest_MrubyBinDebugger
script.flush
# compile
- `./bin/mrbc -g -o "#{bin.path}" "#{script.path}"`
+ `#{cmd("mrbc")} -g -o "#{bin.path}" "#{script.path}"`
# add mrdb quit
testcase << {:cmd=>"quit"}
@@ -21,7 +21,7 @@ class BinTest_MrubyBinDebugger
stdin_data = testcase.map{|t| t[:cmd]}.join("\n") << "\n"
prompt = /^\(#{Regexp.escape(script.path)}:\d+\) /
- ["bin/mrdb #{script.path}","bin/mrdb -b #{bin.path}"].each do |cmd|
+ ["#{cmd('mrdb')} #{script.path}", "#{cmd('mrdb')} -b #{bin.path}"].each do |cmd|
o, s = Open3.capture2(cmd, :stdin_data => stdin_data)
scanner = StringScanner.new(o)
scanner.skip_until(prompt)

MODIFY
mrbgems/mruby-bin-mirb/bintest/mirb.rb
mrbgems/mruby-bin-mirb/bintest/mirb.rb
require 'open3'
assert('mirb normal operations') do
- o, s = Open3.capture2('bin/mirb', :stdin_data => "a=1\nb=2\na+b\n")
+ o, s = Open3.capture2(cmd("mirb"), :stdin_data => "a=1\nb=2\na+b\n")
assert_true o.include?('=> 3')
assert_true o.include?('=> 2')
end
assert('regression for #1563') do
- o, s = Open3.capture2('bin/mirb', :stdin_data => "a=1;b=2;c=3\nb\nc")
+ o, s = Open3.capture2(cmd("mirb"), :stdin_data => "a=1;b=2;c=3\nb\nc")
assert_true o.include?('=> 3')
end
assert('mirb -d option') do
- o, _ = Open3.capture2('bin/mirb', :stdin_data => "$DEBUG\n")
+ o, _ = Open3.capture2(cmd("mirb"), :stdin_data => "$DEBUG\n")
assert_true o.include?('=> false')
- o, _ = Open3.capture2('bin/mirb -d', :stdin_data => "$DEBUG\n")
+ o, _ = Open3.capture2("#{cmd('mirb')} -d", :stdin_data => "$DEBUG\n")
assert_true o.include?('=> true')
end
@@ -29,7 +29,7 @@ end
EOS
lib.flush
- o, _ = Open3.capture2("bin/mirb -r #{lib.path}", :stdin_data => "Hoge.new.hoge\n")
+ o, _ = Open3.capture2("#{cmd('mirb')} -r #{lib.path}", :stdin_data => "Hoge.new.hoge\n")
assert_true o.include?('=> :hoge')
end
@@ -41,7 +41,7 @@ A = -> { a }
TESTLIB
lib.flush
- o, _ = Open3.capture2("bin/mirb -r #{lib.path}", :stdin_data => <<-TESTCODE)
+ o, _ = Open3.capture2("#{cmd('mirb')} -r #{lib.path}", :stdin_data => <<-TESTCODE)
a
a = 5
A.call

MODIFY
test/bintest.rb
test/bintest.rb
@@ -4,12 +4,11 @@ require 'test/assert.rb'
GEMNAME = ""
def cmd(s)
- case RbConfig::CONFIG['host_os']
- when /mswin(?!ce)|mingw|bccwin/
- "bin\\#{s}.exe"
- else
- "bin/#{s}"
+ path = "#{ENV['BUILD_DIR']}/bin/#{s}"
+ if /mswin(?!ce)|mingw|bccwin/ =~ RbConfig::CONFIG['host_os']
+ path = "#{path}.exe".tr("/", "\\")
end
+ path
end
def shellquote(s)

Allow `bintest` even if build name is not `host`