This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PATCH -- POD error in Symbol.pm
[perl5.git] / lib / Shell.t
index c7c45d3..13bba22 100644 (file)
@@ -1,8 +1,10 @@
 #!./perl
 
 BEGIN {
-    chdir 't' if -d 't';
-    @INC = '../lib';
+    if( $ENV{PERL_CORE} ) {
+        chdir 't' if -d 't';
+        @INC = '../lib';
+    }
 }
 
 use Test::More tests => 7;
@@ -26,17 +28,27 @@ while ( -f $tmpfile ) {
 }
 END { -f $tmpfile && (open STDERR, '>&SAVERR' and unlink $tmpfile) }
 
+no warnings 'once'; 
+# no false warning about   Name "main::SAVERR" used only once: possible typo
 
 open(SAVERR, ">&STDERR");
 open(STDERR, ">$tmpfile");
 
-xXx();  # Ok someone could have a program called this :(
+xXx_not_there();  # Ok someone could have a program called this :(
 
 # On os2 the warning is on by default...
 ok(($^O eq 'os2' xor !(-s $tmpfile)), '$Shell::capture_stderr');
 
 $Shell::capture_stderr = 0;
 
+# Trying to do two repeated C<ls>s in t in core and expecting the same output
+# is a race condition when tests are running in parallel, and using it as a
+# temporary directory. So go somewhere quieter.
+if ($ENV{PERL_CORE} && -d 'uni') {
+  chdir 'uni';
+  $chdir++;
+}
+
 # someone will have to fill in the blanks for other platforms
 
 if ($Is_VMS) {
@@ -66,3 +78,7 @@ if ($Is_VMS) {
 
 }
 open(STDERR, ">&SAVERR") ;
+
+if ($chdir) {
+  chdir "..";
+}