Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / Nested_Upcall_Crash / run_test.pl
blob4ead7d21e4a2b307b82baf4ea1b6cbd819bd18e6
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",
38 "-ORBdebuglevel $debug_level ".
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 $server_status = $SV->Spawn ();
46 if ($server_status != 0) {
47 print STDERR "ERROR: server returned $server_status\n";
48 exit 1;
51 if ($server->WaitForFileTimed ($iorbase,
52 $server->ProcessStartWaitInterval()) == -1) {
53 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
54 $SV->Kill (); $SV->TimedWait (1);
55 exit 1;
58 if ($server->GetFile ($iorbase) == -1) {
59 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
60 $SV->Kill (); $SV->TimedWait (1);
61 exit 1;
63 if ($client1->PutFile ($iorbase) == -1) {
64 print STDERR "ERROR: cannot set file <$client1_iorfile>\n";
65 $SV->Kill (); $SV->TimedWait (1);
66 exit 1;
68 if ($client2->PutFile ($iorbase) == -1) {
69 print STDERR "ERROR: cannot set file <$client2_iorfile>\n";
70 $SV->Kill (); $SV->TimedWait (1);
71 exit 1;
73 if ($client3->PutFile ($iorbase) == -1) {
74 print STDERR "ERROR: cannot set file <$client3_iorfile>\n";
75 $SV->Kill (); $SV->TimedWait (1);
76 exit 1;
79 local $start_time = time();
80 local $max_running_time = 600; # 10 minutes
81 local $elapsed = time() - $start_time;
83 if ($quick) {
84 $elapsed = 0;
85 $max_running_time = 1;
88 while($elapsed < $max_running_time) {
89 $client_status = $CL1->Spawn ();
90 if ($client_status != 0) {
91 print STDERR "ERROR: client returned $client_status\n";
92 $SV->Kill (); $SV->TimedWait (1);
93 exit 1;
96 $client_status = $CL2->Spawn ();
97 if ($client_status != 0) {
98 print STDERR "ERROR: client returned $client_status\n";
99 $SV->Kill (); $SV->TimedWait (1);
100 $CL1->Kill (); $CL1->TimedWait (1);
101 exit 1;
104 $client_status = $CL3->Spawn ();
105 if ($client_status != 0) {
106 print STDERR "ERROR: client returned $client_status\n";
107 $SV->Kill (); $SV->TimedWait (1);
108 $CL1->Kill (); $CL1->TimedWait (1);
109 $CL2->Kill (); $CL2->TimedWait (1);
110 exit 1;
113 $client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval() + 15, {self_crash => 1});
114 if ($client_status < 0) {
115 print STDERR "ERROR: client returned $client_status\n";
116 $SV->Kill (); $SV->TimedWait (1);
117 $CL2->Kill (); $CL2->TimedWait (1);
118 $CL3->Kill (); $CL3->TimedWait (1);
119 exit 1;
122 $client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval() + 15, {self_crash => 1});
123 if ($client_status < 0) {
124 print STDERR "ERROR: client returned $client_status\n";
125 $SV->Kill (); $SV->TimedWait (1);
126 $CL3->Kill (); $CL3->TimedWait (1);
127 exit 1;
130 $client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval() + 15, {self_crash => 1});
131 if ($client_status < 0) {
132 print STDERR "ERROR: client returned $client_status\n";
133 $SV->Kill (); $SV->TimedWait (1);
134 exit 1;
137 $elapsed = time() - $start_time;
140 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
141 if ($server_status != 0) {
142 print STDERR "ERROR: server returned $server_status\n";
143 $status = 1;
146 $server->DeleteFile($iorbase);
147 $client1->DeleteFile($iorbase);
148 $client2->DeleteFile($iorbase);
149 $client3->DeleteFile($iorbase);
151 exit $status;