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 = '224.9.9.2';
28 elsif ($i eq '-nommap') {
31 elsif ($i eq '-mtonly') {
36 my $test = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
38 # Variables for command-line arguments to client and server
40 $ns_multicast_port = 10001 + $test->RandomPort();
41 $ns_orb_port = 12000 + $test->RandomPort();
44 $persistent_ior_file = "pns.ior";
45 $persistent_log_file = "test_log";
47 $data_file = "test_run.data";
49 ## Allow the user to determine where the persistent file will be located
50 ## just in case the current directory is not suitable for locking.
51 ## We can't change the name of the persistent file because that is not
52 ## sufficient to work around locking problems for Tru64 when the current
53 ## directory is NFS mounted from a system that does not properly support
55 foreach my $possible ($ENV{TMPDIR
}, $ENV{TEMP
}, $ENV{TMP
}) {
56 if (defined $possible && -d
$possible) {
57 if (chdir($possible)) {
63 $test_log = $test->LocalFile ($data_file);
64 $test->DeleteFile ($data_file);
66 #Files which used by test
67 my $test_iorfile = $test->LocalFile ($iorfile);
68 my $test_persistent_log_file = $test->LocalFile ($persistent_log_file);
69 my $test_persistent_ior_file = $test->LocalFile ($persistent_ior_file);
71 $test->DeleteFile($persistent_ior_file);
72 $test->DeleteFile($iorfile);
73 $test->DeleteFile($persistent_log_file);
77 my $args = "-ORBMulticastDiscoveryEndpoint $multicast:$ns_multicast_port -o $test_iorfile -m 1 @_";
78 my $prog = "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming";
80 $SV = $test->CreateProcess ("$prog", "$args");
82 $test->DeleteFile($iorfile);
86 if ($test->WaitForFileTimed ($iorfile,
87 $test->ProcessStartWaitInterval()) == -1) {
88 print STDERR
"ERROR: cannot find file <$test_iorfile>\n";
89 $SV->Kill (); $SV->TimedWait (1);
99 my $prog = "$ENV{TAO_ROOT}/orbsvcs/tests/Simple_Naming/client";
101 $CL = $test->CreateProcess ("$prog", "$args");
103 $client_status = $CL->SpawnWaitKill ($test->ProcessStartWaitInterval() + 45);
105 if ($client_status != 0) {
106 print STDERR
"ERROR: client returned $client_status\n";
112 ## The options below have been reordered due to a
113 ## initialization problem (within the Naming_Service)
114 ## that has only been seen on Windows XP.
118 # Options for all simple tests recognized by the 'client' program.
119 @opts = ("-s -ORBInitRef NameService=file://$test_iorfile",
120 "-p $test_persistent_ior_file -ORBInitRef NameService=file://$test_iorfile",
121 "-s -ORBInitRef NameService=mcast://$multicast:$ns_multicast_port\::/NameService",
122 "-t -ORBInitRef NameService=file://$test_iorfile",
123 "-i -ORBInitRef NameService=file://$test_iorfile",
124 "-e -ORBInitRef NameService=file://$test_iorfile",
125 "-y -ORBInitRef NameService=file://$test_iorfile",
126 "-c file://$test_persistent_ior_file -ORBInitRef NameService=file://$test_iorfile",
129 $hostname = $test->HostName ();
131 @server_opts = ("-t 30",
132 "-ORBEndpoint iiop://$hostname:$ns_orb_port -f $test_persistent_log_file",
134 "-ORBEndpoint iiop://$hostname:$ns_orb_port -f $test_persistent_log_file",
137 @comments = ("Simple Test: \n",
138 "mmap() Persistent Test (Part 1): \n",
139 "Simple Test (using multicast to locate the server): \n",
142 "Exceptions Test: \n",
144 "mmap() Persistent Test (Part 2): \n",
149 print "INFO: Running the test in ", getcwd
(), "\n";
151 # Run server and client for each of the tests. Client uses ior in a
152 # file to bootstrap to the server.
154 if (index($comments[$test_number],"mmap") != -1 && $skip_mmap == 1) {
155 print STDERR
"\n *** skipping ".$comments[$test_number];
158 name_server
($server_opts[$test_number]);
159 print STDERR
"\n ".$comments[$test_number];
163 ## For some reason, only on Windows XP, we need to
164 ## wait before starting another tao_cosnaming when
165 ## the mmap persistence option is used
166 if ($^O
eq "MSWin32") {
172 $test->DeleteFile($persistent_ior_file);
173 $test->DeleteFile($persistent_log_file);
174 $test->DeleteFile($iorfile);
180 # Now run the multithreaded test, sending output to the file.
181 print STDERR
"\n Multithreaded Test:\n";
182 $test->DeleteFile ($data_file);
185 client
("-ORBInitRef NameService=file://$test_iorfile -ORBLogFile $test_log", "-m15");
189 $errors = system ("perl $startdir/process-m-output.pl $test_log 15") >> 8;
195 print STDERR
"Errors Detected, printing output\n";
196 if (open (DATA
, "<$test_log")) {
197 print STDERR
"================================= Begin\n";
199 print STDERR
"================================= End\n";
203 print STDERR
"ERROR: Could not open $test_log\n";
205 $test->DeleteFile ($data_file);
209 $test->DeleteFile($iorfile);
212 ##############################################################################
215 common_tests
() if (!$mt_only);