From: Jarkko Hietaniemi Date: Tue, 11 Jul 2006 09:23:08 +0000 (+0300) Subject: sysconf.t: still failing in tru64, try harder to skip X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c6f5816709fd060d06981ce18c7569805a56bf50;p=p5sagit%2Fp5-mst-13.2.git sysconf.t: still failing in tru64, try harder to skip Message-Id: <200607110623.k6B6N8Ni488812@kosh.hut.fi> p4raw-id: //depot/perl@28540 --- diff --git a/ext/POSIX/t/sysconf.t b/ext/POSIX/t/sysconf.t index 1fa2eb1..2c1d2c9 100644 --- a/ext/POSIX/t/sysconf.t +++ b/ext/POSIX/t/sysconf.t @@ -38,10 +38,11 @@ my @sys_consts = check qw( _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION ); -my $tests=2 * 3 * @path_consts + - 3 * @path_consts_terminal + - 2 * 3 * @path_consts_fifo + - 3 * @sys_consts; + +my $tests = 2 * 3 * @path_consts + + 2 * 3 * @path_consts_terminal + + 2 * 3 * @path_consts_fifo + + 3 * @sys_consts; plan $tests ? (tests => $tests) : (skip_all => "No tests to run on this OS") @@ -75,13 +76,32 @@ for my $constant (@path_consts) { } SKIP: { - -c "/dev/tty" - or skip("/dev/tty not a character file", 3 * @path_consts_terminal); + my $TTY = "/dev/tty"; + + my $n = 2 * 3 * @path_consts_terminal; + + -c $TTY + or skip("$TTY not a character file", $n); + open(TTY, $TTY) + or skip("failed to open $TTY: $!", $n); + -t TTY + or skip("TTY ($TTY) not a terminal file", $n); + my $fd = fileno(TTY); + + # testing fpathconf() on a terminal file + for my $constant (@path_consts_terminal) { + $r = eval { fpathconf( $fd, eval "$constant()" ) }; + is( $@, '', qq[calling fpathconf($fd, $constant) ($TTY)] ); + ok( defined $r, "\tchecking that the returned value is defined: $r" ); + ok( looks_like_number($r), "\tchecking that the returned value looks like a number" ); + } + + close($fd); # testing pathconf() on a terminal file for my $constant (@path_consts_terminal) { - $r = eval { pathconf( "/dev/tty", eval "$constant()" ) }; - is( $@, '', qq[calling pathconf("/dev/tty", $constant)] ); + $r = eval { pathconf( $TTY, eval "$constant()" ) }; + is( $@, '', qq[calling pathconf($TTY, $constant)] ); ok( defined $r, "\tchecking that the returned value is defined: $r" ); ok( looks_like_number($r), "\tchecking that the returned value looks like a number" ); } @@ -99,7 +119,7 @@ SKIP: { for my $constant (@path_consts_fifo) { $r = eval { fpathconf( $fd, eval "$constant()" ) }; - is( $@, '', "calling fpathconf($fd, $constant) " ); + is( $@, '', "calling fpathconf($fd, $constant) ($fifo)" ); ok( defined $r, "\tchecking that the returned value is defined: $r" ); ok( looks_like_number($r), "\tchecking that the returned value looks like a number" ); } @@ -118,7 +138,9 @@ SKIP: { } } -unlink($fifo); +END { + 1 while unlink($fifo); +} # testing sysconf() for my $constant (@sys_consts) {