Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / examples / Log / Basic / run_test.pl
blobd5684ec509fc3bd7a376630f5d9d9bd120daacf2
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 $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $ls = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $cli = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 $nsiorfile = "ns.ior";
25 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
26 my $ls_nsiorfile = $ls->LocalFile ($nsiorfile);
27 my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
28 $ns->DeleteFile ($nsiorfile);
29 $ls->DeleteFile ($nsiorfile);
30 $cli->DeleteFile ($nsiorfile);
33 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
34 " -o $ns_nsiorfile");
35 $LS = $ls->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Logging_Service/Basic_Logging_Service/tao_tls_basic",
36 " -ORBInitRef NameService=file://$ls_nsiorfile");
37 $CLI = $cli->CreateProcess ("client",
38 "-ORBInitRef NameService=file://$cli_nsiorfile");
40 print STDERR "Starting Naming Service\n";
42 $NS_status = $NS->Spawn ();
44 if ($NS_status != 0) {
45 print STDERR "ERROR: Name Service returned $NS_status\n";
46 exit 1;
49 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
50 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
51 $NS->Kill (); $NS->TimedWait (1);
52 exit 1;
55 if ($ns->GetFile ($nsiorfile) == -1) {
56 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
57 $NS->Kill (); $NS->TimedWait (1);
58 exit 1;
60 if ($ls->PutFile ($nsiorfile) == -1) {
61 print STDERR "ERROR: cannot set file <$ls_nsiorfile>\n";
62 $NS->Kill (); $NS->TimedWait (1);
63 exit 1;
65 if ($cli->PutFile ($nsiorfile) == -1) {
66 print STDERR "ERROR: cannot set file <$cli_nsiorfile>\n";
67 $NS->Kill (); $NS->TimedWait (1);
68 exit 1;
71 print STDERR "Starting Logging Service\n";
73 $LS_status = $LS->Spawn ();
75 if ($LS_status != 0) {
76 print STDERR "ERROR: LOgging Service returned $LS_status\n";
77 $LS->Kill (); $LS->TimedWait (1);
78 $NS->Kill (); $NS->TimedWait (1);
79 exit 1;
82 # Give time for logging service to initialize and install its object
83 # reference in the nameing service.
84 sleep (5);
86 print STDERR "Starting client\n";
88 $CLI_status = $CLI->Spawn ();
89 if ($CLI_status != 0) {
90 print STDERR "ERROR: Client returned $CLI_status\n";
91 $status = 1;
94 $CLI_status = $CLI->WaitKill ($cli->ProcessStopWaitInterval());
95 if ($CLI_status != 0) {
96 print STDERR "ERROR: Client returned $CLI_status\n";
97 $status = 1;
100 $LS_status = $LS->TerminateWaitKill ($ls->ProcessStopWaitInterval());
102 if ($LS_status != 0) {
103 print STDERR "ERROR: Logging Service returned $LS_status\n";
104 $status = 1;
107 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
109 if ($NS_status != 0) {
110 print STDERR "ERROR: Name Service returned $NS_status\n";
111 $status = 1;
114 $ns->DeleteFile ($nsiorfile);
115 $ls->DeleteFile ($nsiorfile);
116 $cli->DeleteFile ($nsiorfile);
118 exit $status;