diff options
| author | Chris Reuter <[email protected]> | 2021-10-21 21:33:17 -0400 |
|---|---|---|
| committer | Chris Reuter <[email protected]> | 2021-10-21 21:58:45 -0400 |
| commit | 5c4273f944b538bc24ed98c52991ea8bf9044654 (patch) | |
| tree | 2d65523aa60dff53a4cedd95e92abf25b0755a39 /lib | |
| parent | b6b4ac8270fcef135291cbde60d18f1c8a4c98e4 (diff) | |
| download | mruby-5c4273f944b538bc24ed98c52991ea8bf9044654.tar.gz mruby-5c4273f944b538bc24ed98c52991ea8bf9044654.zip | |
Added testing support for cross-MinGW builds.
This adds a build_config that will cross-build a Windows executable
using the MinGW cross-compiler and will also run the unit (i.e.
'rake test') using Wine.
For this to work, I made some modifications to the underlying test
scripts as well as some minor changes to a couple of the tests
themselves.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mruby/build.rb | 17 | ||||
| -rw-r--r-- | lib/mruby/build/command.rb | 5 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index 67267ab46..66005a6df 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -541,6 +541,23 @@ EOS end end + def run_bintest + puts ">>> Bintest #{name} <<<" + targets = @gems.select { |v| File.directory? "#{v.dir}/bintest" }.map { |v| filename v.dir } + targets << filename(".") if File.directory? "./bintest" + mrbc = @gems["mruby-bin-mrbc"] ? exefile("#{@build_dir}/bin/mrbc") : mrbcfile + + emulator = @test_runner.command + emulator = @test_runner.shellquote(emulator) if emulator + + env = { + "BUILD_DIR" => @build_dir, + "MRBCFILE" => mrbc, + "EMULATOR" => @test_runner.emulator, + } + sh env, "ruby test/bintest.rb#{verbose_flag} #{targets.join ' '}" + end + protected def create_mrbc_build; end diff --git a/lib/mruby/build/command.rb b/lib/mruby/build/command.rb index c93d08ea7..31a595ef0 100644 --- a/lib/mruby/build/command.rb +++ b/lib/mruby/build/command.rb @@ -363,6 +363,11 @@ module MRuby @flags = [] end + def emulator + return "" unless @command + return [@command, *@flags].map{|c| shellquote(c)}.join(' ') + end + def run(testbinfile) puts "TEST for " + @build.name _run runner_options, { :flags => [flags, verbose_flag].flatten.join(' '), :infile => testbinfile } |
