summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-19 07:34:29 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-19 07:34:29 +0000
commit2a4bf7730d252fcadf5e50c3a9c740b5c94acfe3 (patch)
tree9a7597178791661d866752380767b1406cb2c96a /t
parent17cab1b848e4960c008b73548ee8e62a9e9735ec (diff)
parent41d6edb2c1acac32a0296d594f0943752d23f077 (diff)
downloadperl-2a4bf7730d252fcadf5e50c3a9c740b5c94acfe3.tar.gz
integrate cfgperl contents into mainline
p4raw-id: //depot/perl@5822
Diffstat (limited to 't')
-rwxr-xr-xt/lib/ipc_sysv.t10
-rwxr-xr-xt/op/sysio.t2
-rwxr-xr-xt/op/taint.t81
3 files changed, 80 insertions, 13 deletions
diff --git a/t/lib/ipc_sysv.t b/t/lib/ipc_sysv.t
index e2ffd76ff1..a4f3e3f367 100755
--- a/t/lib/ipc_sysv.t
+++ b/t/lib/ipc_sysv.t
@@ -23,8 +23,7 @@ BEGIN {
# These constants are common to all tests.
# Later the sem* tests will import more for themselves.
-use IPC::SysV qw(IPC_PRIVATE IPC_NOWAIT IPC_STAT IPC_RMID
- S_IRWXU S_IRWXG S_IRWXO S_IWGRP S_IROTH S_IWOTH);
+use IPC::SysV qw(IPC_PRIVATE IPC_NOWAIT IPC_STAT IPC_RMID S_IRWXU);
use strict;
print "1..16\n";
@@ -55,12 +54,7 @@ EOM
exit(1);
};
-my $perm;
-
-$perm = S_IRWXU | S_IRWXG | S_IRWXO | S_IWGRP | S_IROTH | S_IWOTH
- if $^O eq 'vmesa';
-
-$perm = S_IRWXU | S_IRWXG | S_IRWXO unless defined $perm;
+my $perm = S_IRWXU;
if ($Config{'d_msgget'} eq 'define' &&
$Config{'d_msgctl'} eq 'define' &&
diff --git a/t/op/sysio.t b/t/op/sysio.t
index 22e60e30fc..e43f850154 100755
--- a/t/op/sysio.t
+++ b/t/op/sysio.t
@@ -2,7 +2,7 @@
print "1..39\n";
-chdir('op') || die "sysio.t: cannot look for myself: $!";
+chdir('op') || chdir('t/op') || die "sysio.t: cannot look for myself: $!";
open(I, 'sysio.t') || die "sysio.t: cannot find myself: $!";
diff --git a/t/op/taint.t b/t/op/taint.t
index 6a9537b057..c32a1c41fb 100755
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -94,7 +94,7 @@ print PROG 'print "@ARGV\n"', "\n";
close PROG;
my $echo = "$Invoke_Perl $ECHO";
-print "1..149\n";
+print "1..151\n";
# First, let's make sure that Perl is checking the dangerous
# environment variables. Maybe they aren't set yet, so we'll
@@ -547,14 +547,14 @@ else {
my @getpwent = getpwent();
die "getpwent: $!\n" unless (@getpwent);
test 142,( not tainted $getpwent[0]
- and not tainted $getpwent[1]
+ and tainted $getpwent[1]
and not tainted $getpwent[2]
and not tainted $getpwent[3]
and not tainted $getpwent[4]
and not tainted $getpwent[5]
- and tainted $getpwent[6] # gecos
+ and tainted $getpwent[6] # ge?cos
and not tainted $getpwent[7]
- and not tainted $getpwent[8]);
+ and tainted $getpwent[8]); # shell
endpwent();
} else {
for (142) { print "ok $_ # Skipped: getpwent() is not available\n" }
@@ -605,3 +605,76 @@ else {
$why =~ s/e/'-'.$$/ge;
test 149, tainted $why;
}
+
+# test shmread
+{
+ if ($Config{d_shm}) {
+ use IPC::SysV qw(IPC_PRIVATE IPC_RMID S_IRWXU S_IRWXG S_IRWXO);
+
+ my $sent = "foobar";
+ my $rcvd;
+ my $size = 2000;
+ my $id = shmget(IPC_PRIVATE, $size, S_IRWXU|S_IRWXG|S_IRWXO) ||
+ warn "# shmget failed: $!\n";
+ if (defined $id) {
+ if (shmwrite($id, $sent, 0, 60)) {
+ if (shmread($id, $rcvd, 0, 60)) {
+ substr($rcvd, index($rcvd, "\0")) = '';
+ } else {
+ warn "# shmread failed: $!\n";
+ }
+ } else {
+ warn "# shmwrite failed: $!\n";
+ }
+ shmctl($id, IPC_RMID, 0) || warn "# shmctl failed: $!\n";
+ } else {
+ warn "# shmget failed: $!\n";
+ }
+
+ if ($rcvd eq $sent) {
+ test 150, tainted $rcvd;
+ } else {
+ print "ok 150 # Skipped: SysV shared memory operation failed\n";
+ }
+ } else {
+ print "ok 150 # Skipped: SysV shared memory is not available\n";
+ }
+}
+
+# test msgrcv
+{
+ if ($Config{d_msg}) {
+ use IPC::SysV qw(IPC_PRIVATE IPC_RMID IPC_CREAT S_IRWXU);
+
+ my $id = msgget(IPC_PRIVATE, IPC_CREAT | S_IRWXU);
+
+ my $sent = "message";
+ my $type_sent = 1234;
+ my $rcvd;
+ my $type_rcvd;
+
+ if (defined $id) {
+ if (msgsnd($id, pack("l! a*", $type_sent, $sent), 0)) {
+ if (msgrcv($id, $rcvd, 60, 0, 0)) {
+ ($type_rcvd, $rcvd) = unpack("l! a*", $rcvd);
+ } else {
+ warn "# msgrcv failed\n";
+ }
+ } else {
+ warn "# msgsnd failed\n";
+ }
+ msgctl($id, IPC_RMID, 0) || warn "# msgctl failed: $!\n";
+ } else {
+ warn "# msgget failed\n";
+ }
+
+ if ($rcvd eq $sent && $type_sent == $type_rcvd) {
+ test 151, tainted $rcvd;
+ } else {
+ print "ok 151 # Skipped: SysV message queue operation failed\n";
+ }
+ } else {
+ print "ok 151 # Skipped: SysV message queues are not available\n";
+ }
+}
+