Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Connect_Strategy_Test / run_test.pl
blob7a7d5616d11a42632d53ea31c473e463ee747bc2
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 $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
22 my $iorbase = "server.ior";
23 my $server_iorfile = $server->LocalFile ($iorbase);
24 my $client_iorfile = $client->LocalFile ($iorbase);
25 $server->DeleteFile($iorbase);
26 $client->DeleteFile($iorbase);
28 my $reactor_conf = "reactor$PerlACE::svcconf_ext";
29 my $client_reactor_conf = $client->LocalFile ($reactor_conf);
30 if ($client->PutFile ($reactor_conf) == -1) {
31 print STDERR "ERROR: cannot set file <$client_reactor_conf>\n";
32 exit 1;
35 my $blocked_conf = "blocked$PerlACE::svcconf_ext";
36 my $client_blocked_conf = $client->LocalFile ($blocked_conf);
37 if ($client->PutFile ($blocked_conf) == -1) {
38 print STDERR "ERROR: cannot set file <$client_blocked_conf>\n";
39 exit 1;
42 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
43 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile");
44 $server_status = $SV->Spawn ();
46 if ($server_status != 0) {
47 print STDERR "ERROR: server returned $server_status\n";
48 exit 1;
51 if ($server->WaitForFileTimed ($iorbase,
52 $server->ProcessStartWaitInterval()) == -1) {
53 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
54 $SV->Kill (); $SV->TimedWait (1);
55 exit 1;
58 if ($server->GetFile ($iorbase) == -1) {
59 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
60 $SV->Kill (); $SV->TimedWait (1);
61 exit 1;
63 if ($client->PutFile ($iorbase) == -1) {
64 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
65 $SV->Kill (); $SV->TimedWait (1);
66 exit 1;
69 print STDERR "===== Base test, using LF \n";
70 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
72 if ($client_status != 0) {
73 print STDERR "ERROR: client returned $client_status\n";
74 $status = 1;
77 print STDERR "=================================== \n";
78 print STDERR "===== Test, using reactor to connect \n";
80 $CL->Arguments ("-ORBSvcConf $client_reactor_conf -k file://$client_iorfile");
81 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
83 if ($client_status != 0) {
84 print STDERR "ERROR: client returned $client_status\n";
85 $status = 1;
88 print STDERR "========================================= \n";
89 print STDERR "===== Test, using blocked connect strategy\n";
91 $CL->Arguments ("-ORBSvcConf $client_blocked_conf -k file://$client_iorfile -x 1");
92 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
94 if ($client_status != 0) {
95 print STDERR "ERROR: client returned $client_status\n";
96 $status = 1;
99 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
101 if ($server_status != 0) {
102 print STDERR "ERROR: server returned $server_status\n";
103 $status = 1;
106 $server->DeleteFile($iorbase);
107 $client->DeleteFile($iorbase);
109 exit $status;