Subject: | t/04_changed.t may fail in rare situations |
One of my smokers reported the following test failure:
...
# Failed test 'changed() in list context.'
# at t/04_changed.t line 31.
# Looks like you failed 1 test of 6.
t/04_changed.t ..........
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/6 subtests
...
However, it was not possible to reproduce the problem repeating the test case a couple of times.
Also problematic is that there's no diagnostics if this failure happens. It looks like @changed has different content as expected. Probably it's better to write this test
ok( eq_set(\@changed, [qw( digest size )]), "changed() in list context." )
or diag explain \@changed;
or so.
Just one idea: maybe the clock switched a second between initial read of the file and the subsequent write. Indeed, a test failure is always reproducible by adding a "sleep 2" before the "print F 'foo'" line, with an additional unexpected "mtime" change. So probably it would be a good idea to accept also a change in "mtime" here.