summaryrefslogtreecommitdiff
path: root/ACE/docs
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2008-11-17 13:34:37 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2008-11-17 13:34:37 +0000
commitdaba16ca9aa81905a22c662ddc8b461e6df61fe4 (patch)
tree300faeeb1918d7f98e56d6488b499f2189506ad9 /ACE/docs
parent2154e0c8d3bb60f7a8a9379651731355cd9443ca (diff)
downloadATCD-daba16ca9aa81905a22c662ddc8b461e6df61fe4.tar.gz
Mon Nov 17 13:34:30 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'ACE/docs')
-rw-r--r--ACE/docs/run_test.txt154
1 files changed, 95 insertions, 59 deletions
diff --git a/ACE/docs/run_test.txt b/ACE/docs/run_test.txt
index 5f77a734921..c02da95ab27 100644
--- a/ACE/docs/run_test.txt
+++ b/ACE/docs/run_test.txt
@@ -11,6 +11,8 @@ sure the run_test.pl works on all platforms
- The run_test should return a non-zero value if the test failed
- When an executable can't be spawned the test should directly exit and
not wait for a fail to be created by that executable
+- The processes should suppor that files names are passed through
+ the commandline
Following is an example
@@ -25,53 +27,70 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
# -*- perl -*-
use lib "$ENV{ACE_ROOT}/bin";
-use PerlACE::Run_Test;
+use PerlACE::TestTarget;
$status = 0;
+my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
$plain_server_ior = "server.ior";
-$server_ior = PerlACE::LocalFile ("$plain_server_ior");
-unlink $server_ior;
+my $iorbase = "server.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
-if (PerlACE::is_vxworks_test()) {
- $SV = new PerlACE::ProcessVX ("server", "-o $plain_server_ior");
-}
-else {
- $SV = new PerlACE::Process ("server", "-o $server_ior_file");
-}
+$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
+$CL = $client->CreateProcess ("client", "-k file://$client_iorfile");
-$CL = new PerlACE::Process ("client", "-k file://$server_ior");
+$server_status = $SV->Spawn ();
-$server = $SV->Spawn ();
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ exit 1;
+}
-if ($server != 0) {
- print STDERR "ERROR: server returned $server\n";
- $status = 1;
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
}
-if (PerlACE::waitforfile_timed ($server_ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$server_ior>\n";
- $SV->Kill ();
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
exit 1;
}
-$client = $CL->SpawnWaitKill (60);
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
-if ($client != 0) {
- print STDERR "ERROR: client returned $client\n";
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
$status = 1;
}
-$server = $SV->TerminateWaitKill (5);
+$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
-if ($server != 0) {
- print STDERR "ERROR: server returned $server\n";
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
$status = 1;
}
-unlink $server_ior;
+$server->GetStderrLog();
+$client->GetStderrLog();
+
+$server->DeleteFile($server_iorfile);
+$client->DeleteFile($client_iorfile);
exit $status;
+
@endverbatim
@subsection details Example Details
@@ -92,7 +111,7 @@ The SVN ID string is the usual one we put in.
@verbatim
use lib "$ENV{ACE_ROOT}/bin";
-use PerlACE::Run_Test;
+use PerlACE::TestTarget;
@endverbatim
The use lib line is used to tell Perl where the PerlACE modules are.
@@ -109,69 +128,82 @@ line arguments (like -Config and -ExeSubDir) and also brings in
the PerlACE::Process module.
@verbatim
-$status = 0;
+my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+@endverbatim
-$server_ior = PerlACE::LocalFile ("server.ior");
+We need to have two targets to run the tst on
-unlink $server_ior;
+@verbatim
+my $iorbase = "server.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($iorbase);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($iorbase);
@endverbatim
Because of the way tests work on chorus, we need to have a fully
qualified path to all *.ior and *.conf files. We unlink the file
-immediately because we use PerlACE::waitforfile_timed later.
+immediately because we use WaitForFileTimed later.
@verbatim
-if (PerlACE::is_vxworks_test()) {
- $SV = new PerlACE::ProcessVX ("server", "-o $plain_server_ior");
-}
-else {
- $SV = new PerlACE::Process ("server", "-o $server_ior_file");
-}
+$SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
@endverbatim
-We check using PerlACE::is_vxworks_test() if we are testing for VxWorks. At
-that moment we have to run on part of the test on the target, the other
-part on the host system. The part that has to run on the target has to
-be created as PerlACE::ProcessVX. When using VxWorks the files shouldn't
-be passed in created by PerlACE::LocalFile because that refers to the
-ior file on the host system, that is not reachable for the target, so
-the plain text filename should be passed.
+The server we have to spawn
@verbatim
-$CL = new PerlACE::Process ("client", " -k file://$server_ior ");
+$CL = $client->CreateProcess ("client", "-k file://$client_iorfile");
-$server = $SV->Spawn ();
+$server_status = $SV->Spawn ();
-if ($server != 0) {
- print STDERR "ERROR: server returned $server\n";
- $status = 1;
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ exit 1;
}
@endverbatim
-The PerlACE::Process is constructed with an executable and
+The PerlACE::Process is created with an executable and
arguments. @note Unlike the old Process module, the process
isn't started until one of the Spawn methods is used. We check
the result of the spawn, if we couldn't spawn the process
we directly exit the script.
@verbatim
-if (PerlACE::waitforfile_timed ($server_ior, $PerlACE::wait_interval_for_process_creation) == -1) {
- print STDERR "ERROR: cannot find file <$server_ior>\n";
- $SV->Kill ();
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
exit 1;
}
@endverbatim
-The PerlACE::waitforfile_timed method waits until the file is
+The WaitForFileTimed method waits until the file is
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
-$client = $CL->SpawnWaitKill (60);
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+@endverbatim
+
+This transfers the file from the server to the client in
+case that is needed with the used test targets.
+
+@verbatim
+$client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
-if ($client != 0) {
- print STDERR "ERROR: client returned $client\n";
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
$status = 1;
}
@endverbatim
@@ -187,10 +219,10 @@ timeout, since SpawnWaitKill will print out a timeout error.
Instead, just check for != 0.
@verbatim
-$server = $SV->TerminateWaitKill (5);
+$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
-if ($server != 0) {
- print STDERR "ERROR: server returned $server\n";
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
$status = 1;
}
@endverbatim
@@ -202,7 +234,11 @@ it does (such as when the client calls a shutdown method). Once
again, we check the return status.
@verbatim
-unlink $server_ior;
+$server->GetStderrLog();
+$client->GetStderrLog();
+
+$server->DeleteFile($server_iorfile);
+$client->DeleteFile($client_iorfile);
exit $status;
@endverbatim