Merge pull request #2318 from jwillemsen/jwi-add_forward_profiles
[ACE_TAO.git] / TAO / orbsvcs / tests / Log / Basic_Log_Test / run_test.pl
blob07d6a0fcd9fd16597e159f37fc6eb1a8a6dcfca1
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_service = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $lg_service = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $client = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 my $iorbase = "ns.ior";
24 my $ns_iorfile = $ns_service->LocalFile ($iorbase);
25 my $lg_iorfile = $lg_service->LocalFile ($iorbase);
26 my $client_iorfile = $client->LocalFile ($iorbase);
27 $ns_service->DeleteFile ($iorbase);
28 $lg_service->DeleteFile ($iorbase);
29 $client->DeleteFile ($iorbase);
31 $NS = $ns_service->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
32 "-o $ns_iorfile");
33 $LS = $lg_service->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Logging_Service/Basic_Logging_Service/tao_tls_basic",
34 "-ORBInitRef NameService=file://$lg_iorfile");
35 $CL = $client->CreateProcess ("client", "-ORBInitRef NameService=file://$client_iorfile");
37 print STDERR "Starting Naming Service\n";
39 $process_status = $NS->Spawn ();
41 if ($process_status != 0) {
42 print STDERR "ERROR: naming service returned $process_status\n";
43 exit 1;
46 if ($ns_service->WaitForFileTimed ($iorbase,
47 $ns_service->ProcessStartWaitInterval()) == -1) {
48 print STDERR "ERROR: cannot find file <$ns_iorfile>\n";
49 $NS->Kill (); $NS->TimedWait (1);
50 exit 1;
53 if ($ns_service->GetFile ($iorbase) == -1) {
54 print STDERR "ERROR: cannot retrieve file <$ns_iorfile>\n";
55 $NS->Kill (); $NS->TimedWait (1);
56 exit 1;
59 if ($lg_service->PutFile ($iorbase) == -1) {
60 print STDERR "ERROR: cannot set file <$lg_iorfile>\n";
61 $NS->Kill (); $NS->TimedWait (1);
62 exit 1;
65 if ($client->PutFile ($iorbase) == -1) {
66 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
67 $NS->Kill (); $NS->TimedWait (1);
68 exit 1;
71 print STDERR "Starting Logging Service\n";
73 $process_status = $LS->Spawn ();
75 if ($process_status != 0) {
76 print STDERR "ERROR: logging service returned $process_status\n";
77 $NS->Kill (); $NS->TimedWait (1);
78 exit 1;
81 # Give time for logging service to initialize and install its object
82 # reference in the nameing service.
83 sleep (10);
85 print STDERR "Starting client\n";
87 $process_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
89 if ($process_status != 0) {
90 print STDERR "ERROR: client returned $process_status\n";
91 $status = 1;
94 $NS->Kill ();
95 $LS->Kill ();
97 $ns_service->DeleteFile ($iorbase);
98 $lg_service->DeleteFile ($iorbase);
99 $client->DeleteFile ($iorbase);
101 exit $status;