2 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
3 & eval 'exec perl -S $0 $argv:q'
6 use lib
"$ENV{ACE_ROOT}/bin";
7 use PerlACE
::TestTarget
;
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";
24 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
25 my $srv_nsiorfile = $srv->LocalFile ($nsiorfile);
26 my $cli_nsiorfile = $cli->LocalFile ($nsiorfile);
27 $ns->DeleteFile ($nsiorfile);
28 $srv->DeleteFile ($nsiorfile);
29 $cli->DeleteFile ($nsiorfile);
31 # start Naming Service
32 $NameService = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming";
33 $NS = $ns->CreateProcess ($NameService, " -o $ns_nsiorfile");
34 $SRV = $srv->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
35 "-ORBInitRef NameService=file://$srv_nsiorfile");
36 $CLI = $cli->CreateProcess ("MessengerClient", "-ORBInitRef NameService=file://$cli_nsiorfile");
38 $NS_status = $NS->Spawn ();
40 if ($NS_status != 0) {
41 print STDERR
"ERROR: Name Service returned $NS_status\n";
45 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
46 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
47 $NS->Kill (); $NS->TimedWait (1);
51 if ($ns->GetFile ($nsiorfile) == -1) {
52 print STDERR
"ERROR: cannot retrieve file <$ns_nsiorfile>\n";
53 $NS->Kill (); $NS->TimedWait (1);
56 if ($srv->PutFile ($nsiorfile) == -1) {
57 print STDERR
"ERROR: cannot set file <$srv_nsiorfile>\n";
58 $NS->Kill (); $NS->TimedWait (1);
61 if ($cli->PutFile ($nsiorfile) == -1) {
62 print STDERR
"ERROR: cannot set file <$cli_nsiorfile>\n";
63 $NS->Kill (); $NS->TimedWait (1);
67 # start MessengerServer
68 $SRV_status = $SRV->Spawn ();
70 if ($SRV_status != 0) {
71 print STDERR
"ERROR: Messenger Server returned $SRV_status\n";
75 # start MessengerClient
76 $CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval());
78 if ($CLI_status != 0) {
79 print STDERR
"ERROR: Messenger Client returned $CLI_status\n";
84 $SRV_status = $SRV->TerminateWaitKill ($srv->ProcessStopWaitInterval());
86 if ($SRV_status != 0) {
87 print STDERR
"ERROR: Messenger Server returned $SRV_status\n";
91 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
93 if ($NS_status != 0) {
94 print STDERR
"ERROR: Name Service returned $NS_status\n";
98 $ns->DeleteFile ($nsiorfile);
99 $srv->DeleteFile ($nsiorfile);
100 $cli->DeleteFile ($nsiorfile);