1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
7 use lib
"$ENV{ACE_ROOT}/bin";
8 use PerlACE
::TestTarget
;
19 my $server1 = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
20 my $server2 = 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 $server2->AddLibPath ('../lib');
24 $client->AddLibPath ('../lib');
26 my $ior1file = "naming.ior";
27 my $ior2file = "notify.ior";
29 #Files which used by server1
30 my $server1_ior1file = $server1->LocalFile ($ior1file);
31 $server1->DeleteFile($ior1file);
33 #Files which used by server2
34 my $server2_ior2file = $server2->LocalFile ($ior2file);
35 $server2->DeleteFile($ior2file);
36 my $server2_ior1file = $server2->LocalFile ($ior1file);
37 $server2->DeleteFile($ior1file);
39 $hostname = $server1->HostName ();
40 $port = $server1->RandomPort ();
43 $SV1 = $server1->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
44 "-ORBdebuglevel $debug_level " .
45 "-ORBEndpoint iiop://$hostname:$port " .
46 "-o $server1_ior1file");
48 $SV2 = $server2->CreateProcess ("server",
51 "-o $server2_ior2file");
53 $CL = $client->CreateProcess ("Consumer",
54 "-ORBdebuglevel $debug_level " .
55 "-ORBInitRef NameService=iioploc://$hostname:$port/NameService");
57 $server_status = $SV1->Spawn ();
59 if ($server_status != 0) {
60 print STDERR
"ERROR: server returned $server_status\n";
65 if ($server1->WaitForFileTimed ($ior1file,
66 $server1->ProcessStartWaitInterval()) == -1) {
67 print STDERR
"ERROR: cannot find file <$server1_ior1file>\n";
68 $SV1->Kill (); $SV1->TimedWait (1);
72 if ($server1->GetFile ($ior1file) == -1) {
73 print STDERR
"ERROR: cannot retrieve file <$server1_ior1file>\n";
74 $SV1->Kill (); $SV1->TimedWait (1);
78 if ($server2->PutFile ($ior1file) == -1) {
79 print STDERR
"ERROR: cannot set file <$server2_ior1file>\n";
80 $SV1->Kill (); $SV1->TimedWait (1);
84 $server_status = $SV2->Spawn ();
86 if ($server_status != 0) {
87 print STDERR
"ERROR: server returned $server_status\n";
88 $SV1->Kill (); $SV1->TimedWait (1);
92 if ($server2->WaitForFileTimed ($ior2file,
93 $server2->ProcessStartWaitInterval()) == -1) {
94 print STDERR
"ERROR: cannot find file <$server2_ior2file>\n";
95 $SV2->Kill (); $SV2->TimedWait (1);
96 $SV1->Kill (); $SV1->TimedWait (1);
100 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
102 if ($client_status != 0) {
103 print STDERR
"ERROR: client returned $client_status\n";
110 $server1->DeleteFile($ior1file);
111 $server2->DeleteFile($ior2file);