Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / tests / Bug_3790_Regression / run_test.pl
blob956bd5c7f7a085c0b735e39bb13887c89cd37460
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 foreach $i (@ARGV) {
14 if ($i eq '-debug') {
15 $debug_level = '10';
19 my $server = PerlACE::TestTarget::create_target (1) || die "Create failed\n";
20 my $server2 = PerlACE::TestTarget::create_target (2) || die "Create failed\n";
22 my $TARGETHOSTNAME = $server2->HostName ();
23 my $port = $server2->RandomPort ();
25 my $iorbase = "server.ior";
26 my $server_iorfile = $server->LocalFile ($iorbase);
27 my $server2_iorfile = $server2->LocalFile ($iorbase);
28 $server->DeleteFile($iorbase);
29 $server2->DeleteFile($iorbase);
31 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
32 $SV2 = $server2->CreateProcess ("server2",
33 "-k file://$server2_iorfile ".
34 "-ORBListenEndpoints iiop://$TARGETHOSTNAME:$port ".
35 "-a corbaloc:iiop:$TARGETHOSTNAME:$port/SIMPLE_TEST_KEY");
37 print "Starting Server\n";
38 $server_status = $SV->Spawn ();
40 if ($server_status != 0) {
41 print STDERR "ERROR: server returned $server_status\n";
42 exit 1;
45 if ($server->WaitForFileTimed ($iorbase,
46 $server->ProcessStartWaitInterval()) == -1) {
47 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
48 $SV->Kill (); $SV->TimedWait (1);
49 exit 1;
52 if ($server->GetFile ($iorbase) == -1) {
53 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
54 $SV->Kill (); $SV->TimedWait (1);
55 exit 1;
57 if ($server2->PutFile ($iorbase) == -1) {
58 print STDERR "ERROR: cannot set file <$server2_iorfile>\n";
59 $SV->Kill (); $SV->TimedWait (1);
60 exit 1;
63 print "Starting Other Server\n";
64 $server2_status = $SV2->Spawn ();
66 if ($server2_status != 0) {
67 print STDERR "ERROR: server2 returned $server2_status\n";
68 $SV->Kill (); $SV->TimedWait (1);
69 exit 1;
72 $server2_status = $SV2->WaitKill ($server2->ProcessStopWaitInterval());
74 if ($server2_status != 0) {
75 print STDERR "ERROR: server2 returned $server2_status\n";
76 $status = 1;
79 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
81 if ($server_status != 0) {
82 print STDERR "ERROR: server returned $server_status\n";
83 $status = 1;
86 $server->DeleteFile($iorbase);
87 $server2->DeleteFile($iorbase);
89 exit $status;