1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
7 # This is a Perl script that runs some Naming Service tests.
8 # It runs all the tests that will run with min CORBA.
9 # It starts all the servers and clients as necessary.
11 use lib
"$ENV{ACE_ROOT}/bin";
12 use PerlACE
::TestTarget
;
15 ## Save the starting directory
17 $multicast = "[ff01::ff01:1]";
23 if ($ARGV[0] eq '-q') {
27 my $test = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
29 # Variables for command-line arguments to client and server
31 $ns_multicast_port = 10001 + $test->RandomPort();
32 $ns_orb_port = 12000 + $test->RandomPort();
35 $persistent_ior_file = "pns.ior";
36 $persistent_log_file = "test_log";
38 $data_file = "test_run.data";
40 ## Allow the user to determine where the persistent file will be located
41 ## just in case the current directory is not suitable for locking.
42 ## We can't change the name of the persistent file because that is not
43 ## sufficient to work around locking problems for Tru64 when the current
44 ## directory is NFS mounted from a system that does not properly support
46 foreach my $possible ($ENV{TMPDIR
}, $ENV{TEMP
}, $ENV{TMP
}) {
47 if (defined $possible && -d
$possible) {
48 if (chdir($possible)) {
54 $test_log = $test->LocalFile ($data_file);
55 $test->DeleteFile ($data_file);
57 #Files which used by test
58 my $test_iorfile = $test->LocalFile ($iorfile);
59 my $test_persistent_log_file = $test->LocalFile ($persistent_log_file);
60 my $test_persistent_ior_file = $test->LocalFile ($persistent_ior_file);
62 $test->DeleteFile($iorfile);
63 $test->DeleteFile($persistent_log_file);
64 $test->DeleteFile($persistent_ior_file);
68 my $args = "-ORBMulticastDiscoveryEndpoint $multicast:$ns_multicast_port -o $test_iorfile -m 1 @_";
69 my $prog = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming";
71 $SV = $test->CreateProcess ("$prog", "$args");
73 $test->DeleteFile($iorfile);
77 if ($test->WaitForFileTimed ($iorfile,
78 $test->ProcessStartWaitInterval()) == -1) {
79 print STDERR
"ERROR: cannot find file <$test_iorfile>\n";
80 $SV->Kill (); $SV->TimedWait (1);
88 my $prog = "$startdir/client";
90 $CL = $test->CreateProcess ("$prog", "$args");
92 $client_status = $CL->SpawnWaitKill ($test->ProcessStartWaitInterval() + 45);
94 if ($client_status != 0) {
95 print STDERR
"ERROR: client returned $client_status\n";
100 ## The options below have been reordered due to a
101 ## initialization problem (within the Naming_Service)
102 ## that has only been seen on Windows XP.
104 # Options for all simple tests recognized by the 'client' program.
105 @opts = ("-s -ORBInitRef NameService=file://$test_iorfile",
106 "-p $test_persistent_ior_file -ORBInitRef NameService=file://$test_iorfile",
107 "-s -ORBInitRef NameService=mcast://$multicast:$ns_multicast_port\::/NameService",
108 "-t -ORBInitRef NameService=file://$test_iorfile",
109 "-i -ORBInitRef NameService=file://$test_iorfile",
110 "-e -ORBInitRef NameService=file://$test_iorfile",
111 "-y -ORBInitRef NameService=file://$test_iorfile",
112 "-c file://$test_persistent_ior_file -ORBInitRef NameService=file://$test_iorfile",
115 $hostname = $test->HostName ();
117 @server_opts = ("-t 30",
118 "-ORBEndpoint iiop://$hostname:$ns_orb_port -f $test_persistent_log_file",
120 "-ORBEndpoint iiop://$hostname:$ns_orb_port -f $test_persistent_log_file",
123 @comments = ("Simple Test: \n",
124 "mmap() Persistent Test (Part 1): \n",
125 "Simple Test (using multicast to locate the server): \n",
128 "Exceptions Test: \n",
130 "mmap() Persistent Test (Part 2): \n",
137 print "INFO: Running the test in ", getcwd
(), "\n";
139 # Run server and client for each of the tests. Client uses ior in a
140 # file to bootstrap to the server.
142 name_server
($server_opts[$test_number]);
144 print STDERR
"\n ".$comments[$test_number];
150 ## For some reason, only on Windows XP, we need to
151 ## wait before starting another tao_cosnaming when
152 ## the mmap persistence option is used
153 if ($^O
eq "MSWin32") {
159 $test->DeleteFile($persistent_ior_file);
160 $test->DeleteFile($persistent_log_file);
161 $test->DeleteFile($iorfile);
163 # Now run the multithreaded test, sending output to the file.
164 print STDERR
"\n Multithreaded Test:\n";
165 $test->DeleteFile ($data_file);
168 client
("-ORBInitRef NameService=file://$test_iorfile -ORBLogFile $test_log", "-m15");
173 $errors = system ("perl $startdir/process-m-output.pl $test_log 15") >> 8;
179 print STDERR
"Errors Detected, printing output\n";
180 if (open (DATA
, "<$test_log")) {
181 print STDERR
"================================= Begin\n";
183 print STDERR
"================================= End\n";
187 print STDERR
"ERROR: Could not open $test_log\n";
189 $test->DeleteFile ($data_file);
193 $test->DeleteFile($iorfile);