From cf838bfb5faed96fb41b8ae30d591fc7b7853d38 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 12 Apr 2009 22:43:10 -0700 Subject: test_exec: fix potential races in fd leak test We need to ensure children are spawned by waiting until the master is ready. --- test/exec/test_exec.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb index ec00fac..67a189c 100644 --- a/test/exec/test_exec.rb +++ b/test/exec/test_exec.rb @@ -587,6 +587,7 @@ end end wait_master_ready(log.path) + File.truncate(log.path, 0) wait_for_file(pid_file) orig_pid = pid = File.read(pid_file).to_i orig_fds = `ls -l /proc/#{pid}/fd`.split(/\n/) @@ -600,6 +601,8 @@ end end wait_for_death(pid) + wait_master_ready(log.path) + File.truncate(log.path, 0) wait_for_file(pid_file) pid = File.read(pid_file).to_i assert_not_equal orig_pid, pid @@ -607,7 +610,7 @@ end assert $?.success? # we could've inherited descriptors the first time around - assert expect_size >= curr_fds.size + assert expect_size >= curr_fds.size, curr_fds.inspect expect_size = curr_fds.size assert_nothing_raised do @@ -617,11 +620,13 @@ end end wait_for_death(pid) + wait_master_ready(log.path) + File.truncate(log.path, 0) wait_for_file(pid_file) pid = File.read(pid_file).to_i curr_fds = `ls -l /proc/#{pid}/fd`.split(/\n/) assert $?.success? - assert_equal expect_size, curr_fds.size + assert_equal expect_size, curr_fds.size, curr_fds.inspect Process.kill(:QUIT, pid) wait_for_death(pid) -- cgit v1.2.3-24-ge0c7