Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Property / run_test.pl
blob196bdb80bd742d6d7dcf4367bc8f24574704bf85
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 $n_service = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $server = 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 $sleeptime = 6;
25 my $server_iorfile = $server->LocalFile ($iorbase);
26 my $client_iorfile = $client->LocalFile ($iorbase);
27 my $n_service_iorfile = $n_service->LocalFile($iorbase);
28 $server->DeleteFile($iorbase);
29 $client->DeleteFile($iorbase);
30 $n_service->DeleteFile($iorbase);
32 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level ".
33 "-ORBInitRef NameService=file://$server_iorfile");
34 $CL = $client->CreateProcess ("client", "-ORBInitRef NameService=file://$client_iorfile");
35 $NS = $n_service->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming", "-o $n_service_iorfile");
37 print STDERR "Starting tao_cosnaming\n";
39 $n_service_status = $NS->Spawn ();
41 if ($n_service->WaitForFileTimed ($iorbase,
42 $n_service->ProcessStartWaitInterval()) == -1) {
43 print STDERR "ERROR: cannot find file <$n_service_iorfile>\n";
44 $NS->Kill (); $NS->TimedWait (1);
45 exit 1;
48 if ($n_service->GetFile ($iorbase) == -1) {
49 print STDERR "ERROR: cannot retrieve file <$n_service_iorfile>\n";
50 $NS->Kill (); $NS->TimedWait (1);
51 exit 1;
54 if ($server->PutFile ($iorbase) == -1) {
55 print STDERR "ERROR: cannot set file <$server_iorfile>\n";
56 $NS->Kill (); $NS->TimedWait (1);
57 exit 1;
60 if ($client->PutFile ($iorbase) == -1) {
61 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
62 $NS->Kill (); $NS->TimedWait (1);
63 exit 1;
66 print STDERR "Starting Server\n";
68 $server_status = $SV->Spawn ();
70 if ($server_status != 0) {
71 print STDERR "ERROR: server returned $server_status\n";
72 $NS->Kill (); $NS->TimedWait (1);
73 exit 1;
76 sleep $sleeptime;
78 print STDERR "Starting Client\n";
80 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
82 if ($client_status != 0) {
83 print STDERR "ERROR: client returned $client_status\n";
84 $status = 1;
87 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
89 if ($server_status != 0) {
90 print STDERR "ERROR: server returned $server_status\n";
91 $status = 1;
94 $n_service_status = $NS->TerminateWaitKill ($n_service->ProcessStopWaitInterval());
96 if ($n_service_status != 0) {
97 print STDERR "ERROR: n_server returned $n_service_status\n";
98 $status = 1;
101 $n_service->DeleteFile($iorbase);
102 $server->DeleteFile($iorbase);
103 $client->DeleteFile($iorbase);
105 exit $status;