Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / AMH_Oneway / run_test.pl
blob6e47841f8ff166dfcefc09efd45aa131558caef7
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 # This is a Perl script that tests AMH exceptions
9 use lib "$ENV{ACE_ROOT}/bin";
10 use PerlACE::TestTarget;
12 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
13 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
15 my $iorbase = "test.ior";
16 my $server_iorfile = $server->LocalFile ($iorbase);
17 my $client_iorfile = $client->LocalFile ($iorbase);
18 $server->DeleteFile($iorbase);
19 $client->DeleteFile($iorbase);
21 $AMH = $server->CreateProcess ("server", "");
22 $CL = $client->CreateProcess ("client", "");
24 # Run the AMH server.
25 $sv = $AMH->Spawn ();
27 if ($sv != 0) {
28 print STDERR "ERROR: AMH server returned $sv\n";
29 exit 1;
32 if ($server->WaitForFileTimed ($iorbase,
33 $server->ProcessStartWaitInterval()) == -1) {
34 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
35 $AMH->Kill (); $AMH->TimedWait (1);
36 exit 1;
38 if ($server->GetFile ($iorbase) == -1) {
39 print STDERR "ERROR: cannot get file <$server_iorfile>\n";
40 $AMH->Kill (); $AMH->TimedWait (1);
41 exit 1;
43 if ($client->PutFile ($iorbase) == -1) {
44 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
45 $AMH->Kill (); $AMH->TimedWait (1);
46 exit 1;
49 # Run the client.
50 $client_status = $CL->Spawn ();
51 if ($client_status != 0) {
52 print STDERR "ERROR: Client returned $client_status\n";
53 $status = 1;
56 # Clean up.
58 $client_status = $CL->WaitKill ($client->ProcessStopWaitInterval() + 15);
59 if ($client_status != 0) {
60 print STDERR "ERROR: Client returned $client_status\n";
61 $status = 1;
64 $amhserver= $AMH->WaitKill ($server->ProcessStopWaitInterval());
65 if ($amhserver != 0) {
66 print STDERR "ERROR: AMH Server returned $amhserver\n";
67 $status = 1;
70 $server->DeleteFile($iorbase);
71 $client->DeleteFile($iorbase);
73 exit $status;