Dmitrijs Ledkovs has proposed merging lp:~xnox/upstart/fix-qemu-test into 
lp:upstart.

Requested reviews:
  Upstart Reviewers (upstart-reviewers)

For more details, see:
https://code.launchpad.net/~xnox/upstart/fix-qemu-test/+merge/137223

Originally the race was noticed in the Ubuntu Cloud image booted in qemu as 
part of autopkgtest runner.

Waiting for the pid of the test job, makes this race evident on my local host 
as well.

At first, I have tried to do the log checks in the pid greater than zero 
branch, but at that time the log was not written yet, hence I moved it later @ 
the test clean up. I am not sure how correct this is.

With this change & stgrabers initctl2dot merge fix, the autopkgtest pass as run 
in the jenkins environment.
-- 
https://code.launchpad.net/~xnox/upstart/fix-qemu-test/+merge/137223
Your team Upstart Reviewers is requested to review the proposed merge of 
lp:~xnox/upstart/fix-qemu-test into lp:upstart.
=== modified file 'init/tests/test_job_process.c'
--- init/tests/test_job_process.c	2012-11-26 14:04:27 +0000
+++ init/tests/test_job_process.c	2012-11-30 15:08:30 +0000
@@ -4787,6 +4787,7 @@
 			assert0 (unlink (script));
 		} else {
 			TEST_GT (pid, 0);
+			TEST_EQ (waitpid (pid, &status, 0), pid);
 		}
 
 		TEST_ALLOC_SAFE {
@@ -4795,7 +4796,21 @@
 		}
 	}
 
-	assert0 (rmdir (dirname));
+	if (rmdir (dirname)) {
+		TEST_GT (sprintf (filename, "%s/simple-test.log", dirname), 0);
+		output = fopen (filename, "r");
+		TEST_NE_P (output, NULL);
+
+		CHECK_FILE_EQ (output, "hello world\r\n", TRUE);
+
+		TEST_FILE_END (output);
+
+		TEST_EQ (fclose (output), 0);
+			
+		assert0 (unlink (filename));
+		assert0 (rmdir (dirname));
+	};
+
 
 	/************************************************************/
 	TEST_FEATURE ("with single-line script and 'console log'");

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to