Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Forwarding / run_test.pl
blob4b7619c677253aca4c20b7c4388b6d4d5648d59e
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 $debug_level = '0';
13 $iterations = '100';
15 foreach $i (@ARGV) {
16 if ($i eq '-debug') {
17 $debug_level = '10';
21 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
22 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
23 my $client2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
25 $port = $server->RandomPort ();
26 $TARGETHOSTNAME = $server->HostName ();
28 my $iorbase = "test.ior";
29 my $server_iorfile = $server->LocalFile ($iorbase);
30 my $client_iorfile = $client->LocalFile ($iorbase);
31 $server->DeleteFile($iorbase);
32 $client->DeleteFile($iorbase);
34 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level " .
35 "-ORBEndpoint iiop://$TARGETHOSTNAME:$port " .
36 "-o $server_iorfile");
38 $CL = $client->CreateProcess ("client",
39 "-i $iterations " .
40 "-k file://$client_iorfile");
41 $CL2 = $client2->CreateProcess ("client",
42 "-x -i $iterations " .
43 "-k corbaloc::$TARGETHOSTNAME:$port/Simple_Server");
45 $server_status = $SV->Spawn ();
47 if ($server_status != 0) {
48 print STDERR "ERROR: server returned $server_status\n";
49 exit 1;
51 if ($server->WaitForFileTimed ($iorbase,
53 $server->ProcessStartWaitInterval()) == -1) {
54 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
55 $SV->Kill (); $SV->TimedWait (1);
56 exit 1;
59 if ($server->GetFile ($iorbase) == -1) {
60 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
61 $SV->Kill (); $SV->TimedWait (1);
62 exit 1;
64 if ($client->PutFile ($iorbase) == -1) {
65 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
66 $SV->Kill (); $SV->TimedWait (1);
67 exit 1;
70 print STDERR "==== Running first test, using full IORs\n";
72 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
74 if ($client_status != 0) {
75 print STDERR "ERROR: client returned $client_status\n";
76 $status = 1;
79 print STDERR "==== Running second test, using corbaloc IORs ($port)\n";
81 $client_status = $CL2->SpawnWaitKill ($client2->ProcessStartWaitInterval() + 45);
83 if ($client_status != 0) {
84 print STDERR "ERROR: client returned $client_status\n";
85 $status = 1;
88 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
90 if ($server_status != 0) {
91 print STDERR "ERROR: server returned $server_status\n";
92 $status = 1;
95 $server->DeleteFile($iorbase);
96 $client->DeleteFile($iorbase);
98 exit $status;