Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Server_Connection_Purging / run_test.pl
blob1e46029558deff0fa73a15806e51acadda8a6fe0
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";
21 my $client_shutdown = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
24 $orb_port = $server->RandomPort();
26 my $iorbase = "server.ior";
27 my $server_iorfile = $server->LocalFile ($iorbase);
28 my $client_shutdown_iorfile = $client_shutdown->LocalFile ($iorbase);
29 $server->DeleteFile($iorbase);
30 $client_shutdown->DeleteFile($iorbase);
32 $hostname = $server->HostName();
34 $SV = $server->CreateProcess ("server",
35 "-ORBdebuglevel $debug_level " .
36 "-ORBEndpoint iiop://$hostname:$orb_port " .
37 "-o $server_iorfile");
39 $CL = $client->CreateProcess ("client",
40 "-h $hostname " .
41 "-p $orb_port");
43 $SH_CL = $client_shutdown->CreateProcess ("shutdown_client", "-k file://$client_shutdown_iorfile");
45 $server_status = $SV->Spawn ();
47 if ($server_status != 0) {
48 print STDERR "ERROR: server returned $server_status\n";
49 exit 1;
52 if ($server->WaitForFileTimed ($iorbase,
53 $server->ProcessStartWaitInterval()) == -1) {
54 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
55 $SV->Kill (); $SV->TimedWait (1);
56 exit 1;
59 if ($server->GetFile ($iorbase) == -1) {
60 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
61 $SV->Kill (); $SV->TimedWait (1);
62 exit 1;
64 if ($client_shutdown->PutFile ($iorbase) == -1) {
65 print STDERR "ERROR: cannot set file <$client_shutdown_iorfile>\n";
66 $SV->Kill (); $SV->TimedWait (1);
67 exit 1;
70 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 285);
72 if ($client_status != 0) {
73 print STDERR "ERROR: client returned $client_status\n";
74 $status = 1;
77 print "Calling shutdown client\n";
79 $client_status = $SH_CL->SpawnWaitKill ($client_shutdown->ProcessStartWaitInterval() + 285);
81 if ($client_status != 0) {
82 print STDERR "ERROR: client shutdown returned $client_status\n";
83 $status = 1;
86 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 100);
88 if ($server_status != 0) {
89 print STDERR "ERROR: server returned $server_status\n";
90 $status = 1;
93 $server->DeleteFile($iorbase);
94 $client_shutdown->DeleteFile($iorbase);
96 exit $status;