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
;
18 $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
19 $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
21 $server->AddLibPath ('../Generic_Servant/.');
22 $client->AddLibPath ('../Generic_Servant/.');
25 for ($i = 0; $i <= $#ARGV; $i++) {
26 if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
27 print "run_test [-h] [-i iterations] [-o] [-f ior file]\n";
29 print "-h -- prints this information\n";
30 print "-f -- ior file\n";
31 print "-i iterations -- specifies iterations\n";
32 print "-o -- call issued are oneways\n";
35 elsif ($ARGV[$i] eq "-o") {
38 elsif ($ARGV[$i] eq "-i") {
39 $iterations = $ARGV[$i + 1];
42 elsif ($ARGV[$i] eq "-f") {
43 $iorbase0 = $ARGV[$i + 1];
47 $extra_args .= " " . $ARGV[$i];
51 $iorbase1 = $iorbase0."_1";
52 $iorbase2 = $iorbase0."_2";
54 $server0_iorfile = $server->LocalFile ($iorbase0);
55 $server1_iorfile = $server->LocalFile ($iorbase1);
56 $server2_iorfile = $server->LocalFile ($iorbase2);
57 $client1_iorfile = $client->LocalFile ($iorbase1);
58 $client2_iorfile = $client->LocalFile ($iorbase2);
60 $server->DeleteFile ($iorbase0);
61 $server->DeleteFile ($iorbase1);
62 $server->DeleteFile ($iorbase2);
63 $client->DeleteFile ($iorbase1);
64 $client->DeleteFile ($iorbase2);
66 $SV = $server->CreateProcess ("server", "-f $server0_iorfile $extra_args");
68 $CL = $client->CreateProcess ("../Generic_Servant/client");
70 $server_status = $SV->Spawn ();
72 if ($server_status != 0) {
73 print STDERR
"ERROR: server returned $server_status\n";
77 if ($server->WaitForFileTimed ($iorbase1,
78 $server->ProcessStartWaitInterval()) == -1) {
79 print STDERR
"ERROR: cannot find file <$server1_iorfile>\n";
80 $SV1->Kill (); $SV1->TimedWait (1);
84 if ($server->WaitForFileTimed ($iorbase2,
85 $server->ProcessStartWaitInterval()) == -1) {
86 print STDERR
"ERROR: cannot find file <$server2_iorfile>\n";
87 $SV1->Kill (); $SV1->TimedWait (1);
91 $CL->Arguments ("$extra_args $oneway -i $iterations -k file://$client1_iorfile");
93 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
95 if ($client_status != 0) {
96 print STDERR
"ERROR: client 1 returned $client_status\n";
100 $CL->Arguments ("$extra_args $oneway -i $iterations -k file://$client2_iorfile -x");
102 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
104 if ($client_status != 0) {
105 print STDERR
"ERROR: client 2 returned $client_status\n";
109 $server_stauts = $SV->WaitKill ($server->ProcessStopWaitInterval());
111 if ($server_stauts != 0) {
112 print STDERR
"ERROR: server returned $server_stauts\n";
116 $server->DeleteFile ($iorbase0);
117 $server->DeleteFile ($iorbase1);
118 $server->DeleteFile ($iorbase2);
119 $client->DeleteFile ($iorbase1);
120 $client->DeleteFile ($iorbase2);