Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / MT_BiDir / run_test.pl
blobafa3df9fd5d591de211817af6503046828607c41
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 foreach $i (@ARGV) {
14 if ($i eq '-debug') {
15 $debug_level = '10';
19 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $client1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $client2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
22 my $client3 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
24 my $iorbase = "server.ior";
25 my $server_iorfile = $server->LocalFile ($iorbase);
26 my $client1_iorfile = $client1->LocalFile ($iorbase);
27 my $client2_iorfile = $client2->LocalFile ($iorbase);
28 my $client3_iorfile = $client3->LocalFile ($iorbase);
29 $server->DeleteFile($iorbase);
30 $client1->DeleteFile($iorbase);
31 $client2->DeleteFile($iorbase);
32 $client3->DeleteFile($iorbase);
34 my $server_conf_base = "server$PerlACE::svcconf_ext";
35 my $server_conf = $server->LocalFile ($server_conf_base);
37 # Copy the configuration file to the target.
38 if ($server->PutFile ($server_conf_base) == -1) {
39 print STDERR "ERROR: cannot set file <$server_conf>\n";
40 exit 1;
43 $SV = $server->CreateProcess ("server",
44 "-ORBdebuglevel $debug_level -ORBSvcConf $server_conf " .
45 "-o $server_iorfile -c 3 -i 100");
46 $CL1 = $client1->CreateProcess ("client", "-k file://$client1_iorfile");
47 $CL2 = $client2->CreateProcess ("client", "-k file://$client2_iorfile");
48 $CL3 = $client3->CreateProcess ("client", "-k file://$client3_iorfile");
50 $server_status = $SV->Spawn ();
52 if ($server_status != 0) {
53 print STDERR "ERROR: server returned $server_status\n";
54 exit 1;
57 if ($server->WaitForFileTimed ($iorbase,
58 $server->ProcessStartWaitInterval()) == -1) {
59 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
60 $SV->Kill (); $SV->TimedWait (1);
61 exit 1;
64 if ($server->GetFile ($iorbase) == -1) {
65 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
66 $SV->Kill (); $SV->TimedWait (1);
67 exit 1;
69 if ($client1->PutFile ($iorbase) == -1) {
70 print STDERR "ERROR: cannot set file <$client1_iorfile>\n";
71 $SV->Kill (); $SV->TimedWait (1);
72 exit 1;
74 if ($client2->PutFile ($iorbase) == -1) {
75 print STDERR "ERROR: cannot set file <$client2_iorfile>\n";
76 $SV->Kill (); $SV->TimedWait (1);
77 exit 1;
79 if ($client3->PutFile ($iorbase) == -1) {
80 print STDERR "ERROR: cannot set file <$client3_iorfile>\n";
81 $SV->Kill (); $SV->TimedWait (1);
82 exit 1;
85 $client_status = $CL1->Spawn ();
87 if ($client_status != 0) {
88 print STDERR "ERROR: client returned $client_status\n";
89 $SV->Kill (); $SV->TimedWait (1);
90 exit 1;
93 $client_status = $CL2->Spawn ();
95 if ($client_status != 0) {
96 print STDERR "ERROR: client returned $client_status\n";
97 $SV->Kill (); $SV->TimedWait (1);
98 $CL1->Kill (); $CL1->TimedWait (1);
99 exit 1;
102 $client_status = $CL3->Spawn ();
104 if ($client_status != 0) {
105 print STDERR "ERROR: client returned $client_status\n";
106 $SV->Kill (); $SV->TimedWait (1);
107 $CL1->Kill (); $CL1->TimedWait (1);
108 $CL2->Kill (); $CL2->TimedWait (1);
109 exit 1;
112 $client_status = $CL1->WaitKill ($client1->ProcessStopWaitInterval() + 60);
114 if ($client_status != 0) {
115 print STDERR "ERROR: client returned $client_status\n";
116 $status = 1;
119 $client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval() + 60);
121 if ($client_status != 0) {
122 print STDERR "ERROR: client returned $client_status\n";
123 $status = 1;
126 $client_status = $CL3->WaitKill ($client3->ProcessStopWaitInterval() + 60);
128 if ($client_status != 0) {
129 print STDERR "ERROR: client returned $client_status\n";
130 $status = 1;
133 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
135 if ($server_status != 0) {
136 print STDERR "ERROR: server returned $server_status\n";
137 $status = 1;
140 $server->DeleteFile($iorbase);
141 $client1->DeleteFile($iorbase);
142 $client2->DeleteFile($iorbase);
143 $client3->DeleteFile($iorbase);
145 exit $status;