summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-08-12 11:44:35 +0100
committerDavid Mitchell <davem@iabyn.com>2014-08-12 11:44:35 +0100
commit5a3240c189517e77b3402aa8998b5beee21045bd (patch)
tree35d84737b656b97839500452651026c81fa368f9 /t
parent2ebcba0a9f172787c2c75bb3480e865c6809c1f0 (diff)
downloadperl-5a3240c189517e77b3402aa8998b5beee21045bd.tar.gz
op/.stat.t: fix race condition
A test was checking that stat on FILEHANDLE and lstat on *FILEHANDLE{IO} gave the same results. It was using STDOUT as the filehandle, but since this can be modified by other processes during parallel testing, a race condition is possible. Open a file instead to get reliability.
Diffstat (limited to 't')
-rw-r--r--t/op/stat.t6
1 files changed, 4 insertions, 2 deletions
diff --git a/t/op/stat.t b/t/op/stat.t
index 2f34f6e0ab..027902df64 100644
--- a/t/op/stat.t
+++ b/t/op/stat.t
@@ -472,10 +472,12 @@ like $@, qr/^The stat preceding lstat\(\) wasn't an lstat at /,
'stat $ioref resets stat type';
{
- my @statbuf = stat STDOUT;
+ open(FOO, ">$tmpfile") || DIE("Can't open temp test file: $!");
+ my @statbuf = stat FOO;
stat "test.pl";
- my @lstatbuf = lstat *STDOUT{IO};
+ my @lstatbuf = lstat *FOO{IO};
is "@lstatbuf", "@statbuf", 'lstat $ioref reverts to regular fstat';
+ unlink $tmpfile or print "# unlink failed: $!\n";
}
SKIP: {