Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / tests / Hang_Shutdown / run_test.pl
blob803dba338f17e39cba262245f29a14a199606c21
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 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
12 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
14 my $iorbase = "server.ior";
15 my $server_iorfile = $server->LocalFile ($iorbase);
16 my $client_iorfile = $client->LocalFile ($iorbase);
17 $server->DeleteFile($iorbase);
18 $client->DeleteFile($iorbase);
20 $SV = $server->CreateProcess ("server", " -o $server_iorfile");
21 $CL = $client->CreateProcess ("client", " -k file://$client_iorfile");
23 $SV->Spawn ();
25 if ($server->WaitForFileTimed ($iorbase,
26 $server->ProcessStartWaitInterval()) == -1) {
27 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
28 $SV->Kill (); $SV->TimedWait (1);
29 exit 1;
32 $client_status = $CL->SpawnWaitKill (2*$client->ProcessStartWaitInterval ());
34 if ($client_status != 0) {
35 print STDERR "ERROR: client returned $client_status\n";
36 $status = 1;
39 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ());
41 if ($server_status != 0) {
42 print STDERR "ERROR: server returned $server_status\n";
43 $status = 1;
46 $server->DeleteFile($iorbase);
47 $client->DeleteFile($iorbase);
49 ################################
50 print STDERR "===== Client with RW handler\n";
52 my $svcconf = "client.conf";
53 my $client_svcfile = $client->LocalFile ($svcconf);
55 if ($client->PutFile ($svcconf) == -1) {
56 print STDERR "ERROR: cannot set file <$client_svcfile>\n";
57 exit 1;
60 $SV2 = $server->CreateProcess ("server", " -o $server_iorfile");
61 $CL2 = $client->CreateProcess ("client", " -ORBSvcConf $client_svcfile");
63 $SV2->Spawn ();
65 if ($server->WaitForFileTimed ($iorbase,
66 $server->ProcessStartWaitInterval()) == -1) {
67 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
68 $SV2->Kill (); $SV2->TimedWait (1);
69 exit 1;
72 $client_status = $CL2->SpawnWaitKill (2*$client->ProcessStartWaitInterval ());
74 if ($client_status != 0) {
75 print STDERR "ERROR: client 2 returned $client_status\n";
76 $status = 1;
79 $server_status = $SV2->WaitKill ($server->ProcessStopWaitInterval ());
81 if ($server_status != 0) {
82 print STDERR "ERROR: server 2 returned $server_status\n";
83 $status = 1;
86 $server->DeleteFile($iorbase);
87 $client->DeleteFile($iorbase);
89 exit $status;