Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / ClientPortSpan / run_test.pl
blobc00a772ca5917098b8ea7f3ba78aed4e933f7da8
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 $transients = 0;
12 $debug_level = 0;
13 $cdebug_level = 0;
14 foreach $i (@ARGV) {
15 if ($i eq '-debug') {
16 $debug_level = 10;
18 if ($i eq '-cdebug') {
19 $cdebug_level = 3;
23 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
24 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
26 my $iorbase = "server.ior";
27 my $server_iorfile = $server->LocalFile ($iorbase);
28 my $client_iorfile = $client->LocalFile ($iorbase);
29 $server->DeleteFile($iorbase);
30 $client->DeleteFile($iorbase);
32 my $port = $server->RandomPort ();
33 my $width = 3;
35 my $server_arg = "-ORBListenEndpoints iiop://127.0.0.1:$port -o $server_iorfile";
36 $server_arg .= " -ORBdebuglevel $debug_level" if ($debug_level > 0);
38 my $client_arg = "-ORBIIOPClientPortBase $port -ORBIIOPClientPortSpan $width"
39 . " -k file://$client_iorfile";
40 $client_arg .= " -ORBdebuglevel $cdebug_level" if ($cdebug_level > 0);
42 $SV = $server->CreateProcess ("server", $server_arg);
43 $server_status = $SV->Spawn ();
45 if ($server_status != 0) {
46 print STDERR "ERROR: server returned $server_status\n";
47 exit 1;
50 if ($server->WaitForFileTimed ($iorbase,
51 $server->ProcessStartWaitInterval()) == -1) {
52 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
53 $SV->Kill (); $SV->TimedWait (1);
54 exit 1;
57 if ($server->GetFile ($iorbase) == -1) {
58 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
59 $SV->Kill (); $SV->TimedWait (1);
60 exit 1;
62 if ($client->PutFile ($iorbase) == -1) {
63 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
64 $SV->Kill (); $SV->TimedWait (1);
65 exit 1;
68 for ($i = 0; $i <= $width; $i++) {
69 $args = $client_arg;
70 $args .= " -ORBLogFile clt$i" if ($cdebug_level > 0);
72 $CL[$i] = $client->CreateProcess ("client", $args);
73 $CL[$i]->Spawn ();
76 for ($i = 0; $i <= $width; $i++) {
77 $client_status = $CL[$i]->WaitKill ($client->ProcessStopWaitInterval());
79 if ($client_status == 100) {
80 print STDERR "ERROR: client returned $client_status\n";
81 $status = 1;
83 elsif ($client_status == 1) {
84 print STDERR "client $i caught expected transient\n";
85 $transient++;
89 if ($transient == 0) {
90 $status = 2;
93 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
95 if ($server_status != 0) {
96 print STDERR "ERROR: server returned $server_status\n";
97 $status = 1;
100 $server->DeleteFile($iorbase);
101 $client->DeleteFile($iorbase);
103 exit $status;