Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / Bug_1020_Regression / run_test.pl
blob8f292008c8f062acbee77159772f28ac14105301
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 "-ORBdotteddecimaladdresses 1 ".
40 "-o $server_iorfile");
41 $CL1 = $client1->CreateProcess ("client", "-k file://$client1_iorfile");
42 $CL2 = $client2->CreateProcess ("client", "-k file://$client2_iorfile");
43 $CL3 = $client3->CreateProcess ("client", "-k file://$client3_iorfile");
45 $server_status = $SV->Spawn ();
47 if ($server_status != 0) {
48 print STDERR "ERROR: server returned $server_status\n";
49 exit 1;
52 if ($server->WaitForFileTimed ($iorbase,
53 $server->ProcessStartWaitInterval()) == -1) {
54 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
55 $SV->Kill (); $SV->TimedWait (1);
56 exit 1;
59 if ($server->GetFile ($iorbase) == -1) {
60 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
61 $SV->Kill (); $SV->TimedWait (1);
62 exit 1;
64 if ($client1->PutFile ($iorbase) == -1) {
65 print STDERR "ERROR: cannot set file <$client1_iorfile>\n";
66 $SV->Kill (); $SV->TimedWait (1);
67 exit 1;
69 if ($client2->PutFile ($iorbase) == -1) {
70 print STDERR "ERROR: cannot set file <$client2_iorfile>\n";
71 $SV->Kill (); $SV->TimedWait (1);
72 exit 1;
74 if ($client3->PutFile ($iorbase) == -1) {
75 print STDERR "ERROR: cannot set file <$client3_iorfile>\n";
76 $SV->Kill (); $SV->TimedWait (1);
77 exit 1;
80 local $start_time = time();
81 local $max_running_time = 300; # 5 minutes
82 local $elapsed = time() - $start_time;
84 if ($quick) {
85 $elapsed = 0;
86 $max_running_time = 1;
89 while($elapsed < $max_running_time) {
90 $client_status = $CL1->Spawn ();
91 if ($client_status != 0) {
92 print STDERR "ERROR: client returned $client_status\n";
93 $SV->Kill (); $SV->TimedWait (1);
94 exit 1;
97 $client_status = $CL2->Spawn ();
98 if ($client_status != 0) {
99 print STDERR "ERROR: client returned $client_status\n";
100 $SV->Kill (); $SV->TimedWait (1);
101 $CL1->Kill (); $CL1->TimedWait (1);
102 exit 1;
105 $client_status = $CL3->Spawn ();
106 if ($client_status != 0) {
107 print STDERR "ERROR: client returned $client_status\n";
108 $SV->Kill (); $SV->TimedWait (1);
109 $CL1->Kill (); $CL1->TimedWait (1);
110 $CL2->Kill (); $CL2->TimedWait (1);
111 exit 1;
114 $client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval() + 15, {self_crash => 1});
115 if ($client_status != 0) {
116 print STDERR "ERROR: client returned $client_status\n";
117 $SV->Kill (); $SV->TimedWait (1);
118 $CL2->Kill (); $CL2->TimedWait (1);
119 $CL3->Kill (); $CL3->TimedWait (1);
120 exit 1;
123 $client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval() + 15, {self_crash => 1});
124 if ($client_status != 0) {
125 print STDERR "ERROR: client returned $client_status\n";
126 $SV->Kill (); $SV->TimedWait (1);
127 $CL3->Kill (); $CL3->TimedWait (1);
128 exit 1;
131 $client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval() + 15, {self_crash => 1});
132 if ($client_status != 0) {
133 print STDERR "ERROR: client returned $client_status\n";
134 $SV->Kill (); $SV->TimedWait (1);
135 exit 1;
138 $elapsed = time() - $start_time;
141 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
143 if ($server_status != 0) {
144 print STDERR "ERROR: server returned $server_status\n";
145 $status = 1;
148 $server->DeleteFile($iorbase);
149 $client1->DeleteFile($iorbase);
150 $client2->DeleteFile($iorbase);
151 $client3->DeleteFile($iorbase);
153 exit $status;