Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / orbsvcs / tests / BiDir_CORBALOC / run_test.pl
blob4d864c5e00a5efef565e5d2e2ffec8d6c7b61b50
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 # This is a Perl script that runs some Naming Service tests.
8 # It runs all the tests that will run with min CORBA.
9 # It starts all the servers and clients as necessary.
11 use lib "$ENV{ACE_ROOT}/bin";
12 use PerlACE::TestTarget;
14 $status = 0;
15 $debug_level = '0';
17 foreach $i (@ARGV) {
18 if ($i eq '-debug') {
19 $debug_level = '10';
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 $orb_port = $server->RandomPort();
27 my $host = $server->HostName();
28 my $iorbase = "test.ior";
29 my $server_iorfile = $server->LocalFile ($iorbase);
30 $server->DeleteFile($iorbase);
32 $SV = $server->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
33 "-ORBEndpoint iiop://$host:$orb_port -o $server_iorfile");
34 $CL = $client->CreateProcess ("TimeServer",
35 "-ORBInitRef NameService=corbaloc:iiop:$host:$orb_port/NameService");
37 $server_status = $SV->Spawn ();
39 if ($server_status != 0) {
40 print STDERR "ERROR: server returned $server_status\n";
41 exit 1;
44 if ($server->WaitForFileTimed ($iorbase,
45 $server->ProcessStartWaitInterval()) == -1) {
46 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
47 $SV->Kill (); $SV->TimedWait (1);
48 exit 1;
51 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 285);
53 if ($client_status != 0) {
54 print STDERR "ERROR: client returned $client_status\n";
55 $status = 1;
58 $SV->Kill ();
60 $server->DeleteFile($iorbase);
62 exit $status;