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/.');
24 for ($i = 0; $i <= $#ARGV; $i++) {
25 if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
26 print "run_test [-h] [-i iterations] [-o] [-f ior file]\n";
28 print "-h -- prints this information\n";
29 print "-f -- ior file\n";
30 print "-i iterations -- specifies iterations\n";
31 print "-o -- call issued are oneways\n";
34 elsif ($ARGV[$i] eq "-o") {
37 elsif ($ARGV[$i] eq "-i") {
38 $iterations = $ARGV[$i + 1];
41 elsif ($ARGV[$i] eq "-f") {
42 $iorbase0 = $ARGV[$i + 1];
46 $extra_args .= " " . $ARGV[$i];
50 $iorbase1 = $iorbase0."_1";
51 $iorbase2 = $iorbase0."_2";
52 $iorbase3 = $iorbase0."_3";
54 $iorfile0 = $server->LocalFile ($iorbase0);
55 $iorfile1 = $server->LocalFile ($iorbase1);
56 $iorfile2 = $server->LocalFile ($iorbase2);
57 $iorfile3 = $server->LocalFile ($iorbase3);
59 $client_iorfile1 = $client->LocalFile ($iorbase1);
60 $client_iorfile2 = $client->LocalFile ($iorbase2);
61 $client_iorfile3 = $client->LocalFile ($iorbase3);
63 $server->DeleteFile($iorbase0);
64 $server->DeleteFile($iorbase1);
65 $server->DeleteFile($iorbase2);
66 $server->DeleteFile($iorbase3);
68 $client->DeleteFile ($iorbase1);
69 $client->DeleteFile ($iorbase2);
70 $client->DeleteFile ($iorbase3);
74 $SV = $server->CreateProcess ("server", "-f $iorfile0 $extra_args");
75 $CL = $client->CreateProcess ("../Generic_Servant/client");
77 $server_status = $SV->Spawn ();
79 if ($server_status != 0) {
80 print STDERR
"ERROR: server returned $server_status\n";
84 if ($server->WaitForFileTimed ($iorbase1,
85 $server->ProcessStartWaitInterval()) == -1) {
86 print STDERR
"ERROR: cannot find file <$iorfile1>\n";
87 $SV->Kill (); $SV->TimedWait (1);
91 if ($server->WaitForFileTimed ($iorbase2,
92 $server->ProcessStartWaitInterval()) == -1) {
93 print STDERR
"ERROR: cannot find file <$iorfile2>\n";
94 $SV->Kill (); $SV->TimedWait (1);
98 if ($server->WaitForFileTimed ($iorbase3,
99 $server->ProcessStartWaitInterval()) == -1) {
100 print STDERR
"ERROR: cannot find file <$iorfile3>\n";
101 $SV->Kill (); $SV->TimedWait (1);
105 $CL->Arguments ("$extra_args $oneway -i $iterations -k file://$client_iorfile1");
107 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
109 if ($client_status != 0) {
110 print STDERR
"ERROR: client 1 returned $client_status\n";
114 $CL->Arguments ("$extra_args $oneway -i $iterations -k file://$client_iorfile2");
116 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
118 if ($client_status != 0) {
119 print STDERR
"ERROR: client 2 returned $client_status\n";
123 $CL->Arguments ("$extra_args $oneway -i $iterations -k file://$client_iorfile3 -x");
125 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
127 if ($client_status != 0) {
128 print STDERR
"ERROR: client 3 returned $client_status\n";
132 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
134 if ($server_status != 0) {
135 print STDERR
"ERROR: server returned $server_status\n";
139 $server->DeleteFile($iorbase0);
140 $server->DeleteFile($iorbase1);
141 $server->DeleteFile($iorbase2);
142 $server->DeleteFile($iorbase3);
144 $client->DeleteFile ($iorbase1);
145 $client->DeleteFile ($iorbase2);
146 $client->DeleteFile ($iorbase3);