Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Bug_1482_Regression / run_test.pl
blob33c513c74c071cb65dbbf606c302db7affd1d90f
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;
11 $debug_level = '0';
12 $quick = 0;
14 foreach $i (@ARGV) {
15 if ($i eq '-debug') {
16 $debug_level = '10';
17 } elsif ($i eq '-quick') {
18 $quick = 1;
22 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
23 my $client1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
24 my $client2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
25 my $client3 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
27 my $iorbase = "server.ior";
28 my $server_iorfile = $server->LocalFile ($iorbase);
29 my $client1_iorfile = $client1->LocalFile ($iorbase);
30 my $client2_iorfile = $client2->LocalFile ($iorbase);
31 my $client3_iorfile = $client3->LocalFile ($iorbase);
32 $server->DeleteFile($iorbase);
33 $client1->DeleteFile($iorbase);
34 $client2->DeleteFile($iorbase);
35 $client3->DeleteFile($iorbase);
37 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level ".
38 "-ORBdotteddecimaladdresses 1 ".
39 "-o $server_iorfile");
40 $CL1 = $client1->CreateProcess ("client", "-k file://$client1_iorfile");
41 $CL2 = $client2->CreateProcess ("client", "-k file://$client2_iorfile");
42 $CL3 = $client3->CreateProcess ("client", "-k file://$client3_iorfile");
44 local $start_time = time();
45 local $max_running_time = 600; # 10 minutes
46 local $elapsed = time() - $start_time;
48 if ($quick) {
49 $elapsed = 0;
50 $max_running_time = 1;
53 while($elapsed < $max_running_time) {
54 print STDERR " Going .. \n";
56 $server_status = $SV->Spawn ();
58 if ($server_status != 0) {
59 print STDERR "ERROR: server returned $server_status\n";
60 exit 1;
63 if ($server->WaitForFileTimed ($iorbase,
64 $server->ProcessStartWaitInterval()) == -1) {
65 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
66 $SV->Kill (); $SV->TimedWait (1);
67 exit 1;
70 if ($server->GetFile ($iorbase) == -1) {
71 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
72 $SV->Kill (); $SV->TimedWait (1);
73 exit 1;
75 if ($client1->PutFile ($iorbase) == -1) {
76 print STDERR "ERROR: cannot set file <$client1_iorfile>\n";
77 $SV->Kill (); $SV->TimedWait (1);
78 exit 1;
80 if ($client2->PutFile ($iorbase) == -1) {
81 print STDERR "ERROR: cannot set file <$client2_iorfile>\n";
82 $SV->Kill (); $SV->TimedWait (1);
83 exit 1;
85 if ($client3->PutFile ($iorbase) == -1) {
86 print STDERR "ERROR: cannot set file <$client3_iorfile>\n";
87 $SV->Kill (); $SV->TimedWait (1);
88 exit 1;
91 $client_status = $CL1->Spawn ();
92 if ($client_status != 0) {
93 print STDERR "ERROR: client returned $client_status\n";
94 $SV->Kill (); $SV->TimedWait (1);
95 exit 1;
98 $client_status = $CL2->Spawn ();
99 if ($client_status != 0) {
100 print STDERR "ERROR: client returned $client_status\n";
101 $SV->Kill (); $SV->TimedWait (1);
102 $CL1->Kill (); $CL1->TimedWait (1);
103 exit 1;
106 $client_status = $CL3->Spawn ();
107 if ($client_status != 0) {
108 print STDERR "ERROR: client returned $client_status\n";
109 $SV->Kill (); $SV->TimedWait (1);
110 $CL1->Kill (); $CL1->TimedWait (1);
111 $CL2->Kill (); $CL2->TimedWait (1);
112 exit 1;
115 sleep (90);
117 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval(), {self_crash => 1});
118 if ($server_status < 0) {
119 print STDERR "ERROR: server returned $server_status\n";
120 $CL1->Kill (); $CL1->TimedWait (1);
121 $CL2->Kill (); $CL2->TimedWait (1);
122 $CL3->Kill (); $CL3->TimedWait (1);
123 exit 1;
126 $client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval());
127 if ($client_status != 0) {
128 print STDERR "ERROR: client returned $client_status\n";
129 $CL2->Kill (); $CL2->TimedWait (1);
130 $CL3->Kill (); $CL3->TimedWait (1);
131 exit 1;
134 $client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval());
135 if ($client_status != 0) {
136 print STDERR "ERROR: client returned $client_status\n";
137 $CL3->Kill (); $CL3->TimedWait (1);
138 exit 1;
141 $client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval());
142 if ($client_status != 0) {
143 print STDERR "ERROR: client returned $client_status\n";
144 exit 1;
147 $server->DeleteFile($iorbase);
148 $client1->DeleteFile($iorbase);
149 $client2->DeleteFile($iorbase);
150 $client3->DeleteFile($iorbase);
152 $elapsed = time() - $start_time;
155 $server->DeleteFile($iorbase);
156 $client1->DeleteFile($iorbase);
157 $client2->DeleteFile($iorbase);
158 $client3->DeleteFile($iorbase);
160 exit $status;