[15:25] <xnox> jodh: I am at a loss how come that test passes on a real system but not in the vm as started by run-adt-test.
[15:26] <jodh> xnox: alas writing the code is easy in comparison to diagnosing test failures :)
[15:27] <jodh> xnox: we need to identify the test that creates the file in question and see why it isn't being removed as expected.
[15:27] <jodh> xnox: you could always compare the autopkgtest env with non-VM env with... procenv :-)
[15:28] <xnox> the test is correct.
[15:28] <xnox> let me add a print statement to see if it takes the assumed code path in the vm.
[15:32] <jodh> xnox: actually - remember to take care with inserting any debug code since you're in a TEST_ALLOC_FAIL() block and nih_debug et al allocate memory (http://upstart.ubuntu.com/cookbook/#gotchas). You may need to use a basic write(2).
[15:33] <xnox> thanks =)
[15:35] <jodh> xnox: just a sec - that test looks wrong - there is no call to waitpid() in the non-failure scenario.
[15:37] <jodh> xnox: we should wait for the pid, then delete the log file in dirname/<job>.log if job_process_spawn() did not fail.
[15:39] <xnox> jodh: I thought that the point of the test is that allocation_fails to succeed the test.
[15:41] <xnox> unless I got it utterly wrong.
[16:45] <jodh> xnox: http://upstart.ubuntu.com/cookbook/#test-alloc-fail is a bit of a 'mind bender', but the loop _will_ succeed once. And that is the problem iteration - there is a race.
[16:46] <jodh> xnox: so, I suspect if you waitpid() when test_alloc_failed is not set, you'll see the test fail on all systems since the rmdir will fail as by that time, the job has finished and written the log file in the directory the test is attempting to delete.
[16:46] <jodh> xnox: so, the correct fix I think is: waitpid(), then unlink the log file for the non-failure iteration.
[16:48] <xnox> jodh: ok. I understand your solution. Can you explain what the test is testing for in this case then?
[16:48] <jodh> xnox: you'll need to construct the name of the logfile using nih_local and nih_sprintf(). See examples in the code relating to the 'expected' variable.
[16:50] <jodh> xnox: well it's supposed to be testing that a simple job which produces output can be handled in all error scenarios. But it really could do with a bit of improvement.
[16:52] <jodh> xnox: namely, we should assert that on success, that the log file is written and the contents are correct.
[16:52] <xnox> jodh: ok. Thank you for the information, I will try to poke it.
[16:52] <jodh> xnox: so you could add a call to CHECK_FILE_EQ().
[16:53] <jodh> xnox: and feel free to add some more comments if you want ;-)
[16:53] <jodh> xnox: thanks