Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Big_Oneways / run_test.pl
bloba7cb9d426b90e55bd77e1e584d0f8a701762ec47
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";
35 my $iorbase = "server.ior";
36 my $server_iorfile = $server->LocalFile ($iorbase);
37 my $client1_iorfile = $client1->LocalFile ($iorbase);
38 my $client2_iorfile = $client2->LocalFile ($iorbase);
39 my $client3_iorfile = $client3->LocalFile ($iorbase);
40 $server->DeleteFile($iorbase);
41 $client1->DeleteFile($iorbase);
42 $client2->DeleteFile($iorbase);
43 $client3->DeleteFile($iorbase);
45 my $server_args = "-p 3";
46 if ($iterations >= 0) {
47 $server_args = "$server_args -i $iterations";
49 if ($payload >= 0) {
50 $server_args = "$server_args -b $payload";
53 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile $server_args");
54 $CL1 = $client1->CreateProcess ("client", "-k file://$client1_iorfile");
55 $CL2 = $client2->CreateProcess ("client", "-k file://$client2_iorfile");
56 $CL3 = $client3->CreateProcess ("client", "-k file://$client3_iorfile");
58 $server_status = $SV->Spawn ();
60 if ($server_status != 0) {
61 print STDERR "ERROR: server returned $server_status\n";
62 exit 1;
65 if ($server->WaitForFileTimed ($iorbase,
66 $server->ProcessStartWaitInterval()) == -1) {
67 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
68 $SV->Kill (); $SV->TimedWait (1);
69 exit 1;
72 if ($server->GetFile ($iorbase) == -1) {
73 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
74 $SV->Kill (); $SV->TimedWait (1);
75 exit 1;
77 if ($client1->PutFile ($iorbase) == -1) {
78 print STDERR "ERROR: cannot set file <$client1_iorfile>\n";
79 $SV->Kill (); $SV->TimedWait (1);
80 exit 1;
82 if ($client2->PutFile ($iorbase) == -1) {
83 print STDERR "ERROR: cannot set file <$client2_iorfile>\n";
84 $SV->Kill (); $SV->TimedWait (1);
85 exit 1;
87 if ($client3->PutFile ($iorbase) == -1) {
88 print STDERR "ERROR: cannot set file <$client3_iorfile>\n";
89 $SV->Kill (); $SV->TimedWait (1);
90 exit 1;
93 $client_status = $CL1->Spawn ();
95 if ($client_status != 0) {
96 print STDERR "ERROR: client returned $client_status\n";
97 $SV->Kill (); $SV->TimedWait (1);
98 exit 1;
101 $client_status = $CL2->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 exit 1;
110 $client_status = $CL3->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 $CL2->Kill (); $CL2->TimedWait (1);
117 exit 1;
120 $client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval() + 285);
122 if ($client_status != 0) {
123 print STDERR "ERROR: client returned $client_status\n";
124 $status = 1;
127 $client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval() + 45);
129 if ($client_status != 0) {
130 print STDERR "ERROR: client returned $client_status\n";
131 $status = 1;
134 $client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval() + 45);
136 if ($client_status != 0) {
137 print STDERR "ERROR: client returned $client_status\n";
138 $status = 1;
141 $server_status = $SV->WaitKill ($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;