Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Bug_1269_Regression / run_test.pl
blob04acb5009c2f337e53f9b348f96443b0d759a837
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 -o $server_iorfile");
38 $CL1 = $client1->CreateProcess ("client", "-k file://$client1_iorfile");
39 $CL2 = $client2->CreateProcess ("client", "-k file://$client2_iorfile");
40 $CL3 = $client3->CreateProcess ("client", "-k file://$client3_iorfile");
42 $server_status = $SV->Spawn ();
44 if ($server_status != 0) {
45 print STDERR "ERROR: server returned $server_status\n";
46 exit 1;
49 if ($server->WaitForFileTimed ($iorbase,
50 $server->ProcessStartWaitInterval()) == -1) {
51 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
52 $SV->Kill (); $SV->TimedWait (1);
53 exit 1;
56 if ($server->GetFile ($iorbase) == -1) {
57 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
58 $SV->Kill (); $SV->TimedWait (1);
59 exit 1;
61 if ($client1->PutFile ($iorbase) == -1) {
62 print STDERR "ERROR: cannot set file <$client1_iorfile>\n";
63 $SV->Kill (); $SV->TimedWait (1);
64 exit 1;
66 if ($client2->PutFile ($iorbase) == -1) {
67 print STDERR "ERROR: cannot set file <$client2_iorfile>\n";
68 $SV->Kill (); $SV->TimedWait (1);
69 exit 1;
71 if ($client3->PutFile ($iorbase) == -1) {
72 print STDERR "ERROR: cannot set file <$client3_iorfile>\n";
73 $SV->Kill (); $SV->TimedWait (1);
74 exit 1;
77 local $start_time = time();
78 local $max_running_time = 240; # 4 minutes
79 local $elapsed = time() - $start_time;
81 if ($quick) {
82 $elapsed = 0;
83 $max_running_time = 1;
86 while($elapsed < $max_running_time) {
87 $client_status = $CL1->Spawn ();
88 if ($client_status != 0) {
89 print STDERR "ERROR: client returned $client_status\n";
90 $SV->Kill (); $SV->TimedWait (1);
91 exit 1;
94 $client_status = $CL2->Spawn ();
95 if ($client_status != 0) {
96 print STDERR "ERROR: client returned $client_status\n";
97 $SV->Kill (); $SV->TimedWait (1);
98 $CL1->Kill (); $CL1->TimedWait (1);
99 exit 1;
102 $client_status = $CL3->Spawn ();
103 if ($client_status != 0) {
104 print STDERR "ERROR: client returned $client_status\n";
105 $SV->Kill (); $SV->TimedWait (1);
106 $CL1->Kill (); $CL1->TimedWait (1);
107 $CL2->Kill (); $CL2->TimedWait (1);
108 exit 1;
111 $client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval() + 45, {self_crash => 1});
112 if ($client_status != 0) {
113 print STDERR "ERROR: client returned $client_status\n";
114 $SV->Kill (); $SV->TimedWait (1);
115 $CL2->Kill (); $CL2->TimedWait (1);
116 $CL3->Kill (); $CL3->TimedWait (1);
117 exit 1;
120 $client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval() + 45, {self_crash => 1});
121 if ($client_status != 0) {
122 print STDERR "ERROR: client returned $client_status\n";
123 $SV->Kill (); $SV->TimedWait (1);
124 $CL3->Kill (); $CL3->TimedWait (1);
125 exit 1;
128 $client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval() + 45, {self_crash => 1});
129 if ($client_status != 0) {
130 print STDERR "ERROR: client returned $client_status\n";
131 $SV->Kill (); $SV->TimedWait (1);
132 exit 1;
135 $elapsed = time() - $start_time;
138 $CL3->Arguments ("-k file://$client3_iorfile -x");
140 $client_status = $CL3->SpawnWaitKill ($client3->ProcessStartWaitInterval());
142 if ($client_status != 0) {
143 print STDERR "ERROR: client returned $client_status\n";
144 $SV->Kill (); $SV->TimedWait (1);
145 exit 1;
148 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
150 if ($server_status != 0) {
151 print STDERR "ERROR: server returned $server_status\n";
152 $status = 1;
155 $server->DeleteFile($iorbase);
156 $client1->DeleteFile($iorbase);
157 $client2->DeleteFile($iorbase);
158 $client3->DeleteFile($iorbase);
160 exit $status;