summaryrefslogtreecommitdiff
path: root/TAO/tests/Faults/run_test.pl
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tests/Faults/run_test.pl')
-rwxr-xr-xTAO/tests/Faults/run_test.pl237
1 files changed, 104 insertions, 133 deletions
diff --git a/TAO/tests/Faults/run_test.pl b/TAO/tests/Faults/run_test.pl
index b5af007f907..bb2b1df1e61 100755
--- a/TAO/tests/Faults/run_test.pl
+++ b/TAO/tests/Faults/run_test.pl
@@ -5,214 +5,185 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
# $Id$
# -*- perl -*-
-unshift @INC, '../../../bin';
-require ACEutils;
-use Cwd;
-
-$cwd = getcwd();
-$iorfile = "$cwd$DIR_SEPARATOR" . "test.ior";
-$middlefile = "$cwd$DIR_SEPARATOR" . "middle.ior";
-$dum_core = "$cwd$DIR_SEPARATOR" . "core";
+use lib '../../../bin';
+use PerlACE::Run_Test;
+
+$iorfile = PerlACE::LocalFile ("test.ior");
+$middlefile = PerlACE::LocalFile ("middle.ior");
+$dum_core = PerlACE::LocalFile ("core");
$status = 0;
-ACE::checkForTarget($cwd);
+$SV = new PerlACE::Process ("server", "-o $iorfile");
+$CL = new PerlACE::Process ("client", "");
+$MD = new PerlACE::Process ("middle", "-o $middlefile -k file://$iorfile");
+$PI = new PerlACE::Process ("ping", "-o $iorfile");
+$PO = new PerlACE::Process ("pong", "-k file://$iorfile -p 100 -i 60 -t 30");
+###############################################################################
print STDERR "===== Base test, no crashes\n";
+
unlink $iorfile;
-$SV = Process::Create ($EXEPREFIX."server$EXE_EXT ",
- " -o $iorfile");
+$SV->Spawn ();
-if (ACE::waitforfile_timed ($iorfile, 15) == -1) {
- print STDERR "ERROR: cannot find file <$iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
+if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill ();
+ exit 1;
}
-$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
- " -k file://$iorfile"
- . " -i 100");
+$CL->Arguments ("-k file://$iorfile -i 100");
-$client = $CL->TimedWait (20);
-if ($client == -1) {
- print STDERR "ERROR: client timedout\n";
- $CL->Kill (); $CL->TimedWait (1);
- $status = 1;
+$client = $CL->SpawnWaitKill (20);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
}
+###############################################################################
print STDERR "===== Client crash (abort) during upcall\n";
-$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
- " -k file://$iorfile"
- . " -i 100 -s");
+$CL->Arguments ("-k file://$iorfile -i 100 -s");
+
+$client = $CL->SpawnWaitKill (20);
-$client = $CL->TimedWait (20);
+# since the client crashes, skip check for $client != 0
if ($client == -1) {
- print STDERR "ERROR: client (-s) timedout\n";
- $CL->Kill (); $CL->TimedWait (1);
- $status = 1;
+ $status = 1;
}
+###############################################################################
print STDERR "===== Client crash during upcall\n";
-$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
- " -k file://$iorfile"
- . " -i 100 -z");
+$CL->Arguments ("-k file://$iorfile -i 100 -z");
+
+$client = $CL->SpawnWaitKill (20);
-$client = $CL->TimedWait (20);
+# since the client crashes, skip check for $client != 0
if ($client == -1) {
- print STDERR "ERROR: client (-z) timedout\n";
- $CL->Kill (); $CL->TimedWait (1);
- $status = 1;
+ $status = 1;
}
+###############################################################################
print STDERR "===== Server crash (abort) during upcall\n";
-$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
- " -k file://$iorfile"
- . " -i 100 -a");
+$CL->Arguments ("-k file://$iorfile -i 100 -a");
-$client = $CL->TimedWait (20);
-if ($client == -1) {
- print STDERR "ERROR: client (-a) timedout\n";
- $CL->Kill (); $CL->TimedWait (1);
- $status = 1;
+$client = $CL->SpawnWaitKill (20);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
}
-$server = $SV->TimedWait (20);
+$server = $SV->WaitKill (20);
+
+# since the server crashes, skip check for $server != 0
if ($server == -1) {
- print STDERR "ERROR: server (-a) timedout\n";
- $SV->Kill (); $SV->TimedWait (1);
- $status = 1;
+ $status = 1;
}
+###############################################################################
print STDERR "===== Server crash during upcall\n";
unlink $iorfile;
-$SV = Process::Create ($EXEPREFIX."server$EXE_EXT ",
- " -o $iorfile");
+$SV->Spawn ();
-if (ACE::waitforfile_timed ($iorfile, 15) == -1) {
- print STDERR "ERROR: cannot find file <$iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
+if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill ();
+ exit 1;
}
-$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
- " -k file://$iorfile"
- . " -i 100 -c");
+$CL->Arguments ("-k file://$iorfile -i 100 -c");
-$client = $CL->TimedWait (20);
-if ($client == -1) {
- print STDERR "ERROR: client (-c) timedout\n";
- $CL->Kill (); $CL->TimedWait (1);
- $status = 1;
+$client = $CL->SpawnWaitKill (20);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
}
-$server = $SV->TimedWait (20);
+$server = $SV->WaitKill (20);
+
+# since the server crashes, skip check for $server != 0
if ($server == -1) {
- print STDERR "ERROR: server (-c) timedout\n";
- $SV->Kill (); $SV->TimedWait (1);
- $status = 1;
+ $status = 1;
}
+###############################################################################
print STDERR "===== Three-way test, client crashes and server detects\n";
unlink $iorfile;
-$SV = Process::Create ($EXEPREFIX."server$EXE_EXT ",
- " -o $iorfile");
+$SV->Spawn ();
-if (ACE::waitforfile_timed ($iorfile, 15) == -1) {
- print STDERR "ERROR: cannot find file <$iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
-}
-
-if (ACE::waitforfile_timed ($iorfile, 15) == -1) {
- print STDERR "ERROR: cannot find file <$iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
+if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill ();
+ exit 1;
}
unlink $middlefile;
-$MD = Process::Create ($EXEPREFIX."middle$EXE_EXT ",
- " -o $middlefile -k file://$iorfile");
+$MD->Spawn ();
-if (ACE::waitforfile_timed ($middlefile, 15) == -1) {
- print STDERR "ERROR: cannot find file <$middlefile>\n";
- $MD->Kill (); $MD->TimedWait (1);
- exit 1;
+if (PerlACE::waitforfile_timed ($middlefile, 15) == -1) {
+ print STDERR "ERROR: cannot find file <$middlefile>\n";
+ $MD->Kill ();
+ exit 1;
}
-$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
- " -k file://$middlefile"
- . " -i 100 -s");
+$CL->Arguments ("-k file://$middlefile -i 100 -s");
-$client = $CL->TimedWait (100);
-if ($client == -1) {
- print STDERR "ERROR: client (middle/-s) timedout\n";
- $CL->Kill (); $CL->TimedWait (1);
- $status = 1;
+$client = $CL->SpawnWaitKill (100);
+
+# since the client crashes, skip check for $client != 0
+if ($client != -1) {
+ $status = 1;
}
-$CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
- " -k file://$middlefile"
- . " -i 10 -x");
+$CL->Arguments (" -k file://$middlefile -i 10 -x");
+
+$client = $CL->SpawnWaitKill (100);
-$client = $CL->TimedWait (100);
+# since the client crashes, skip check for $client != 0
if ($client == -1) {
- print STDERR "ERROR: client (middle/-x) timedout\n";
- $CL->Kill (); $CL->TimedWait (1);
- $status = 1;
+ $status = 1;
}
-$server = $SV->TimedWait (20);
-if ($server == -1) {
- print STDERR "ERROR: server (middle/-x) timedout\n";
- $SV->Kill (); $SV->TimedWait (1);
- $status = 1;
-}
+$server = $SV->WaitKill (20);
-$middle = $MD->TimedWait (20);
-if ($middle == -1) {
- print STDERR "ERROR: middle (-x) timedout\n";
- $MD->Kill (); $MD->TimedWait (1);
- $status = 1;
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1;
}
+$middle = $MD->WaitKill (20);
+
if ($middle != 0) {
- print STDERR "ERROR: the middle test failed\n";
- $status = 1;
+ print STDERR "ERROR: the middle test failed, middle returned $middle\n";
+ $status = 1;
}
+###############################################################################
print STDERR "===== Ping-pong test, server crashes but client continues\n";
unlink $iorfile;
-$SV = Process::Create ($EXEPREFIX."ping$EXE_EXT ",
- " -o $iorfile");
+$PI->Spawn ();
-if (ACE::waitforfile_timed ($iorfile, 15) == -1) {
- print STDERR "ERROR: cannot find file <$iorfile>\n";
- $SV->Kill (); $SV->TimedWait (1);
- exit 1;
+if (PerlACE::waitforfile_timed ($iorfile, 15) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill ();
+ exit 1;
}
-$CL = Process::Create ($EXEPREFIX."pong$EXE_EXT ",
- " -k file://$iorfile"
- . " -p 100 -i 60 -t 30");
-
-$client = $CL->TimedWait (60);
-if ($client == -1) {
- print STDERR "ERROR: pong timedout\n";
- $CL->Kill (); $CL->TimedWait (1);
- $status = 1;
+if ($PO->SpawnWaitKill (60) == -1) {
+ $status = 1;
}
-$server = $SV->TimedWait (60);
-if ($server == -1) {
- print STDERR "ERROR: ping timedout\n";
- $SV->Kill (); $SV->TimedWait (1);
- $status = 1;
+if ($PI->WaitKill (60) == -1) {
+ $status = 1;
}
+
unlink $dum_core;
exit $status;