Files
mruby-mruby/tasks/test.rake
T
KOBAYASHI Shuji 3a8d7bdf82 Delay test code build until rake test
With this change, the test code will not be built unless `rake test` is
run, so there will be almost no side effects even if `enable_test` is
always set (but, gems specified by `add_test_dependency` are included
in `libmruby.a`).

Also added are `test: build` task, which only builds the test code
(including the main code), and `test: run` task, which only runs tests
independent of build. Therefore, the idiom for building in parallel and
not running tests in parallel is `rake -m test:build && rake test:run`.
2021-01-08 20:36:54 +09:00

65 lines
1.3 KiB
Ruby

desc "build and run all mruby tests"
task :test => "test:build" do
Rake::Task["test:run"].invoke
end
namespace :test do |test_ns|
desc "build and run library tests"
task :lib => "build:lib" do
test_ns["run:lib"].invoke
end
desc "build and run command binaries tests"
task :bin => :all do
test_ns["run:bin"].invoke
end
desc "build all mruby tests"
task :build => "build:lib"
namespace :build do
desc "build library tests"
task :lib
end
desc "run all mruby tests"
task :run
namespace :run do
desc "run library tests"
task :lib
desc "run command binaries tests"
task :bin
end
end
MRuby.each_target do |build|
if build.test_enabled?
t = task "test:build:lib:#{build.name}" => :all do
gem = build.gem(core: 'mruby-test')
gem.setup
gem.setup_compilers
Rake::Task[build.define_installer_if_needed("mrbtest")].invoke
end
task "test:build:lib" => t
t = task "test:run:lib:#{build.name}" do
build.run_test
end
task "test:run" => t
task "test:run:lib" => t
end
if build.bintest_enabled?
t = task "test:run:bin:#{build.name}" do
build.run_bintest
end
task "test:run" => t
task "test:run:bin" => t
end
end
task :clean do
rm_f "#{MRuby::Build.install_dir}/mrbtest"
end