Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / No_Server_MT_Connect_Test / run_test.pl
blob1aaab5ff987909b8ed4d82cc13665d9c4d0cd93c
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 # Initialize and copy the client configuration files
35 my $client2_conf_base = "reactor$PerlACE::svcconf_ext";
36 my $client2_conf = $client2->LocalFile ($client2_conf_base);
38 if ($client2->PutFile ($client2_conf_base) == -1) {
39 print STDERR "ERROR: cannot set file <$client2_conf>\n";
40 exit 1;
43 my $client3_conf_base = "blocked$PerlACE::svcconf_ext";
44 my $client3_conf = $client3->LocalFile ($client3_conf_base);
46 if ($client3->PutFile ($client3_conf_base) == -1) {
47 print STDERR "ERROR: cannot set file <$client3_conf>\n";
48 exit 1;
51 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
52 $CL1 = $client1->CreateProcess ("client", "-k file://$client1_iorfile -x");
53 # Use a single thread in this test, because the strategy is only for
54 # single threaded cases
55 $CL2 = $client2->CreateProcess ("client", "-ORBSvcConf $client2_conf -n 1 -k file://$client2_iorfile");
56 $CL3 = $client3->CreateProcess ("client", "-ORBSvcConf $client3_conf -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 print STDERR "===== Base test, using LF\n";
95 $client_status = $CL1->SpawnWaitKill ($client1->ProcessStartWaitInterval() + 85);
97 if ($client_status != 0) {
98 print STDERR "ERROR: client returned $client_status\n";
99 $SV->Kill (); $SV->TimedWait (1);
100 exit 1;
103 print STDERR "===================================\n";
104 print STDERR "===== Test, using reactor to connect\n";
106 $client_status = $CL2->SpawnWaitKill ($client2->ProcessStartWaitInterval() + 85);
108 if ($client_status != 0) {
109 print STDERR "ERROR: client returned $client_status\n";
110 $SV->Kill (); $SV->TimedWait (1);
111 exit 1;
114 print STDERR "=========================================\n";
115 print STDERR "===== Test, using blocked connect strategy\n";
117 $client_status = $CL3->SpawnWaitKill ($client3->ProcessStartWaitInterval() + 85);
119 if ($client_status != 0) {
120 print STDERR "ERROR: client returned $client_status\n";
121 $status = 1;
124 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
126 if ($server_status != 0) {
127 print STDERR "ERROR: server returned $server_status\n";
128 $status = 1;
131 $server->DeleteFile($iorbase);
132 $client1->DeleteFile($iorbase);
133 $client2->DeleteFile($iorbase);
134 $client3->DeleteFile($iorbase);
136 exit $status;