Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / DSI_Gateway / run_exception_test.pl
blobfce54e7788562b7661d0ad014f802c326275c9f7
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 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);
30 $status = 0;
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";
40 exit 1;
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);
47 exit 1;
50 $GW->Spawn ();
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);
57 exit 1;
60 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
62 if ($client_status != 0) {
63 print STDERR "ERROR: client returned $client_status\n";
64 $status = 1;
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";
73 $status = 1;
76 $server_status = $SV->Kill ();
78 if ($server_status != 0) {
79 print STDERR "ERROR: server returned $server_status\n";
80 $status = 1;
83 $gateway_status = $GW->Kill ();
85 if ($gateway_status != 0) {
86 print STDERR "ERROR: gateway returned $gateway_status\n";
87 $status = 1;
90 $server->DeleteFile ($iorbase);
91 $server->DeleteFile ($gwbase);
92 $gateway->DeleteFile ($iorbase);
93 $gateway->DeleteFile ($gwbase);
94 $client->DeleteFile ($gwbase);
96 exit $status;