Project

General

Profile

Actions

Bug #5132

closed

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

Added by ayumin (Ayumu AIZAWA) over 13 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
1.9
Backport:
[ruby-dev:44303]

Description

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

$ uname -a
Linux Ubuntu11 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:07:17 UTC 2011 x86_64 x86_64 x86_64 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#test_ignore_jzero = 0.05 s = .
TestParallel::TestParallel#test_jobs_status = 0.05 s = F
TestParallel::TestParallel#test_no_retry_option = 0.05 s = F
TestParallel::TestParallel#test_should_retry_failed_on_workers = 0.05 s = F
TestParallel::TestParallel#test_should_run_all_without_any_leaks = 0.05 s = F
TestParallel::TestParallelWorker#test_accept_run_command_multiple_times = 0.05 s = .
TestParallel::TestParallelWorker#test_done = 0.05 s = .
TestParallel::TestParallelWorker#test_p = 0.05 s = .
TestParallel::TestParallelWorker#test_quit = 0.05 s = .
TestParallel::TestParallelWorker#test_run = 0.05 s = .
TestParallel::TestParallelWorker#test_run_multiple_testcase_in_one_file = 0.05 s = .

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

  1. Failure:
    test_jobs_status(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/test_parallel.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 method each' 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 _run_suites'\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:in run_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:in each'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:630:in run'\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:
    test_no_retry_option(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/test_parallel.rb:168]:
    Expected /^ +\d+) Failure:\ntest_fail_at_worker(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 method each' 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 _run_suites'\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:in run_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:in each'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:630:in run'\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:
    test_should_retry_failed_on_workers(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/test_parallel.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 method each' 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 _run_suites'\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:in run_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:in each'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:630:in run'\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:
    test_should_run_all_without_any_leaks(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/test_parallel.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 method each' 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 _run_suites'\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:in run_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:in each'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:630:in run'\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

Updated by znz (Kazuhiro NISHIYAMA) over 13 years ago

  • Assignee set to sorah (Sorah Fukumori)

Updated by ayumin (Ayumu AIZAWA) over 13 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[:no_retry] || @need_quit
    
  •        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/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#test_ignore_jzero = 0.05 s = .
TestParallel::TestParallel#test_jobs_status = 0.05 s = F
TestParallel::TestParallel#test_no_retry_option = 0.05 s = F
TestParallel::TestParallel#test_should_retry_failed_on_workers = 0.05 s = .
TestParallel::TestParallel#test_should_run_all_without_any_leaks = 0.05 s = F
TestParallel::TestParallelWorker#test_accept_run_command_multiple_times = 0.05 s = .
TestParallel::TestParallelWorker#test_done = 0.06 s = .
TestParallel::TestParallelWorker#test_p = 0.05 s = .
TestParallel::TestParallelWorker#test_quit = 0.04 s = .
TestParallel::TestParallelWorker#test_run = 0.05 s = .
TestParallel::TestParallelWorker#test_run_multiple_testcase_in_one_file = 0.05 s = .

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

  1. Failure:
    test_jobs_status(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/test_parallel.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:in launch'\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:in times'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in each'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in map'\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 _run_suites'\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:in run_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:in each'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:633:in run'\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:
    test_no_retry_option(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/test_parallel.rb:168]:
    Expected /^ +\d+) Failure:\ntest_fail_at_worker(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:in launch'\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:in times'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in each'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in map'\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 _run_suites'\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:in run_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:in each'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:633:in run'\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:
    test_should_run_all_without_any_leaks(TestParallel::TestParallel) [/home/ayumin/github/ruby/test/testunit/test_parallel.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:in launch'\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:in times'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in each'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:404:in map'\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 _run_suites'\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:in run_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:in each'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:895:in _run'\n\tfrom /home/ayumin/github/ruby/lib/minitest/unit.rb:884:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:21:in run'\n\tfrom /home/ayumin/github/ruby/lib/test/unit.rb:633:in run'\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

Updated by naruse (Yui NARUSE) over 13 years ago

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

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

Actions #4

Updated by sorah (Sorah Fukumori) over 13 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/test_parallel.rb: pass "--ruby" option to
    test/testunit/tests_for_parallel/runner.rb. [Bug #5132] [ruby-dev:44303]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0