summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-03-09 17:16:03 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-03-09 17:16:03 +0000
commitab6cb6eb79f7ad4a85f8c8eac1bc05fcbeb1d4ed (patch)
treeee24bd4a8ca4e27bbaa7188ce333625b3f9c109f /t
parentf127762ae8ed5af83de18a858019907e3c7f32ea (diff)
parent0b6ed3a08547ebe2996c386f572b6ec40ddf91b9 (diff)
downloadperl-ab6cb6eb79f7ad4a85f8c8eac1bc05fcbeb1d4ed.tar.gz
Integrate mainline (does not build - sv_catpvf issue in dump.c)
p4raw-id: //depot/perlio@9093
Diffstat (limited to 't')
-rw-r--r--t/lib/sigaction.t126
-rwxr-xr-xt/op/pat.t2
-rwxr-xr-xt/op/split.t5
-rwxr-xr-xt/op/stat.t20
-rwxr-xr-xt/pragma/utf8.t5
5 files changed, 145 insertions, 13 deletions
diff --git a/t/lib/sigaction.t b/t/lib/sigaction.t
new file mode 100644
index 0000000000..cb3380b119
--- /dev/null
+++ b/t/lib/sigaction.t
@@ -0,0 +1,126 @@
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
+}
+
+BEGIN{
+ # Don't do anything if POSIX is missing, or sigaction missing.
+ eval { use POSIX; };
+ if($@ || $^O eq 'MSWin32') {
+ print "1..0\n";
+ exit 0;
+ }
+}
+
+use strict;
+use vars qw/$bad7 $ok10 $bad18 $ok/;
+
+$^W=1;
+
+print "1..18\n";
+
+sub IGNORE {
+ $bad7=1;
+}
+
+sub DEFAULT {
+ $bad18=1;
+}
+
+sub foo {
+ $ok=1;
+}
+
+my $newaction=POSIX::SigAction->new('::foo', new POSIX::SigSet(SIGUSR1), 0);
+my $oldaction=POSIX::SigAction->new('::bar', new POSIX::SigSet(), 0);
+
+{
+ my $bad;
+ local($SIG{__WARN__})=sub { $bad=1; };
+ sigaction(SIGHUP, $newaction, $oldaction);
+ if($bad) { print "not ok 1\n" } else { print "ok 1\n"}
+}
+
+if($oldaction->{HANDLER} eq 'DEFAULT')
+ { print "ok 2\n" } else { print "not ok 2\n"}
+print $SIG{HUP} eq '::foo' ? "ok 3\n" : "not ok 3\n";
+
+sigaction(SIGHUP, $newaction, $oldaction);
+if($oldaction->{HANDLER} eq '::foo')
+ { print "ok 4\n" } else { print "not ok 4\n"}
+if($oldaction->{MASK}->ismember(SIGUSR1))
+ { print "ok 5\n" } else { print "not ok 5\n"}
+if($oldaction->{FLAGS}) {
+ if ($^O eq 'linux') {
+ print "ok 6 # Skip: sigaction() broken in $^O\n";
+ } else {
+ print "not ok 6\n";
+ }
+} else {
+ print "ok 6\n";
+}
+
+$newaction=POSIX::SigAction->new('IGNORE');
+sigaction(SIGHUP, $newaction);
+kill 'HUP', $$;
+print $bad7 ? "not ok 7\n" : "ok 7\n";
+
+print $SIG{HUP} eq 'IGNORE' ? "ok 8\n" : "not ok 8\n";
+sigaction(SIGHUP, POSIX::SigAction->new('DEFAULT'));
+print $SIG{HUP} eq 'DEFAULT' ? "ok 9\n" : "not ok 9\n";
+
+$newaction=POSIX::SigAction->new(sub { $ok10=1; });
+sigaction(SIGHUP, $newaction);
+{
+ local($^W)=0;
+ kill 'HUP', $$;
+}
+print $ok10 ? "ok 10\n" : "not ok 10\n";
+
+print ref($SIG{HUP}) eq 'CODE' ? "ok 11\n" : "not ok 11\n";
+
+sigaction(SIGHUP, POSIX::SigAction->new('::foo'));
+# Make sure the signal mask gets restored after sigaction croak()s.
+eval {
+ my $act=POSIX::SigAction->new('::foo');
+ delete $act->{HANDLER};
+ sigaction(SIGINT, $act);
+};
+kill 'HUP', $$;
+print $ok ? "ok 12\n" : "not ok 12\n";
+
+undef $ok;
+# Make sure the signal mask gets restored after sigaction returns early.
+my $x=defined sigaction(SIGKILL, $newaction, $oldaction);
+kill 'HUP', $$;
+print !$x && $ok ? "ok 13\n" : "not ok 13\n";
+
+$SIG{HUP}=sub {};
+sigaction(SIGHUP, $newaction, $oldaction);
+print ref($oldaction->{HANDLER}) eq 'CODE' ? "ok 14\n" : "not ok 14\n";
+
+eval {
+ sigaction(SIGHUP, undef, $oldaction);
+};
+print $@ ? "not ok 15\n" : "ok 15\n";
+
+eval {
+ sigaction(SIGHUP, 0, $oldaction);
+};
+print $@ ? "not ok 16\n" : "ok 16\n";
+
+eval {
+ sigaction(SIGHUP, bless({},'Class'), $oldaction);
+};
+print $@ ? "ok 17\n" : "not ok 17\n";
+
+$newaction=POSIX::SigAction->new(sub { $ok10=1; });
+sigaction(SIGCONT, POSIX::SigAction->new('DEFAULT'));
+{
+ local($^W)=0;
+ kill 'CONT', $$;
+}
+print $bad18 ? "not ok 18\n" : "ok 18\n";
+
diff --git a/t/op/pat.t b/t/op/pat.t
index 711f9f08e9..2d862732fe 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -1533,5 +1533,7 @@ print "ok 247\n";
print "not " unless $1 eq "\x{200}\x{300}" && length($1) == 2;
print "ok 580\n";
+ } else {
+ for (576..580) { print "not ok $_\n" }
}
}
diff --git a/t/op/split.t b/t/op/split.t
index ce8d64d947..3077909c92 100755
--- a/t/op/split.t
+++ b/t/op/split.t
@@ -1,5 +1,10 @@
#!./perl
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
print "1..44\n";
$FS = ':';
diff --git a/t/op/stat.t b/t/op/stat.t
index 1317ba8e7c..1d8c7a36eb 100755
--- a/t/op/stat.t
+++ b/t/op/stat.t
@@ -178,14 +178,18 @@ if ($^O eq 'mpeix' or $^O eq 'amigaos' or $Is_Dosish or $Is_Cygwin) {
$cnt = $uid = 0;
die "Can't run op/stat.t test 35 without pwd working" unless $cwd;
-($bin) = grep {-d} ($^O eq 'machten' ? qw(/usr/bin /bin) : qw(/bin /usr/bin))
- or print ("not ok 35\n"), goto tty_test;
-opendir BIN, $bin or die "Can't opendir $bin: $!";
-while (defined($_ = readdir BIN)) {
- $_ = "$bin/$_";
- $cnt++;
- $uid++ if -u;
- last if $uid && $uid < $cnt;
+my @bin = grep {-d} ($^O eq 'machten' ?
+ qw(/usr/bin /bin) :
+ qw(/sbin /usr/sbin /bin /usr/bin));
+unless (@bin) { print ("not ok 35\n"), goto tty_test; }
+for my $bin (@bin) {
+ opendir BIN, $bin or die "Can't opendir $bin: $!";
+ while (defined($_ = readdir BIN)) {
+ $_ = "$bin/$_";
+ $cnt++;
+ $uid++ if -u;
+ last if $uid && $uid < $cnt;
+ }
}
closedir BIN;
diff --git a/t/pragma/utf8.t b/t/pragma/utf8.t
index 31d119137a..850470e0e8 100755
--- a/t/pragma/utf8.t
+++ b/t/pragma/utf8.t
@@ -3,11 +3,6 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
- $ENV{PERL5LIB} = '../lib';
- if ( ord("\t") != 9 ) { # skip on ebcdic platforms
- print "1..0 # Skip utf8 tests on ebcdic platform.\n";
- exit;
- }
}
# NOTE!