Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Big_Twoways / run_test.pl
blobc6ff8640c992dfb4029a363eb21f71dd168259cd
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';
13 $iterations = -1;
14 $payload = -1;
15 for ($i = 0; $i < scalar @ARGV; $i++){
16 if ($ARGV[$i] eq '-debug') {
17 $debug_level = '10';
18 } elsif ($ARGV[$i] eq '-i') {
19 $i++;
20 $iterations = $ARGV[$i];
21 } elsif ($ARGV[$i] eq '-b') {
22 $i++;
23 $payload = $ARGV[$i];
24 } else {
25 print "Usage: run_test.pl [-b payload_size] [-i iterations]\n";
26 exit 1;
30 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
31 my $client1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
32 my $client2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
33 my $client3 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
34 my $client4 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
36 my $iorbase = "server.ior";
37 my $server_iorfile = $server->LocalFile ($iorbase);
38 my $client1_iorfile = $client1->LocalFile ($iorbase);
39 my $client2_iorfile = $client2->LocalFile ($iorbase);
40 my $client3_iorfile = $client3->LocalFile ($iorbase);
41 my $client4_iorfile = $client4->LocalFile ($iorbase);
42 $server->DeleteFile($iorbase);
43 $client1->DeleteFile($iorbase);
44 $client2->DeleteFile($iorbase);
45 $client3->DeleteFile($iorbase);
46 $client4->DeleteFile($iorbase);
48 my $server_args = "-p 4";
49 if ($iterations >= 0) {
50 $server_args = "$server_args -i $iterations";
52 if ($payload >= 0) {
53 $server_args = "$server_args -b $payload";
56 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile $server_args");
57 $CL1 = $client1->CreateProcess ("client", "-k file://$client1_iorfile");
58 $CL2 = $client2->CreateProcess ("client", "-k file://$client2_iorfile");
59 $CL3 = $client3->CreateProcess ("client", "-k file://$client3_iorfile");
60 $CL4 = $client4->CreateProcess ("client", "-k file://$client4_iorfile");
62 $server_status = $SV->Spawn ();
64 if ($server_status != 0) {
65 print STDERR "ERROR: server returned $server_status\n";
66 exit 1;
69 if ($server->WaitForFileTimed ($iorbase,
70 $server->ProcessStartWaitInterval()) == -1) {
71 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
72 $SV->Kill (); $SV->TimedWait (1);
73 exit 1;
76 if ($server->GetFile ($iorbase) == -1) {
77 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
78 $SV->Kill (); $SV->TimedWait (1);
79 exit 1;
81 if ($client1->PutFile ($iorbase) == -1) {
82 print STDERR "ERROR: cannot set file <$client1_iorfile>\n";
83 $SV->Kill (); $SV->TimedWait (1);
84 exit 1;
86 if ($client2->PutFile ($iorbase) == -1) {
87 print STDERR "ERROR: cannot set file <$client2_iorfile>\n";
88 $SV->Kill (); $SV->TimedWait (1);
89 exit 1;
91 if ($client3->PutFile ($iorbase) == -1) {
92 print STDERR "ERROR: cannot set file <$client3_iorfile>\n";
93 $SV->Kill (); $SV->TimedWait (1);
94 exit 1;
96 if ($client4->PutFile ($iorbase) == -1) {
97 print STDERR "ERROR: cannot set file <$client4_iorfile>\n";
98 $SV->Kill (); $SV->TimedWait (1);
99 exit 1;
102 $client_status = $CL1->Spawn ();
104 if ($client_status != 0) {
105 print STDERR "ERROR: client returned $client_status\n";
106 $SV->Kill (); $SV->TimedWait (1);
107 exit 1;
110 $client_status = $CL2->Spawn ();
112 if ($client_status != 0) {
113 print STDERR "ERROR: client returned $client_status\n";
114 $SV->Kill (); $SV->TimedWait (1);
115 $CL1->Kill (); $CL1->TimedWait (1);
116 exit 1;
119 $client_status = $CL3->Spawn ();
121 if ($client_status != 0) {
122 print STDERR "ERROR: client returned $client_status\n";
123 $SV->Kill (); $SV->TimedWait (1);
124 $CL1->Kill (); $CL1->TimedWait (1);
125 $CL2->Kill (); $CL2->TimedWait (1);
126 exit 1;
129 $client_status = $CL4->Spawn ();
131 if ($client_status != 0) {
132 print STDERR "ERROR: client returned $client_status\n";
133 $SV->Kill (); $SV->TimedWait (1);
134 $CL1->Kill (); $CL1->TimedWait (1);
135 $CL2->Kill (); $CL2->TimedWait (1);
136 $CL3->Kill (); $CL3->TimedWait (1);
137 exit 1;
140 $client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval() + 285);
142 if ($client_status != 0) {
143 print STDERR "ERROR: client returned $client_status\n";
144 $status = 1;
147 $client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval() + 45);
149 if ($client_status != 0) {
150 print STDERR "ERROR: client returned $client_status\n";
151 $status = 1;
154 $client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval() + 45);
156 if ($client_status != 0) {
157 print STDERR "ERROR: client returned $client_status\n";
158 $status = 1;
161 $client_status = $CL4->WaitKill ($client4->ProcessStopWaitInterval() + 45);
163 if ($client_status != 0) {
164 print STDERR "ERROR: client returned $client_status\n";
165 $status = 1;
168 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
170 if ($server_status != 0) {
171 print STDERR "ERROR: server returned $server_status\n";
172 $status = 1;
175 $server->DeleteFile($iorbase);
176 $client1->DeleteFile($iorbase);
177 $client2->DeleteFile($iorbase);
178 $client3->DeleteFile($iorbase);
179 $client4->DeleteFile($iorbase);
181 exit $status;