From: Ilya Zakharevich Date: Sun, 4 Feb 1996 21:38:11 +0000 (-0500) Subject: Patches for test suit for better portability X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b8440792c4a62245d0033c065af6c1ecb58e6474;p=p5sagit%2Fp5-mst-13.2.git Patches for test suit for better portability This does not change actual tests, but improves support code such that an early bail out does not happen if environment is not Unixish. --- diff --git a/t/io/argv.t b/t/io/argv.t index cee43fc..40ed23b 100755 --- a/t/io/argv.t +++ b/t/io/argv.t @@ -33,4 +33,4 @@ if ($y eq "1a line\n2a line\n3a line\n") else {print "not ok 5\n";} -`/bin/rm -f Io.argv.tmp`; +`/bin/rm -f Io.argv.tmp` if -x '/bin/rm'; diff --git a/t/io/fs.t b/t/io/fs.t index 9eaf1da..a219b81 100755 --- a/t/io/fs.t +++ b/t/io/fs.t @@ -9,7 +9,7 @@ chop($wd); `rm -f tmp 2>/dev/null; mkdir tmp 2>/dev/null`; chdir './tmp'; -`/bin/rm -rf a b c x`; +`/bin/rm -rf a b c x` if -x '/bin/rm'; umask(022); @@ -19,9 +19,9 @@ close(fh); open(fh,'>a') || die "Can't create a"; close(fh); -if (link('a','b')) {print "ok 2\n";} else {print "not ok 2\n";} +if (eval {link('a','b')}) {print "ok 2\n";} else {print "not ok 2\n";} -if (link('b','c')) {print "ok 3\n";} else {print "not ok 3\n";} +if (eval {link('b','c')}) {print "ok 3\n";} else {print "not ok 3\n";} ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime, $blksize,$blocks) = stat('c'); diff --git a/t/op/pack.t b/t/op/pack.t index 859d48f..1cfcd60 100755 --- a/t/op/pack.t +++ b/t/op/pack.t @@ -33,7 +33,8 @@ print +($x = unpack("%32B69", "\001\002\004\010\020\040\100\200\017")) == 9 print +($x = unpack("%32B*", "Now is the time for all good blurfl")) == 129 ? "ok 7\n" : "not ok 7 $x\n"; -open(BIN, "./perl") || die "Can't open ../perl: $!\n"; +open(BIN, "./perl") || open(BIN, "./perl.exe") + || die "Can't open ../perl or ../perl.exe: $!\n"; sysread BIN, $foo, 8192; close BIN; diff --git a/t/op/stat.t b/t/op/stat.t index cfaf043..bace330 100755 --- a/t/op/stat.t +++ b/t/op/stat.t @@ -115,6 +115,7 @@ if (! -b '.') {print "ok 34\n";} else {print "not ok 34\n";} $cnt = $uid = 0; die "Can't run op/stat.t test 35 without pwd working" unless $cwd; +print ("not ok 35\n"), goto tty_test unless -d '/usr/bin'; chdir '/usr/bin' || die "Can't cd to /usr/bin"; while (defined($_ = <*>)) { $cnt++; @@ -127,7 +128,9 @@ chdir $cwd || die "Can't cd back to $cwd"; if ($uid > 0 && $uid < $cnt) {print "ok 35\n";} else - {print "not ok 35 ($uid $cnt)\n";} + {print "not ok 35 \n# ($uid $cnt)\n";} + +tty_test: unless (open(tty,"/dev/tty")) { print STDERR "Can't open /dev/tty--run t/TEST outside of make.\n"; @@ -146,8 +149,8 @@ if (-t) {print "ok 40\n";} else {print "not ok 40\n";} if (-T 'op/stat.t') {print "ok 41\n";} else {print "not ok 41\n";} if (! -B 'op/stat.t') {print "ok 42\n";} else {print "not ok 42\n";} -if (-B './perl') {print "ok 43\n";} else {print "not ok 43\n";} -if (! -T './perl') {print "ok 44\n";} else {print "not ok 44\n";} +if (-B './perl' || -B './perl.exe') {print "ok 43\n";} else {print "not ok 43\n";} +if (! -T './perl' && ! -T './perl.exe') {print "ok 44\n";} else {print "not ok 44\n";} open(FOO,'op/stat.t'); eval { -T FOO; };