Commit 7967c76e authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2940 from zzak/build_mrbtest

Add build_mrbtest after config block is evaluated
parents 402890d5 bacb8268
...@@ -116,9 +116,7 @@ end ...@@ -116,9 +116,7 @@ end
desc "run all mruby tests" desc "run all mruby tests"
task :test => ["all"] do task :test => ["all"] do
MRuby.each_target do MRuby.each_target do
if gems.find { |v| v.name == 'mruby-test' } run_test if test_enabled?
run_test unless build_mrbtest_lib_only?
end
end end
end end
......
...@@ -114,9 +114,9 @@ MRuby::Build.new('test') do |conf| ...@@ -114,9 +114,9 @@ MRuby::Build.new('test') do |conf|
enable_debug enable_debug
conf.enable_bintest conf.enable_bintest
conf.enable_test
conf.gembox 'default' conf.gembox 'default'
conf.gem :core => "mruby-test"
end end
# Define cross build settings # Define cross build settings
......
...@@ -32,7 +32,7 @@ MRuby::Gem::Specification.new('mruby-test') do |spec| ...@@ -32,7 +32,7 @@ MRuby::Gem::Specification.new('mruby-test') do |spec|
end end
end end
gem_table = build.gems.generate_gem_table self gem_table = build.gems.generate_gem_table build
build.gems.each do |g| build.gems.each do |g|
test_rbobj = g.test_rbireps.ext(exts.object) test_rbobj = g.test_rbireps.ext(exts.object)
......
...@@ -46,7 +46,7 @@ module MRuby ...@@ -46,7 +46,7 @@ module MRuby
include LoadGems include LoadGems
attr_accessor :name, :bins, :exts, :file_separator, :build_dir, :gem_clone_dir attr_accessor :name, :bins, :exts, :file_separator, :build_dir, :gem_clone_dir
attr_reader :libmruby, :gems, :toolchains attr_reader :libmruby, :gems, :toolchains
attr_writer :enable_bintest attr_writer :enable_bintest, :enable_test
COMPILERS = %w(cc cxx objc asm) COMPILERS = %w(cc cxx objc asm)
COMMANDS = COMPILERS + %w(linker archiver yacc gperf git exts mrbc) COMMANDS = COMPILERS + %w(linker archiver yacc gperf git exts mrbc)
...@@ -85,6 +85,8 @@ module MRuby ...@@ -85,6 +85,8 @@ module MRuby
@build_mrbtest_lib_only = false @build_mrbtest_lib_only = false
@cxx_abi_enabled = false @cxx_abi_enabled = false
@cxx_exception_disabled = false @cxx_exception_disabled = false
@enable_bintest = false
@enable_test = false
@toolchains = [] @toolchains = []
MRuby.targets[@name] = self MRuby.targets[@name] = self
...@@ -94,6 +96,7 @@ module MRuby ...@@ -94,6 +96,7 @@ module MRuby
MRuby.targets[@name].instance_eval(&block) MRuby.targets[@name].instance_eval(&block)
build_mrbc_exec if name == 'host' build_mrbc_exec if name == 'host'
build_mrbtest if test_enabled?
end end
def enable_debug def enable_debug
...@@ -170,6 +173,18 @@ EOS ...@@ -170,6 +173,18 @@ EOS
MRUBY_ROOT MRUBY_ROOT
end end
def enable_test
@enable_test = true
end
def test_enabled?
@enable_test
end
def build_mrbtest
gem :core => 'mruby-test'
end
def build_mrbc_exec def build_mrbc_exec
gem :core => 'mruby-bin-mrbc' gem :core => 'mruby-bin-mrbc'
end end
...@@ -252,7 +267,7 @@ EOS ...@@ -252,7 +267,7 @@ EOS
mrbtest = exefile("#{build_dir}/bin/mrbtest") mrbtest = exefile("#{build_dir}/bin/mrbtest")
sh "#{filename mrbtest.relative_path}#{$verbose ? ' -v' : ''}" sh "#{filename mrbtest.relative_path}#{$verbose ? ' -v' : ''}"
puts puts
run_bintest if @enable_bintest run_bintest if bintest_enabled?
end end
def run_bintest def run_bintest
...@@ -297,7 +312,7 @@ EOS ...@@ -297,7 +312,7 @@ EOS
end end
def run_test def run_test
mrbtest = exefile("#{build_dir}/test/mrbtest") mrbtest = exefile("#{build_dir}/bin/mrbtest")
if (@test_runner.command == nil) if (@test_runner.command == nil)
puts "You should run #{mrbtest} on target device." puts "You should run #{mrbtest} on target device."
puts puts
......
...@@ -22,6 +22,7 @@ MRuby::Build.new do |conf| ...@@ -22,6 +22,7 @@ MRuby::Build.new do |conf|
c.defines += %w(MRB_GC_FIXED_ARENA) c.defines += %w(MRB_GC_FIXED_ARENA)
end end
conf.enable_bintest conf.enable_bintest
conf.enable_test
end end
MRuby::Build.new('cxx_abi') do |conf| MRuby::Build.new('cxx_abi') do |conf|
...@@ -33,18 +34,9 @@ MRuby::Build.new('cxx_abi') do |conf| ...@@ -33,18 +34,9 @@ MRuby::Build.new('cxx_abi') do |conf|
c.defines += %w(MRB_GC_FIXED_ARENA) c.defines += %w(MRB_GC_FIXED_ARENA)
end end
conf.enable_bintest conf.enable_bintest
conf.enable_test
enable_cxx_abi enable_cxx_abi
build_mrbc_exec build_mrbc_exec
end end
MRuby::Build.new('test') do |conf|
toolchain :gcc
enable_debug
conf.enable_bintest
conf.gembox 'full-core'
conf.gem :core => "mruby-test"
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment