Subject: | Test Improvement: File::Temp |
Date: | Tue, 11 Dec 2007 13:23:06 +0000 |
To: | bug-Path-Class [...] rt.cpan.org |
From: | Alex Page <alexp [...] transitive.com> |
With Path::Class 0.16, the tests in t/03-filesystem.t include one which
uses $file->stat and checks the modification date. $file has been
created in the test directory for the build.
When this build directory is on another machine (in my example, because
$HOME is NFS-mounted), it's possible for there to be a >20 second
discrepancy between the modification time recorded by the fileserver and
retrieved by stat, and the time the build system thinks it modified the
file.
There are two possible solutions to this. The first is to create the
file, wait for some number of seconds, touch it and then stat it. The
test could check the difference between the created and modified times
returned by $file->stat.
The other would be to create the file in the system's temporary file
directory (using File::Temp?). This is much more likely to be local to
the system than the build directory.
Of course, the third solution is to actually get the clocks in sync
between the fileserver and build system, which was my eventual
workaround. But not everybody will have that option, so reducing the
false negative rate of this test would be good :)
Alex
--
Alex Page, Release Engineer, Transitive Limited
Maybrook House, 40 Blackfriars Street, Manchester M3 2EG, UK
Web: http://www.transitive.com/ | Phone: (+44) 161-214-0406