diff options
author | Koichi Sasada <ko1@atdot.net> | 2022-02-05 03:10:15 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2022-02-06 03:05:47 +0900 |
commit | 603ab709615dd35fa8ebe53087c27631f5b07812 (patch) | |
tree | c1db87eabb9d1a16ca25ab24675a2ce3f85b1c00 /bootstraptest/test_thread.rb | |
parent | 2a76440fac62bb0f6e53ccada07caf4b47b78cf9 (diff) |
support concurrent btest execution
* `-j` option for concurrent test with threads
* `-jN` uses N threads
* `-j` uses nproc/2 threads
* Introduce `BT` struct to manage configurations
* Introduce `Assertion` to manage all assertions
* Remove all toplevel instance variables
* Show elapsed seconds at last
```
$ time make btest
...
real 0m37.319s
user 0m26.221s
sys 0m16.534s
$ time make btest TESTOPTS=-j
...
real 0m11.812s
user 0m36.667s
sys 0m21.872s
```
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5528
Diffstat (limited to 'bootstraptest/test_thread.rb')
-rw-r--r-- | bootstraptest/test_thread.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb index 38a55ff229..5361828403 100644 --- a/bootstraptest/test_thread.rb +++ b/bootstraptest/test_thread.rb @@ -243,7 +243,7 @@ assert_equal 'true', %{ } assert_equal 'ok', %{ - open("zzz.rb", "w") do |f| + open("zzz_t1.rb", "w") do |f| f.puts <<-END begin Thread.new { fork { GC.start } }.join @@ -254,7 +254,7 @@ assert_equal 'ok', %{ end END end - require "./zzz.rb" + require "./zzz_t1.rb" $result } @@ -408,7 +408,7 @@ assert_equal 'ok', %q{ } assert_equal 'ok', %{ - open("zzz.rb", "w") do |f| + open("zzz_t2.rb", "w") do |f| f.puts <<-'end;' # do begin m = Thread::Mutex.new @@ -432,7 +432,7 @@ assert_equal 'ok', %{ end end; end - require "./zzz.rb" + require "./zzz_t2.rb" $result } |