summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2006-07-08 19:55:09 +0200
committerSteve Peters <steve@fisharerojo.org>2006-07-08 17:28:36 +0000
commit60e845e31f280cc63150cb6d0bc570c60c750a0c (patch)
treeb0570f297993a5c5ff5025b6c17606af3d6d9ee7 /ext
parent56093a11cb59f21ab1aaab1c6cbb516a423086f9 (diff)
downloadperl-60e845e31f280cc63150cb6d0bc570c60c750a0c.tar.gz
Skip some POSIX tests when the thing they are testing is unimplemented
Message-ID: <9b18b3110607080855g73407c4fx41a578815c2a6da2@mail.gmail.com> p4raw-id: //depot/perl@28508
Diffstat (limited to 'ext')
-rw-r--r--ext/POSIX/t/sysconf.t21
-rw-r--r--ext/POSIX/t/termios.t10
2 files changed, 22 insertions, 9 deletions
diff --git a/ext/POSIX/t/sysconf.t b/ext/POSIX/t/sysconf.t
index 0790f47c53..15dd65e8c3 100644
--- a/ext/POSIX/t/sysconf.t
+++ b/ext/POSIX/t/sysconf.t
@@ -16,29 +16,36 @@ use File::Spec;
use POSIX;
use Scalar::Util qw(looks_like_number);
-my @path_consts = qw(
+sub check(@) {
+ grep { eval "&$_;1" or $@!~/vendor has not defined POSIX macro/ } @_
+}
+
+my @path_consts = check qw(
_PC_CHOWN_RESTRICTED _PC_LINK_MAX _PC_NAME_MAX
_PC_NO_TRUNC _PC_PATH_MAX
);
-my @path_consts_terminal = qw(
+my @path_consts_terminal = check qw(
_PC_MAX_CANON _PC_MAX_INPUT _PC_VDISABLE
);
-my @path_consts_fifo = qw(
+my @path_consts_fifo = check qw(
_PC_PIPE_BUF
);
-my @sys_consts = qw(
+my @sys_consts = check qw(
_SC_ARG_MAX _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL
_SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS
_SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION
);
-
-plan tests => 2 * 3 * @path_consts +
+my $tests=2 * 3 * @path_consts +
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")
+;
my $curdir = File::Spec->curdir;
@@ -83,7 +90,7 @@ SKIP: {
my $fifo = "fifo$$";
SKIP: {
- mkfifo($fifo, 0666)
+ eval { mkfifo($fifo, 0666) }
or skip("could not create fifo $fifo ($!)", 2 * 3 * @path_consts_fifo);
SKIP: {
diff --git a/ext/POSIX/t/termios.t b/ext/POSIX/t/termios.t
index ff04d207f6..2fbff9665a 100644
--- a/ext/POSIX/t/termios.t
+++ b/ext/POSIX/t/termios.t
@@ -8,11 +8,17 @@ BEGIN {
use Config;
use Test::More;
- plan skip_all => "POSIX is unavailable" if $Config{'extensions'} !~ m!\bPOSIX\b!;
+ plan skip_all => "POSIX is unavailable"
+ if $Config{'extensions'} !~ m!\bPOSIX\b!;
}
-
use strict;
use POSIX;
+BEGIN {
+ plan skip_all => "POSIX::Termios not implemented"
+ if !eval "POSIX::Termios->new;1"
+ and $@=~/not implemented/;
+}
+
my @getters = qw(getcflag getiflag getispeed getlflag getoflag getospeed);