3 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
4 & eval 'exec perl -S $0 $argv:q'
9 use lib
"$ENV{ACE_ROOT}/bin";
10 use PerlACE
::TestTarget
;
21 my $ns = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
23 # The NameService IOR file
25 $nsiorfile = "ns.ior";
27 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
28 $ns->DeleteFile ($nsiorfile);
32 $CLI = $ns->CreateProcess ("client");
34 # Fire up the Name Service
36 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
37 "-ORBDebugLevel $debug_level ".
39 $NS_status = $NS->Spawn ();
40 if ($NS_status != 0) {
41 print STDERR
"ERROR: Name Service returned $NS_status\n";
42 $NS->Kill (); $NS->TimedWait (1);
45 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
46 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
47 $NS->Kill (); $NS->TimedWait (1);
52 # Try the client with the name service ior in an environment variable of
53 # the form <service name>IOR.
54 # Expect it to succeed.
56 $ENV {'NameServiceIOR'} = "file://$ns_nsiorfile";
58 $CLI_status = $CLI->SpawnWaitKill ($ns->ProcessStartWaitInterval()+15);
59 if ($CLI_status != 0) {
60 print STDERR
"ERROR: Name Service not resolved by environment variable\n";
61 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
62 if ($NS_status != 0) {
63 print STDERR
"ERROR: Closing Name Service returned $NS_status\n";
65 $ns->DeleteFile ($nsiorfile);
69 # Now try it with a duff ior in the environment variable.
72 $ENV {'NameServiceIOR'} = "Banana";
74 $CLI_status = $CLI->SpawnWaitKill ($ns->ProcessStartWaitInterval()+15);
75 if ($CLI_status != 1) {
76 print STDERR
"ERROR: Name Service resolved with duff environment\n";
77 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
78 if ($NS_status != 0) {
79 print STDERR
"ERROR: Closing Name Service returned $NS_status\n";
81 $ns->DeleteFile ($nsiorfile);
85 # Now try with a duff ior in the environment variable but overridden by
86 # a command line parameter.
87 # Expect it to succeed.
89 $ENV {'NameServiceIOR'} = "Custard";
90 $CLI->Arguments("-ORBInitRef NameService=file://$ns_nsiorfile");
91 $CLI_status = $CLI->SpawnWaitKill ($ns->ProcessStartWaitInterval()+15);
92 if ($CLI_status != 0) {
93 print STDERR
"ERROR: Name Service not resolved by command line override\n";
94 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
95 if ($NS_status != 0) {
96 print STDERR
"ERROR: Closing Name Service returned $NS_status\n";
98 $ns->DeleteFile ($nsiorfile);
102 # Clean up and return
104 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
105 if ($NS_status != 0) {
106 print STDERR
"ERROR: Closing Name Service returned $NS_status\n";
110 $ns->DeleteFile ($nsiorfile);