Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / DevGuideExamples / NamingService / Naming_Context_Ext / run_test.pl
blob4106868ecc3cfd1ddd4eafb9dd292f96cba544e5
2 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
3 & eval 'exec perl -S $0 $argv:q'
4 if 0;
6 use lib "$ENV{ACE_ROOT}/bin";
7 use PerlACE::TestTarget;
9 $status = 0;
10 $debug_level = '0';
12 foreach $i (@ARGV) {
13 if ($i eq '-debug') {
14 $debug_level = '10';
18 my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
19 my $srv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
20 my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
22 my $nsiorfile = "ns.ior";
23 my $srviorfile = "url.ior";
25 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
26 my $srv_srviorfile = $srv->LocalFile ($srviorfile);
27 my $cli_srviorfile = $cli->LocalFile ($srviorfile);
28 $ns->DeleteFile ($nsiorfile);
29 $srv->DeleteFile ($srviorfile);
30 $cli->DeleteFile ($srviorfile);
32 $hostname = $ns->HostName ();
33 $port = "2809";
35 $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming";
36 $NS = $ns->CreateProcess ($NameService, "-ORBListenEndpoints iiop://$hostname:$port ".
37 " -o $ns_nsiorfile");
38 $SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
39 "-o $srv_srviorfile ".
40 "-h $hostname ".
41 "-p $port ".
42 "-ORBInitRef NameService=iiop://$hostname:$port/NameService");
43 $CLI = $cli->CreateProcess ("MessengerClient", "-k file://$cli_srviorfile ".
44 "-ORBInitRef NameService=iiop://$hostname:$port/NameService");
46 # start Naming Service
47 $NS_status = $NS->Spawn ();
49 if ($NS_status != 0) {
50 print STDERR "ERROR: Name Service returned $NS_status\n";
51 exit 1;
54 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
55 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
56 $NS->Kill (); $NS->TimedWait (1);
57 exit 1;
60 # start MessengerServer
61 $SRV_status = $SRV->Spawn ();
63 if ($SRV_status != 0) {
64 print STDERR "ERROR: Messenger Server returned $SRV_status\n";
65 exit 1;
68 if ($srv->WaitForFileTimed ($srviorfile,$srv->ProcessStartWaitInterval()) == -1) {
69 print STDERR "ERROR: cannot find file <$srv_srviorfile>\n";
70 $NS->Kill (); $NS->TimedWait (1);
71 $SRV->Kill (); $SRV->TimedWait (1);
72 exit 1;
75 if ($srv->GetFile ($srviorfile) == -1) {
76 print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n";
77 $NS->Kill (); $NS->TimedWait (1);
78 $SRV->Kill (); $SRV->TimedWait (1);
79 exit 1;
81 if ($cli->PutFile ($srviorfile) == -1) {
82 print STDERR "ERROR: cannot set file <$cli_srviorfile>\n";
83 $NS->Kill (); $NS->TimedWait (1);
84 $SRV->Kill (); $SRV->TimedWait (1);
85 exit 1;
88 # start MessengerClient
89 $CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
91 if ($CLI_status != 0) {
92 print STDERR "ERROR: Messenger Client failed with status $CLI_status\n";
93 $status = 1;
96 # clean-up
97 $SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
99 if ($SRV_status != 0) {
100 print STDERR "ERROR: Messenger Server returned $SRV_status\n";
101 $status = 1;
104 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
106 if ($NS_status != 0) {
107 print STDERR "ERROR: Name Service returned $NS_status\n";
108 $status = 1;
111 $ns->DeleteFile ($nsiorfile);
112 $srv->DeleteFile ($srviorfile);
113 $cli->DeleteFile ($srviorfile);
115 exit $status;