Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / Bug_3853_Regression / run_test.pl
blobc4b86f89890266da8aa418a506ca75c2ff950651
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;
10 $status = 0;
12 my $server1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
13 my $server2 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
14 my $client = PerlACE::TestTarget::create_target (3) || die "Create target 2 failed\n";
16 $port1 = PerlACE::uniqueid () + 10001;
17 $port2 = PerlACE::uniqueid () + 10002;
19 my $iorbase1 = "server1.ior";
20 my $iorbase2 = "server2.ior";
21 my $shutdown_iorbase1 = "server1_shutdown.ior";
22 my $shutdown_iorbase2 = "server2_shutdown.ior";
23 my $server_iorfile1 = $server1->LocalFile ($iorbase1);
24 my $server_iorfile2 = $server2->LocalFile ($iorbase2);
25 my $shutdown_server_iorfile1 = PerlACE::LocalFile ($shutdown_iorbase1);
26 my $shutdown_server_iorfile2 = PerlACE::LocalFile ($shutdown_iorbase2);
28 $server1->DeleteFile($iorbase1);
29 $server1->DeleteFile($shutdown_iorbase1);
30 $server2->DeleteFile($iorbase2);
31 $server2->DeleteFile($shutdown_iorbase2);
33 $SV1 = $server1->CreateProcess ("server", "-ORBEndpoint iiop://localhost:$port1 -o $server_iorfile1 -s $shutdown_server_iorfile1");
34 $SV2 = $server2->CreateProcess ("server", "-ORBEndpoint iiop://localhost:$port2 -o $server_iorfile2 -s $shutdown_server_iorfile2");
35 $CL = $client->CreateProcess ("client", "-t 30");
37 $server_status = $SV1->Spawn ();
39 if ($server_status != 0) {
40 print STDERR "ERROR: server 1 returned $server_status\n";
41 exit 1;
44 $server_status = $SV2->Spawn ();
46 if ($server_status != 0) {
47 print STDERR "ERROR: server 2 returned $server_status\n";
48 exit 1;
51 if ($server1->WaitForFileTimed ($iorbase1,
52 $server1->ProcessStartWaitInterval()) == -1) {
53 print STDERR "ERROR: cannot find file <$server_iorfile1>\n";
54 $SV1->Kill (); $SV1->TimedWait (1);
55 $SV2->Kill (); $SV2->TimedWait (1);
56 exit 1;
59 if ($server1->WaitForFileTimed ($shutdown_iorbase1,
60 $server1->ProcessStartWaitInterval()) == -1) {
61 print STDERR "ERROR: cannot find file <$shutdown_server_iorfile1>\n";
62 $SV1->Kill (); $SV1->TimedWait (1);
63 $SV2->Kill (); $SV2->TimedWait (1);
64 exit 1;
67 if ($server2->WaitForFileTimed ($iorbase2,
68 $server2->ProcessStartWaitInterval()) == -1) {
69 print STDERR "ERROR: cannot find file <$server_iorfile1>\n";
70 $SV1->Kill (); $SV1->TimedWait (1);
71 $SV2->Kill (); $SV2->TimedWait (1);
72 exit 1;
75 if ($server2->WaitForFileTimed ($shutdown_iorbase2,
76 $server2->ProcessStartWaitInterval()) == -1) {
77 print STDERR "ERROR: cannot find file <$shutdown_server_iorfile2>\n";
78 $SV1->Kill (); $SV1->TimedWait (1);
79 $SV2->Kill (); $SV2->TimedWait (1);
80 exit 1;
84 $client_status = $CL->Spawn ();
86 if ($client_status != 0) {
87 print STDERR "ERROR: client returned $client_status\n";
88 $status = 1;
92 # The client requests server1 shutdown during 3th request.
93 sleep 15;
95 # To be safe, we kill service 1.
96 $server_status = $SV1->Kill ();
97 if ($server_status != 0) {
98 print STDERR "ERROR: kill server 1 returned $server_status\n";
99 $SV2->Kill (); $SV2->TimedWait (1);
100 $CL->Kill (); $CL->TimedWait (1);
101 exit 1;
104 $server_status = $SV1->Spawn ();
106 if ($server_status != 0) {
107 print STDERR "ERROR: restart server 1 returned $server_status\n";
108 $SV2->Kill (); $SV2->TimedWait (1);
109 $CL->Kill (); $CL->TimedWait (1);
110 exit 1;
113 $client_status = $CL->WaitKill ($client->ProcessStopWaitInterval() + 45);
115 if ($client_status != 0) {
116 print STDERR "ERROR: client returned $client_status\n";
117 $status = 1;
120 $server_status = $SV1->WaitKill ($server1->ProcessStopWaitInterval());
121 if ($server_status != 0) {
122 print STDERR "ERROR: server 1 returned $server_status\n";
123 $status = 1;
126 $server_status = $SV2->WaitKill ($server2->ProcessStopWaitInterval());
127 if ($server_status != 0) {
128 print STDERR "ERROR: server 2 returned $server_status\n";
129 $status = 1;
132 $server1->GetStderrLog();
133 $server2->GetStderrLog();
134 $client->GetStderrLog();
136 $server1->DeleteFile($server_iorfile1);
137 $server1->DeleteFile($shutdown_server_iorfile1);
138 $server2->DeleteFile($server_iorfile2);
139 $server2->DeleteFile($shutdown_server_iorfile2);
141 exit $status;