Merge lp:~xnox/upstart/fix-qemu-test into lp:upstart
Proposed by
Dimitri John Ledkov
Status: | Superseded |
---|---|
Proposed branch: | lp:~xnox/upstart/fix-qemu-test |
Merge into: | lp:upstart |
Diff against target: |
24 lines (+10/-0) 1 file modified
init/tests/test_job_process.c (+10/-0) |
To merge this branch: | bzr merge lp:~xnox/upstart/fix-qemu-test |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Hunt | Approve | ||
Review via email: mp+137223@code.launchpad.net |
This proposal has been superseded by a proposal from 2012-12-03.
Description of the change
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.
To post a comment you must log in.
Hi Dmitrijs,
I think this is still subtly racy since it is possible that even in a failure scenario a partial log could be written.
The fix I'd suggest is:
(1) Put a check immediately after the 'nih_free (class)' in the TEST_ALLOC_SAFE block that performs the following checks:
- if test_alloc_failed is true, and the log file exists, just unlink it (there is no point in checking it as it might be only a partial log - we cannot know).
- if test_alloc_failed is not true, ensure the log file exists, check its contents and unlink it (essentially the block you have added).
(2) Re-instate the original 'assert0 (rmdir (dirname))' at the end of the test.
This way, there is no possibility of:
- the tests failing to detect that a full log was somehow written in a failure scenario.
- a failure resulting from a partial log being written in one of the failure iterations, followed by a successful write in the successful iteration (recall that the logs are appended to).