diff options
author | Koichi Sasada <ko1@atdot.net> | 2021-10-25 15:43:46 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2021-10-25 15:47:09 +0900 |
commit | 7864efa105921eb3900c843126f2e0db02b9c6ae (patch) | |
tree | 3b4fdafe54c7fc068ee77ca893fd86c2d6134cf7 | |
parent | b74f9d656a028430d942fb609f79c4027f0549fa (diff) | |
download | ruby-7864efa105921eb3900c843126f2e0db02b9c6ae.tar.gz |
introduce check code for mysterious EBADF
parallel test randomly failed with EBADF.
This patch checks wich suite causes this error.
ex) http://ci.rvm.jp/results/trunk@ruby-iga/3690219
```
/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:88:in `close': Bad file descriptor (Errno::EBADF)
/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:88:in `ensure in _run_suite'
/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:89:in `_run_suite'
/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:30:in `block in _run_suites'
/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:29:in `map'
/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:29:in `_run_suites'
/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:128:in `run'
/tmp/ruby/v3/src/trunk/tool/lib/test/unit/parallel.rb:211:in `<main>'
```
-rw-r--r-- | tool/lib/test/unit/parallel.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tool/lib/test/unit/parallel.rb b/tool/lib/test/unit/parallel.rb index b3a8957f26..544239921c 100644 --- a/tool/lib/test/unit/parallel.rb +++ b/tool/lib/test/unit/parallel.rb @@ -85,8 +85,21 @@ module Test Test::Unit::Runner.output = orig_stdout $stdin = orig_stdin if orig_stdin $stdout = orig_stdout if orig_stdout - o.close if o && !o.closed? - i.close if i && !i.closed? + + # To figure out which suite raises EBADF error. + begin + o.close if o && !o.closed? + rescue Exception => e + STDERR.puts "#{e} at #{suite.name} (o)" + raise + end + + begin + i.close if i && !i.closed? + rescue Exception => e + STDERR.puts "#{e} at #{suite.name} (i)" + raise + end end def run(args = []) # :nodoc: |