1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
7 use lib
"$ENV{ACE_ROOT}/bin";
8 use PerlACE
::TestTarget
;
12 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
13 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
15 $server->AddLibPath ('../Generic_Servant/.');
16 $client->AddLibPath ('../Generic_Servant/.');
26 for ($i = 0; $i <= $#ARGV; $i++) {
27 if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
28 print "run_test [-h] [-i iterations] [-o] [-f ior file]\n";
30 print "-h -- prints this information\n";
31 print "-f -- ior file\n";
32 print "-i iterations -- specifies iterations\n";
33 print "-o -- call issued are oneways\n";
36 elsif ($ARGV[$i] eq "-o") {
39 elsif ($ARGV[$i] eq "-i") {
40 $iterations = $ARGV[$i + 1];
43 elsif ($ARGV[$i] eq "-f") {
44 $iorbase0 = $ARGV[$i + 1];
48 $extra_args .= " " . $ARGV[$i];
52 $iorbase1 = $iorbase0."_1";
53 $iorbase2 = $iorbase0."_2";
55 $iorfile0 = $server->LocalFile ($iorbase0);
56 $iorfile1 = $server->LocalFile ($iorbase1);
57 $iorfile2 = $server->LocalFile ($iorbase2);
59 $client_iorfile1 = $client->LocalFile ($iorbase1);
60 $client_iorfile2 = $client->LocalFile ($iorbase2);
62 $server->DeleteFile($iorbase0);
63 $server->DeleteFile($iorbase1);
64 $server->DeleteFile($iorbase2);
65 $client->DeleteFile ($iorbase1);
66 $client->DeleteFile ($iorbase2);
68 $SV = $server->CreateProcess ("server", "-f $iorfile0 $extra_args");
69 $CL = $client->CreateProcess ("../Generic_Servant/client");
71 $server_status = $SV->Spawn ();
73 if ($server_status != 0) {
74 print STDERR
"ERROR: server returned $server_status\n";
78 if ($server->WaitForFileTimed ($iorbase1,
79 $server->ProcessStartWaitInterval()) == -1) {
80 print STDERR
"ERROR: cannot find file <$iorfile1>\n";
81 $SV->Kill (); $SV->TimedWait (1);
85 if ($server->WaitForFileTimed ($iorbase2,
86 $server->ProcessStartWaitInterval()) == -1) {
87 print STDERR
"ERROR: cannot find file <$iorfile2>\n";
88 $SV->Kill (); $SV->TimedWait (1);
92 $CL->Arguments ("$extra_args $oneway -i $iterations -k file://$client_iorfile1");
94 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
96 if ($client_status != 0) {
97 print STDERR
"ERROR: client 1 returned $client_status\n";
101 $CL->Arguments ("$extra_args $oneway -i $iterations -k file://$client_iorfile2 -x");
103 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
105 if ($client_status != 0) {
106 print STDERR
"ERROR: client 2 returned $client_status\n";
110 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
112 if ($server_status != 0) {
113 print STDERR
"ERROR: server returned $server_status\n";
118 $server->DeleteFile($iorbase0);
119 $server->DeleteFile($iorbase1);
120 $server->DeleteFile($iorbase2);
121 $client->DeleteFile ($iorbase1);
122 $client->DeleteFile ($iorbase2);