summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/run_test.txt87
1 files changed, 57 insertions, 30 deletions
diff --git a/docs/run_test.txt b/docs/run_test.txt
index 561657c7f94..9889a9222e3 100644
--- a/docs/run_test.txt
+++ b/docs/run_test.txt
@@ -24,33 +24,40 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
use lib '../../../bin';
use PerlACE::Run_Test;
-use Cwd;
+
+$status = 0;
$server_ior = PerlACE::LocalFile ("server.ior");
unlink $server_ior;
$SV = new PerlACE::Process ("server", "-o $server_ior");
+$CL = new PerlACE::Process ("client", "-k file://$server_ior");
$SV->Spawn ();
if (PerlACE::waitforfile_timed ($server_ior, 5) == -1) {
print STDERR "ERROR: cannot find file <$server_ior>\n";
- $SV->Kill (); $SV->TimedWait (1);
+ $SV->Kill ();
exit 1;
}
-$CL = new PerlACE::Process ("client", " -k file://$server_ior ");
-
$client = $CL->SpawnWaitKill (60);
-$server = $SV->WaitKill (5);
-unlink $server_ior;
-
-if ($server != 0 || $client != 0) {
- exit 1;
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+}
+
+$server = $SV->TerminateWaitKill (5);
+
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1;
}
-exit 0;
+unlink $server_ior;
+
+exit $status;
@endverbatim
@subsection details Example Details
@@ -83,7 +90,7 @@ line arguments (like -Config and -ExeSubDir) and also brings in
the PerlACE::Process module.
@verbatim
-use Cwd;
+$status = 0;
$server_ior = PerlACE::LocalFile ("server.ior");
@@ -96,50 +103,70 @@ immediately because we use PerlACE::waitforfile_timed later.
@verbatim
$SV = new PerlACE::Process ("server", "-o $server_ior");
+$CL = new PerlACE::Process ("client", " -k file://$server_ior ");
$SV->Spawn ();
@endverbatim
The PerlACE::Process is constructed with an executable and
arguments. @note Unlike the old Process module, the process
-isn't started until one of the Spawn's is called.
+isn't started until one of the Spawn methods is used.
@verbatim
if (PerlACE::waitforfile_timed ($server_ior, 5) == -1) {
print STDERR "ERROR: cannot find file <$server_ior>\n";
- $SV->Kill (); $SV->TimedWait (1);
+ $SV->Kill ();
exit 1;
}
@endverbatim
The PerlACE::waitforfile_timed method waits until the file is
-created. In this way, we know when to start the client.
+created. In this way, we know when to start the client. If
+no IOR file is used, then you'd need to use Perl's sleep
+method.
@verbatim
-$CL = new PerlACE::Process ("client", " -k file://$server_ior ");
-
$client = $CL->SpawnWaitKill (60);
-$server = $SV->WaitKill (5);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+}
@endverbatim
-Here are two more methods on the PerlACE::Process object.
-SpawnWaitKill will start the process and wait for the specified
-number of seconds for the process to end. If the time limit
-is reached, it will kill the process. WaitKill will do the same,
-but is used after the process is already spawned.
+Here is an example of starting the client. SpawnWaitKill will start
+the process and wait for the specified number of seconds for the
+process to end. If the time limit is reached, it will kill the
+process and return -1.
+
+The return value of SpawnWaitKill is the return value of the
+process, unless it timed out. You don't need to check for the
+timeout, since SpawnWaitKill will print out a timeout error.
+Instead, just check for != 0.
@verbatim
-unlink $server_ior;
-
-if ($server != 0 || $client != 0) {
- exit 1;
+$server = $SV->TerminateWaitKill (5);
+
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1;
}
+@endverbatim
+
+Here is the termination of the server. Servers are usually terminated
+either by TerminateWaitKill or just WaitKill. TerminateWaitKill is
+used when the server doesn't shut down itself. WaitKill is used when
+it does (such as when the client calls a shutdown method). Once
+again, we check the return status.
+
+
+@verbatim
+unlink $server_ior;
-exit 0;
+exit $status;
@endverbatim
-And finally, we just check the return codes of the server and
-client and return 1 from this perl script if they aren't 0.
+And finally, we unlink any files that were created and then just
+exit with $status.
-This return code is used by the auto_run_tests.pl script.
*/ \ No newline at end of file