Bug #5132

test_parallel.rb fail when it run before 'make install'

Added by Ayumu AIZAWA over 2 years ago. Updated over 2 years ago.

[ruby-dev:44303]
Status:Closed
Priority:Normal
Assignee:Shota Fukumori
Category:test
Target version:1.9.3
ruby -v:1.9 Backport:

Description

make install を実行する前にmake test-all をすると、testparallel.rb が失敗します。
trunkとruby
193 で再現することまで確認しました。

$ uname -a
Linux Ubuntu11 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:07:17 UTC 2011 x8664 x8664 x8664 GNU/Linux
$ make test-all TESTS='-v test/testunit/test
parallel.rb'
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" -v test/testunit/test_parallel.rb
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" -v

Running tests:

TestParallel::TestParallel#testignorejzero = 0.05 s = .
TestParallel::TestParallel#testjobsstatus = 0.05 s = F
TestParallel::TestParallel#testnoretryoption = 0.05 s = F
TestParallel::TestParallel#test
shouldretryfailedonworkers = 0.05 s = F
TestParallel::TestParallel#testshouldrunallwithoutanyleaks = 0.05 s = F
TestParallel::TestParallelWorker#testacceptruncommandmultipletimes = 0.05 s = .
TestParallel::TestParallelWorker#test
done = 0.05 s = .
TestParallel::TestParallelWorker#testp = 0.05 s = .
TestParallel::TestParallelWorker#test
quit = 0.05 s = .
TestParallel::TestParallelWorker#testrun = 0.05 s = .
TestParallel::TestParallelWorker#test
runmultipletestcaseinone_file = 0.05 s = .

Finished tests in 0.554289s, 19.8453 tests/s, 72.1646 assertions/s.

1) Failure:
testjobsstatus(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/testparallel.rb:174]:
Expected /\d+=ptest
(first|second|third|forth) */ to match "Run options: -j t1 --jobs-status\n\n# Running tests:\n\n/home/ayumin/github/ruby/lib/test/unit.rb:496:in ensure in _run_parallel': undefined methodeach' for nil:NilClass (NoMethodError)\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:552:in _run_parallel'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:561:inrunsuites'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:746:in _run_anything'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:909:inrun_tests'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:896:in block in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:ineach'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:630:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:634:in run'\n\tfrom /home/ayumin/github/ruby/test/testunit/tests_for_parallel/runner.rb:10:in'\n".

2) Failure:
testnoretryoption(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/testparallel.rb:168]:
Expected /^ +\d+) Failure:\ntestfailatworker(TestD)/ to match "Run options: -j t1 --no-retry\n\n# Running tests:\n\n/home/ayumin/github/ruby/lib/test/unit.rb:496:in ensure in _run_parallel': undefined methodeach' for nil:NilClass (NoMethodError)\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:552:in _run_parallel'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:561:inrunsuites'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:746:in _run_anything'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:909:inruntests'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:896:in block in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:ineach'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:630:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:634:in run'\n\tfrom /home/ayumin/github/ruby/test/testunit/tests_for_parallel/runner.rb:10:in'\n".

3) Failure:
testshouldretryfailedonworkers(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/testparallel.rb:161]:
Expected /Retrying.+$/ to match "Run options: -j t1\n\n# Running tests:\n\n/home/ayumin/github/ruby/lib/test/unit.rb:496:in ensure in _run_parallel': undefined methodeach' for nil:NilClass (NoMethodError)\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:552:in _run_parallel'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:561:inrunsuites'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:746:in _run_anything'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:909:inrun_tests'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:896:in block in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:ineach'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:630:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:634:in run'\n\tfrom /home/ayumin/github/ruby/test/testunit/tests_for_parallel/runner.rb:10:in'\n".

4) Failure:
testshouldrunallwithoutanyleaks(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/testparallel.rb:155]:
Expected /[SF.]{7}$/ to match "Run options: -j t1\n\n# Running tests:\n\n/home/ayumin/github/ruby/lib/test/unit.rb:496:in ensure in _run_parallel': undefined methodeach' for nil:NilClass (NoMethodError)\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:552:in _run_parallel'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:561:in
runsuites'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:746:in _run_anything'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:909:inruntests'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:896:in block in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:ineach'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:630:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:634:in run'\n\tfrom /home/ayumin/github/ruby/test/testunit/tests_for_parallel/runner.rb:10:in'\n".

11 tests, 40 assertions, 4 failures, 0 errors, 0 skips
make: *** [yes-test-all] エラー 4

Associated revisions

Revision 32812
Added by Shota Fukumori over 2 years ago

  • test/testunit/testparallel.rb: pass "--ruby" option to test/testunit/testsfor_parallel/runner.rb. [Bug #5132]

History

#1 Updated by Kazuhiro NISHIYAMA over 2 years ago

  • Assignee set to Shota Fukumori

#2 Updated by Ayumu AIZAWA over 2 years ago

=begin
すみません、大事な情報が漏れていました。
Makefileを作る際に、./configure --prefix=/home/ayumin/ruby のようにインストール先を指定しています。

エラーのログを消すために以下のようなパッチをあてて実行すると

$ git diff
diff --git a/lib/test/unit.rb b/lib/test/unit.rb
index 09708d1..33301f9 100644
--- a/lib/test/unit.rb
+++ b/lib/test/unit.rb
@@ -493,35 +493,38 @@ module Test
end
end
end
- @workers.each do |worker|
+ if @workers
+ @workers.each do |worker|
+ begin
+ timeout(1) do
+ worker.puts "quit"
+ end
+ rescue Errno::EPIPE
+ rescue Timeout::Error
+ end
+ worker.close
+ end
begin
- timeout(1) do
- worker.puts "quit"
+ timeout(0.2@workers.size) do
+ Process.waitall
end
- rescue Errno::EPIPE
rescue Timeout::Error
- end
- worker.close
- end
- begin
- timeout(0.2
@workers.size) do
- Process.waitall
- end
- rescue Timeout::Error
- @workers.each do |worker|
- begin
- Process.kill(:KILL,worker.pid)
- rescue Errno::ESRCH; end
+ @workers.each do |worker|
+ begin
+ Process.kill(:KILL,worker.pid)
+ rescue Errno::ESRCH; end
+ end
end
end
-
if @interrupt || @options[:noretry] || @needquit
- rep.each do |r|
- report.push(r[:report])
+ unless rep.empty?
+ rep.each do |r|
+ report.push(
r[:report])
+ end
+ @errors += rep.map{|x| x[:result][0] }.inject(:+)
+ @failures += rep.map{|x| x[:result][1] }.inject(:+)
+ @skips += rep.map{|x| x[:result][2] }.inject(:+)
end
- @errors += rep.map{|x| x[:result][0] }.inject(:+)
- @failures += rep.map{|x| x[:result][1] }.inject(:+)
- @skips += rep.map{|x| x[:result][2] }.inject(:+)
else
puts ""
puts "Retrying..."

以下のように出力されるようになり、(({lib/test/unit.rb:240})) の (({IO.popen})) の呼び出しの時に(({ miniruby})) ではなく インストール先のrubyを参照しようとしているように見えます。

$ make test-all TESTS='-v test/testunit/testparallel.rb'
./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" -v test/testunit/test
parallel.rb
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" -v

# Running tests:

TestParallel::TestParallel#testignorejzero = 0.05 s = .
TestParallel::TestParallel#testjobsstatus = 0.05 s = F
TestParallel::TestParallel#testnoretryoption = 0.05 s = F
TestParallel::TestParallel#test
shouldretryfailedonworkers = 0.05 s = .
TestParallel::TestParallel#testshouldrunallwithoutanyleaks = 0.05 s = F
TestParallel::TestParallelWorker#testacceptruncommandmultipletimes = 0.05 s = .
TestParallel::TestParallelWorker#test
done = 0.06 s = .
TestParallel::TestParallelWorker#testp = 0.05 s = .
TestParallel::TestParallelWorker#test
quit = 0.04 s = .
TestParallel::TestParallelWorker#testrun = 0.05 s = .
TestParallel::TestParallelWorker#test
runmultipletestcaseinone_file = 0.05 s = .

Finished tests in 0.543272s, 20.2477 tests/s, 73.6279 assertions/s.

1) Failure:
testjobsstatus(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/testparallel.rb:174]:
Expected /\d+=ptest
(first|second|third|forth) */ to match "Run options: -j t1 --jobs-status\n\n# Running tests:\n\n\nRetrying...\n\n\n\n/home/ayumin/github/ruby/lib/test/unit.rb:240:in popen': No such file or directory - /home/ayumin/tmp/ruby/bin/ruby (Errno::ENOENT)\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:240:inlaunch'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:405:in block in _run_parallel'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:intimes'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in each'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:inmap'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in _run_parallel'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:564:inrunsuites'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:746:in _run_anything'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:909:inrun_tests'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:896:in block in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:ineach'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:633:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:637:in run'\n\tfrom /home/ayumin/github/ruby/test/testunit/tests_for_parallel/runner.rb:10:in'\n".

2) Failure:
testnoretryoption(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/testparallel.rb:168]:
Expected /^ +\d+) Failure:\ntestfailatworker(TestD)/ to match "Run options: -j t1 --no-retry\n\n# Running tests:\n\n\n\n/home/ayumin/github/ruby/lib/test/unit.rb:240:in popen': No such file or directory - /home/ayumin/tmp/ruby/bin/ruby (Errno::ENOENT)\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:240:inlaunch'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:405:in block in _run_parallel'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:intimes'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in each'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:inmap'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in _run_parallel'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:564:inrunsuites'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:746:in _run_anything'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:909:inruntests'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:896:in block in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:ineach'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:633:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:637:in run'\n\tfrom /home/ayumin/github/ruby/test/testunit/tests_for_parallel/runner.rb:10:in'\n".

3) Failure:
testshouldrunallwithoutanyleaks(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/testparallel.rb:155]:
Expected /[SF.]{7}$/ to match "Run options: -j t1\n\n# Running tests:\n\n\nRetrying...\n\n\n\n/home/ayumin/github/ruby/lib/test/unit.rb:240:in popen': No such file or directory - /home/ayumin/tmp/ruby/bin/ruby (Errno::ENOENT)\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:240:inlaunch'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:405:in block in _run_parallel'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:intimes'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in each'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:inmap'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in _run_parallel'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:564:in
runsuites'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:746:in _run_anything'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:909:inruntests'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:896:in block in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:ineach'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:633:inrun'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:637:in run'\n\tfrom /home/ayumin/github/ruby/test/testunit/tests_for_parallel/runner.rb:10:in'\n".

11 tests, 40 assertions, 3 failures, 0 errors, 0 skips
make: *** [yes-test-all] エラー 3

=end

#3 Updated by Yui NARUSE over 2 years ago

  • Status changed from Open to Assigned
  • Target version changed from 2.0.0 to 1.9.3

Jeremy Evans も同じ話を で指摘していますね。
というわけでそらさんよろしく。

#4 Updated by Shota Fukumori over 2 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r32812.
Ayumu, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • test/testunit/testparallel.rb: pass "--ruby" option to test/testunit/testsfor_parallel/runner.rb. [Bug #5132]

Also available in: Atom PDF