Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / GIOP_Fragments / Java_Big_Reply / run_test.pl
blob4b87cec405115f30ca5080bcdc8ecb0e36f6418b
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;
9 use Config;
11 sub which {
12 my($prog) = shift;
13 my($exec) = $prog;
15 if (defined $ENV{'PATH'}) {
16 my($part) = '';
17 foreach $part (split($Config{'path_sep'}, $ENV{'PATH'})) {
18 $part .= "/$prog";
19 if ( -x $part ) {
20 $exec = $part;
21 last;
26 return $exec;
29 $status = 0;
30 $debug_level = '0';
32 foreach $i (@ARGV) {
33 if ($i eq '-debug') {
34 $debug_level = '10';
38 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
39 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
41 my $iorbase = "server.ior";
42 my $server_iorfile = $server->LocalFile ($iorbase);
43 my $client_iorfile = $client->LocalFile ($iorbase);
44 $server->DeleteFile($iorbase);
45 $client->DeleteFile($iorbase);
47 $SV = $server->CreateProcess (which("java"), "server");
48 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile");
49 $server_status = $SV->Spawn ();
51 if ($server_status != 0) {
52 print STDERR "ERROR: server returned $server_status\n";
53 exit 1;
56 if ($server->WaitForFileTimed ($iorbase,
57 $server->ProcessStartWaitInterval()) == -1) {
58 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
59 $SV->Kill (); $SV->TimedWait (1);
60 exit 1;
63 if ($server->GetFile ($iorbase) == -1) {
64 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
65 $SV->Kill (); $SV->TimedWait (1);
66 exit 1;
69 if ($client->PutFile ($iorbase) == -1) {
70 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
71 $SV->Kill (); $SV->TimedWait (1);
72 exit 1;
75 $client_status = $CL->Spawn ($client->ProcessStartWaitInterval() + 45);
77 if ($client_status != 0) {
78 print STDERR "ERROR: client Spawn returned $client_status\n";
79 $status = 1;
82 $client_status = $CL->WaitKill ($client->ProcessStopWaitInterval() + 45);
84 if ($client_status != 0) {
85 print STDERR "ERROR: client WaitKill returned $client_status\n";
86 $status = 1;
89 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
91 if ($server_status != 0) {
92 print STDERR "ERROR: server returned $server_status\n";
93 $status = 1;
96 $server->DeleteFile($iorbase);
97 $client->DeleteFile($iorbase);
99 exit $status;