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
;
13 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
14 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
15 my $ns_service = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
17 my $host = $ns_service->HostName();
18 my $server_port = 8088;
21 my $srv_conf = "outside.conf";
22 my $srv_ior = "server.ior";
23 my $ns_ior = "ns.ior";
25 my $ns_service_srv_conf = $ns_service->LocalFile($srv_conf);
26 my $server_srv_conf = $server->LocalFile($srv_conf);
27 my $client_srv_ior = $client->LocalFile ($srv_ior);
28 my $ns_service_ns_ior = $ns_service->LocalFile($ns_ior);
29 my $server_ns_ior = $ns_service->LocalFile($ns_ior);
30 my $server_srv_ior = $server->LocalFile ($srv_ior);
32 $ns_service->DeleteFile($ns_ior);
33 $server->DeleteFile($ns_ior);
34 $server->DeleteFile($srv_ior);
35 $client->DeleteFile($srv_ior);
37 $client_param_ior = "file://$client_srv_ior";
39 if ($i eq '-corbaloc') {
40 $client_param_ior = "corbaloc:htiop:$host:$server_port/HelloObj";
42 elsif ($i eq '-corbaname') {
43 $client_param_ior = "corbaname:htiop:$host:$name_port#HelloObj";
46 elsif ($i eq '-debug') {
51 $NS = $ns_service->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
52 "-ORBSvcConf $ns_service_srv_conf -ORBEndpoint \"iiop://;".
53 "htiop://$host:$name_port\" -o $ns_service_ns_ior");
55 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_srv_ior ".
56 "-ORBInitRef NameService=file://$server_ns_ior ".
57 "-ORBSvcConf $server_srv_conf ".
58 "-ORBEndpoint htiop://$host:$server_port");
60 $CL = $client->CreateProcess ("client", "-k $client_param_ior");
62 $NS->IgnoreExeSubDir ();
64 $server_status = $NS->Spawn ();
66 if ($server_status != 0) {
67 print STDERR
"ERROR: naming service returned $server_status\n";
71 if ($ns_service->WaitForFileTimed ($ns_ior,
72 $ns_service->ProcessStartWaitInterval()) == -1) {
73 print STDERR
"ERROR: cannot find file <$ns_service_ns_ior>\n";
74 $NS->Kill (); $NS->TimedWait (1);
78 if ($ns_service->GetFile ($ns_ior) == -1) {
79 print STDERR
"ERROR: cannot retrieve file <$ns_service_ns_ior>\n";
80 $NS->Kill (); $NS->TimedWait (1);
84 if ($server->PutFile ($ns_ior) == -1) {
85 print STDERR
"ERROR: cannot set file <$server_ns_ior>\n";
86 $NS->Kill (); $NS->TimedWait (1);
90 print "Waiting for server to start\n";
91 $server_status = $SV->Spawn ();
92 if ($server_status != 0) {
93 print STDERR
"ERROR: server returned $server_status\n";
94 $NS->Kill (); $NS->TimedWait (1);
98 if ($server->WaitForFileTimed ($srv_ior,
99 $server->ProcessStartWaitInterval()) == -1) {
100 print STDERR
"ERROR: cannot find file <$server_srv_ior>\n";
101 $SV->Kill (); $SV->TimedWait (1);
102 $NS->Kill (); $NS->TimedWait (1);
106 if ($server->GetFile ($srv_ior) == -1) {
107 print STDERR
"ERROR: cannot retrieve file <$server_srv_ior>\n";
108 $SV->Kill (); $SV->TimedWait (1);
109 $NS->Kill (); $NS->TimedWait (1);
113 if ($client->PutFile ($srv_ior) == -1) {
114 print STDERR
"ERROR: cannot set file <$client_srv_ior>\n";
115 $SV->Kill (); $SV->TimedWait (1);
116 $NS->Kill (); $NS->TimedWait (1);
120 print "Running Client\n";
121 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 285);
123 if ($client_status != 0) {
124 print STDERR
"ERROR: client returned $client_status\n";
128 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
130 if ($server_status != 0) {
131 print STDERR
"ERROR: server returned $server_status\n";
138 $ns_service->DeleteFile($ns_ior);
139 $server->DeleteFile($ns_ior);
140 $server->DeleteFile($srv_ior);
141 $client->DeleteFile($srv_ior);