Commit Graph

6 Commits

Author SHA1 Message Date
dearblue cf91cbf090 Adding a serialized test task
Under normal circumstances, `rake -m test` will parallelize not only the build task, but also the test task.
With this patch, `rake -m test:run:serial` will parallelize the build tasks, but the test tasks will be done one by one in sequence.

The name of the task to be added is as follows:

| tasks to be added     | corresponding exist tasks
| --------------------- | ----------------
| `test:run:serial`     | `test:run`
| `test:run:serial:bin` | `test:run:bin`
| `test:run:serial:lib` | `test:run:lib`
2024-11-16 21:21:51 +09:00
KOBAYASHI Shuji 3cf0e85ed7 Explicit top level task to clarify in tasks/test.rake 2021-02-07 19:11:54 +09:00
dearblue 9d1a659bc7 Ignore if conf.enable_test does not exist
Because if the configuration file didn't contain any `conf.enable_test`, `rake test` would report an exception and exit.

```console
% cat my_config.rb
MRuby::Build.new { toolchain }

% rake MRUBY_CONFIG=my_config.rb test

  ...SNIP...

rake aborted!
NoMethodError: undefined method `invoke' for nil:NilClass
/var/tmp/mruby/tasks/test.rake:24:in `block (3 levels) in <top (required)>'
Tasks: TOP => test => test:build => test:build:lib
(See full trace by running task with --trace)
```
2021-02-06 18:09:27 +09:00
KOBAYASHI Shuji 02121cbd65 Fix that sometimes parallel build of test code fails; fix #5284
The cause is that `mrbgem.rake` of` mruby-test` gem is loaded when test
code is requested to be built, but when `mrbgem.rake` is loaded,
`MRuby::Gem.current` is updated, which is not thread safe.

Address this by not loading `mrbgem.rake` in parallel.
2021-01-12 15:41:22 +09:00
KOBAYASHI Shuji fe28e8617e Fix the condition to remove mrbtest when rake clean 2021-01-10 16:28:14 +09:00
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