Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / DSI_AMI_Gateway / run_test.pl
blob3608de88e6e1de6f4699ba51b0f65fe8ee407e9a
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 use lib "$ENV{ACE_ROOT}/bin";
8 use PerlACE::TestTarget;
11 $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
12 $gateway = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
13 $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
15 $iorbase = "server.ior";
16 $gwbase = "gateway.ior";
18 $server_iorfile = $server->LocalFile ($iorbase);
19 $gateway_iorfile = $server->LocalFile ($iorbase);
20 $gateway_gwfile = $server->LocalFile ($gwbase);
21 $client_gwfile = $client->LocalFile ($gwbase);
23 $server->DeleteFile ($iorbase);
24 $gateway->DeleteFile ($iorbase);
25 $gateway->DeleteFile ($gwbase);
26 $client->DeleteFile ($gwbase);
28 $status = 0;
30 $SV = $server->CreateProcess ("server", "-o $server_iorfile");
31 $GW = $gateway->CreateProcess ("gateway", "-k file://$gateway_iorfile -o $gateway_gwfile");
32 $CL = $client->CreateProcess ("client", "-k file://$client_gwfile -x -i 100");
34 $server_status = $SV->Spawn ();
36 if ($server_status != 0) {
37 print STDERR "ERROR: server returned $server_status\n";
38 exit 1;
41 if ($server->WaitForFileTimed ($iorbase,
42 $server->ProcessStartWaitInterval()) == -1) {
43 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
44 $SV->Kill (); $SV->TimedWait (1);
45 exit 1;
48 $GW->Spawn ();
50 if ($gateway->WaitForFileTimed ($gwbase,
51 $gateway->ProcessStartWaitInterval()) == -1) {
52 print STDERR "ERROR: cannot find file <$gateway_gwfile>\n";
53 $SV->Kill (); $SV->TimedWait (1);
54 $GW->Kill (); $GW->TimedWait (1);
55 exit 1;
58 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
60 if ($client_status != 0) {
61 print STDERR "ERROR: client returned $client_status\n";
62 $status = 1;
65 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
67 if ($server_status != 0) {
68 print STDERR "ERROR: server returned $server_status\n";
69 $status = 1;
72 $gateway_status = $GW->WaitKill ($gateway->ProcessStopWaitInterval());
74 if ($gateway_status != 0) {
75 print STDERR "ERROR: gateway returned $gateway_status\n";
76 $status = 1;
79 $server->DeleteFile ($iorbase);
80 $gateway->DeleteFile ($iorbase);
81 $gateway->DeleteFile ($gwbase);
82 $client->DeleteFile ($gwbase);
84 exit $status;