Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / MT_Server / run_test.pl
blob7819dc6245ecc14faaf0ec9e0b0dea50b21827d8
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 $threads = '8';
12 $debug_level = '0';
14 foreach $i (@ARGV) {
15 if ($i eq '-debug') {
16 $debug_level = '10';
20 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
21 my $client1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
22 my $client2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 my $client3 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
25 my $iorbase = "server.ior";
26 my $server_iorfile = $server->LocalFile ($iorbase);
27 my $client1_iorfile = $client1->LocalFile ($iorbase);
28 my $client2_iorfile = $client2->LocalFile ($iorbase);
29 my $client3_iorfile = $client3->LocalFile ($iorbase);
30 $server->DeleteFile($iorbase);
31 $client1->DeleteFile($iorbase);
32 $client2->DeleteFile($iorbase);
33 $client3->DeleteFile($iorbase);
35 my $svcconf = "server$PerlACE::svcconf_ext";
36 my $server_svcfile = $server->LocalFile ($svcconf);
38 # Copy the configuration file to the target.
39 if ($server->PutFile ($svcconf) == -1) {
40 print STDERR "ERROR: cannot set file <$server_svcfile>\n";
41 exit 1;
44 $SV = $server->CreateProcess ("server",
45 "-ORBdebuglevel $debug_level ".
46 "-ORBSvcConf $server_svcfile ".
47 "-n $threads ".
48 "-o $server_iorfile");
49 $CL1 = $client1->CreateProcess ("client",
50 "-i 100 -k file://$client1_iorfile");
51 $CL2 = $client2->CreateProcess ("client",
52 "-i 100 -k file://$client2_iorfile");
53 $CL3 = $client3->CreateProcess ("client",
54 "-i 100 -k file://$client3_iorfile");
56 $server_status = $SV->Spawn ();
58 if ($server_status != 0) {
59 print STDERR "ERROR: server returned $server_status\n";
60 exit 1;
63 if ($server->WaitForFileTimed ($iorbase,
64 $server->ProcessStartWaitInterval()) == -1) {
65 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
66 $SV->Kill (); $SV->TimedWait (1);
67 exit 1;
70 if ($server->GetFile ($iorbase) == -1) {
71 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
72 $SV->Kill (); $SV->TimedWait (1);
73 exit 1;
75 if ($client1->PutFile ($iorbase) == -1) {
76 print STDERR "ERROR: cannot set file <$client1_iorfile>\n";
77 $SV->Kill (); $SV->TimedWait (1);
78 exit 1;
80 if ($client2->PutFile ($iorbase) == -1) {
81 print STDERR "ERROR: cannot set file <$client2_iorfile>\n";
82 $SV->Kill (); $SV->TimedWait (1);
83 exit 1;
85 if ($client3->PutFile ($iorbase) == -1) {
86 print STDERR "ERROR: cannot set file <$client3_iorfile>\n";
87 $SV->Kill (); $SV->TimedWait (1);
88 exit 1;
91 $client_status = $CL1->Spawn ();
93 if ($client_status != 0) {
94 print STDERR "ERROR: client returned $client_status\n";
95 $SV->Kill (); $SV->TimedWait (1);
96 exit 1;
99 $client_status = $CL2->Spawn ();
101 if ($client_status != 0) {
102 print STDERR "ERROR: client returned $client_status\n";
103 $SV->Kill (); $SV->TimedWait (1);
104 $CL1->Kill (); $CL1->TimedWait (1);
105 exit 1;
108 $client_status = $CL3->Spawn ();
110 if ($client_status != 0) {
111 print STDERR "ERROR: client returned $client_status\n";
112 $SV->Kill (); $SV->TimedWait (1);
113 $CL1->Kill (); $CL1->TimedWait (1);
114 $CL2->Kill (); $CL2->TimedWait (1);
115 exit 1;
118 $client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval() + 45);
120 if ($client_status != 0) {
121 print STDERR "ERROR: client 1 returned $client_status\n";
122 $status = 1;
125 $client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval());
127 if ($client_status != 0) {
128 print STDERR "ERROR: client 2 returned $client_status\n";
129 $status = 1;
132 $client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval());
134 if ($client_status != 0) {
135 print STDERR "ERROR: client 3 returned $client_status\n";
136 $status = 1;
139 $CL1->Arguments ("-i 100 -x -k file://$client1_iorfile");
141 $client_status = $CL1->SpawnWaitKill ($client1->ProcessStartWaitInterval());
143 if ($client_status != 0) {
144 print STDERR "ERROR: client returned $client_status\n";
145 $SV->Kill (); $SV->TimedWait (1);
146 exit 1;
149 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 135);
151 if ($server_status != 0) {
152 print STDERR "ERROR: server returned $server_status\n";
153 $status = 1;
156 $server->DeleteFile($iorbase);
157 $client1->DeleteFile($iorbase);
158 $client2->DeleteFile($iorbase);
159 $client3->DeleteFile($iorbase);
161 exit $status;