On 30/08/11 at 13:52 +0200, Petr Salinger wrote:
> >>>Would you have time to turn that into a (tested ;) ) patch?
> 
> With attached patch on top of 1.9.3~preview1+svn33077-3
> 
> "make test"

Thanks!

Could you try make test-all ? While some failures and errors are
expected, it stresses the interpreter a bit more, so it's a good way to
check that it doesn't block.

> #244 test_fork.rb:51:in `<top (required)>':
>      a = []
>      trap(:INT) { a.push(1) }
>      trap(:TERM) { a.push(2) }
>      pid = $$
>      begin
>        fork do
>          sleep 0.5
>          Process.kill(:INT, pid)
>          Process.kill(:TERM, pid)
>        end
> 
>        sleep 1
>        a.sort
>      rescue NotImplementedError
>        [1, 2]
>      end
>   #=> "[]" (expected "[1, 2]")  [ruby-dev:44005] [Ruby 1.9 - Bug #4950]

Err. This is fairly simple, and should not fail.

Could you try this version:
<---
a = []
trap(:INT) { puts "INT recvd" ; a.push(1) }
trap(:TERM) { puts "TERM recvd" ; a.push(2) }
pid = $$
puts "parent pid: #{pid}"
begin
  fork do
    puts "child pid: #{$$}"
    sleep 0.5
    Process.kill(:INT, pid)
    Process.kill(:TERM, pid)
    puts "signals sent."
  end
  sleep 1
  a.sort
  p a
rescue NotImplementedError
  [1, 2]
end
---->

> #934 test_thread.rb:389:in `<top (required)>':
>      open("zzz.rb", "w") do |f|
>        f.puts <<-END
>          begin
>            m = Mutex.new
>            Thread.new { m.lock; sleep 1 }
>            sleep 0.3
>            parent = Thread.current
>            Thread.new do
>              sleep 0.3
>              begin
>                fork { GC.start }
>              rescue Exception
>                parent.raise $!
>              end
>            end
>            m.lock
>            pid, status = Process.wait2
>            $result = status.success? ? :ok : :ng
>          rescue NotImplementedError
>            $result = :ok
>          end
>        END
>      end
>      require "./zzz.rb"
>      $result
>   #=> "" (expected "ok")
> FAIL 2/937 tests failed
> make: *** [yes-btest-ruby] Error 1

Very strange. What about this script?
<------
m = Mutex.new
Thread.new { m.lock; sleep 3 ;  puts "after m.lock in thread" }
sleep 1
m.lock
puts "after m.lock"
------>

Lucas



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to