Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / POA / Reference_Counted_Servant / run_test.pl
blobaf065ebdfc8c7ee058bacc16cf011067ad1d88ae
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 $iorbase = "poa.ior";
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 $server->AddLibPath ('../Generic_Servant/.');
16 $client->AddLibPath ('../Generic_Servant/.');
18 $oneway = "";
19 $iterations = 100;
21 $extra_args = "";
23 # Parse the arguments
24 for ($i = 0; $i <= $#ARGV; $i++) {
25 if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
26 print "run_test [-h] [-i iterations] [-o] [-f ior file]\n";
27 print "\n";
28 print "-h -- prints this information\n";
29 print "-f -- ior file\n";
30 print "-i iterations -- specifies iterations\n";
31 print "-o -- call issued are oneways\n";
32 exit;
34 elsif ($ARGV[$i] eq "-o") {
35 $oneway = "-o";
37 elsif ($ARGV[$i] eq "-i") {
38 $iterations = $ARGV[$i + 1];
39 $i++;
41 elsif ($ARGV[$i] eq "-f") {
42 $iorbase = $ARGV[$i + 1];
43 $i++;
45 else {
46 $extra_args .= " " . $ARGV[$i];
50 $server_iorfile = $server->LocalFile ($iorbase);
51 $client_iorfile = $client->LocalFile ($iorbase);
52 $server->DeleteFile ($iorbase);
53 $client->DeleteFile ($iorbase);
55 $SV = $server->CreateProcess ("server", "-f $server_iorfile $extra_args");
56 $CL = $client->CreateProcess ("../Generic_Servant/client", "$extra_args $oneway -i $iterations -k file://$client_iorfile -x");
58 $status = 0;
60 $server_status = $SV->Spawn ();
62 if ($server_status != 0) {
63 print STDERR "ERROR: server returned $server_status\n";
64 exit 1;
67 if ($server->WaitForFileTimed ($iorbase,
68 $server->ProcessStartWaitInterval()) == -1) {
69 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
70 $SV->Kill (); $SV->TimedWait (1);
71 exit 1;
74 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
76 if ($client_status != 0) {
77 print STDERR "ERROR: client returned $client_status\n";
78 $status = 1;
81 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
83 if ($server_status != 0) {
84 print STDERR "ERROR: server returned $server_status\n";
85 $status = 1;
88 $server->DeleteFile ($iorbase);
89 $client->DeleteFile ($iorbase);
91 exit $status;