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
;
11 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
12 my $gateway = 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 my $iorbase = "server.ior";
16 my $gwbase = "gateway.ior";
18 my $server_iorfile = $server->LocalFile ($iorbase);
19 my $server_gwfile = $server->LocalFile ($gwbase);
20 my $gateway_iorfile = $server->LocalFile ($iorbase);
21 my $gateway_gwfile = $server->LocalFile ($gwbase);
22 my $client_gwfile = $client->LocalFile ($gwbase);
24 $server->DeleteFile ($iorbase);
25 $server->DeleteFile ($gwbase);
26 $gateway->DeleteFile ($iorbase);
27 $gateway->DeleteFile ($gwbase);
28 $client->DeleteFile ($gwbase);
32 $SV = $server->CreateProcess ("server", "-o $server_iorfile");
33 $GW = $gateway->CreateProcess ("gateway", "-k file://$gateway_iorfile -o $gateway_gwfile");
34 $CL = $client->CreateProcess ("client", "-k file://$client_gwfile -u");
36 $server_status = $SV->Spawn ();
38 if ($server_status != 0) {
39 print STDERR
"ERROR: server returned $server_status\n";
43 if ($server->WaitForFileTimed ($iorbase,
44 $server->ProcessStartWaitInterval()) == -1) {
45 print STDERR
"ERROR: cannot find file <$server_iorfile>\n";
46 $SV->Kill (); $SV->TimedWait (1);
52 if ($gateway->WaitForFileTimed ($gwbase,
53 $gateway->ProcessStartWaitInterval()) == -1) {
54 print STDERR
"ERROR: cannot find file <$gateway_gwfile>\n";
55 $SV->Kill (); $SV->TimedWait (1);
56 $GW->Kill (); $GW->TimedWait (1);
60 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
62 if ($client_status != 0) {
63 print STDERR
"ERROR: client returned $client_status\n";
67 $CL = $client->CreateProcess ("client", "-k file://$client_gwfile -s");
69 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
71 if ($client_status != 0) {
72 print STDERR
"ERROR: client returned $client_status\n";
76 $server_status = $SV->Kill ();
78 if ($server_status != 0) {
79 print STDERR
"ERROR: server returned $server_status\n";
83 $gateway_status = $GW->Kill ();
85 if ($gateway_status != 0) {
86 print STDERR
"ERROR: gateway returned $gateway_status\n";
90 $server->DeleteFile ($iorbase);
91 $server->DeleteFile ($gwbase);
92 $gateway->DeleteFile ($iorbase);
93 $gateway->DeleteFile ($gwbase);
94 $client->DeleteFile ($gwbase);