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 # number of threads to use for multithreaded clients or servers
17 # amount of delay between running the servers
30 for ($i = 0; $i <= $#ARGV; $i++) {
31 if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
32 print "run_test [-n num] [-d level] [-h] [-nt] [-cm] [-sm]\n";
34 print "-n num -- runs the client num times\n";
35 print "-d level -- runs each at debug level <level>\n";
36 print "-h -- prints this information\n";
37 print "-nt num -- number of threads in the client (twice for server)\n";
38 print " make sure this is before any -cm or -sm\n";
39 print "-cm -- use more than one thread in the client\n";
40 print "-sm -- use more than one thread in the server\n";
41 print "-debug -- runs server with -ORBDebugLevel 10\n";
44 elsif ($ARGV[$i] eq "-n") {
48 elsif ($ARGV[$i] eq "-nt") {
49 $num_threads = $ARGV[$i + 1];
52 elsif ($ARGV[$i] eq "-debug") {
53 $debug = $debug." -d $ARGV[$i + 1]";
56 elsif ($ARGV[$i] eq "-cm") {
57 $cm = "-n ".$num_threads;
59 elsif ($ARGV[$i] eq "-sm") {
60 $sm = "-n ".($num_threads * 3);
62 elsif ($ARGV[$i] eq "-debug") {
67 my $nstarget = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
68 my $lctarget = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
69 my $svtarget = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
70 my $fftarget = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
71 my $gftarget = PerlACE
::TestTarget
::create_target
(5) || die "Create target 5 failed\n";
72 my $cltarget = PerlACE
::TestTarget
::create_target
(6) || die "Create target 6 failed\n";
74 my $nsiorbase = "ns.ior";
75 my $nstarget_nsiorfile = $nstarget->LocalFile ($nsiorbase);
76 my $lctarget_nsiorfile = $lctarget->LocalFile ($nsiorbase);
77 my $svtarget_nsiorfile = $svtarget->LocalFile ($nsiorbase);
78 my $fftarget_nsiorfile = $fftarget->LocalFile ($nsiorbase);
79 my $gftarget_nsiorfile = $gftarget->LocalFile ($nsiorbase);
80 my $cltarget_nsiorfile = $cltarget->LocalFile ($nsiorbase);
81 $nstarget->DeleteFile($nsiorbase);
82 $lctarget->DeleteFile($nsiorbase);
83 $svtarget->DeleteFile($nsiorbase);
84 $fftarget->DeleteFile($nsiorbase);
85 $gftarget->DeleteFile($nsiorbase);
86 $cltarget->DeleteFile($nsiorbase);
88 # Programs that are run
90 $NS = $nstarget->CreateProcess (
91 "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
92 "-o $nstarget_nsiorfile");
93 $LC = $lctarget->CreateProcess (
94 "$ENV{TAO_ROOT}/orbsvcs/LifeCycle_Service/tao_coslifecycle",
95 "$debug -ORBInitRef NameService=file://$lctarget_nsiorfile");
97 $SV = $svtarget->CreateProcess (
99 "$debug $sm -ORBDebugLevel $debug_level ".
100 "-ORBInitRef NameService=file://$svtarget_nsiorfile");
101 $FF = $fftarget->CreateProcess (
103 "$debug -ORBInitRef NameService=file://$fftarget_nsiorfile");
104 $GF = $gftarget->CreateProcess (
106 "-l $debug -ORBInitRef NameService=file://$gftarget_nsiorfile");
107 $CL = $cltarget->CreateProcess (
109 "-l $debug $cm -ORBInitRef NameService=file://$cltarget_nsiorfile");
111 $ns_status = $NS->Spawn ();
113 if ($ns_status != 0) {
114 print STDERR
"ERROR: tao_cosnaming returned $ns_status\n";
118 if ($nstarget->WaitForFileTimed ($nsiorbase,
119 $nstarget->ProcessStartWaitInterval()) == -1) {
120 print STDERR
"ERROR: cannot find file <$nstarget_nsiorfile>\n";
121 $NS->Kill (); $NS->TimedWait (1);
124 if ($nstarget->GetFile ($nsiorbase) == -1) {
125 print STDERR
"ERROR: cannot retrieve file <$nstarget_nsiorfile>\n";
126 $NS->Kill (); $NS->TimedWait (1);
129 if ($lctarget->PutFile ($nsiorbase) == -1) {
130 print STDERR
"ERROR: cannot set file <$lctarget_nsiorfile>\n";
131 $NS->Kill (); $NS->TimedWait (1);
134 if ($svtarget->PutFile ($nsiorbase) == -1) {
135 print STDERR
"ERROR: cannot set file <$svtarget_nsiorfile>\n";
136 $NS->Kill (); $NS->TimedWait (1);
139 if ($fftarget->PutFile ($nsiorbase) == -1) {
140 print STDERR
"ERROR: cannot set file <$fftarget_nsiorfile>\n";
141 $NS->Kill (); $NS->TimedWait (1);
144 if ($gftarget->PutFile ($nsiorbase) == -1) {
145 print STDERR
"ERROR: cannot set file <$gftarget_nsiorfile>\n";
146 $NS->Kill (); $NS->TimedWait (1);
149 if ($cltarget->PutFile ($nsiorbase) == -1) {
150 print STDERR
"ERROR: cannot set file <$cltarget_nsiorfile>\n";
151 $NS->Kill (); $NS->TimedWait (1);
155 $lc_status = $LC->Spawn ();
157 if ($lc_status != 0) {
158 print STDERR
"ERROR: tao_coslifecycle returned $lc_status\n";
159 $NS->Kill (); $NS->TimedWait (1);
164 $sv_status = $SV->Spawn ();
166 if ($sv_status != 0) {
167 print STDERR
"ERROR: server returned $sv_status\n";
168 $NS->Kill (); $NS->TimedWait (1);
169 $LC->Kill (); $LC->TimedWait (1);
174 $ff_status = $FF->Spawn ();
176 if ($ff_status != 0) {
177 print STDERR
"ERROR: Factory_Finder returned $ff_status\n";
178 $NS->Kill (); $NS->TimedWait (1);
179 $LC->Kill (); $LC->TimedWait (1);
180 $SV->Kill (); $SV->TimedWait (1);
185 $gf_status = $GF->Spawn ();
187 if ($gf_status != 0) {
188 print STDERR
"ERROR: Generic_Factory returned $gf_status\n";
189 $NS->Kill (); $NS->TimedWait (1);
190 $LC->Kill (); $LC->TimedWait (1);
191 $SV->Kill (); $SV->TimedWait (1);
192 $FF->Kill (); $FF->TimedWait (1);
197 for ($j = 1; $j <= $n; ++$j) {
199 $CL->SpawnWaitKill ($cltarget->ProcessStartWaitInterval() + 45);
201 if ($cl_status != 0) {
202 print STDERR
"ERROR: client returned $cl_status\n";
203 $NS->Kill (); $NS->TimedWait (1);
204 $LC->Kill (); $LC->TimedWait (1);
205 $SV->Kill (); $SV->TimedWait (1);
206 $FF->Kill (); $FF->TimedWait (1);
207 $GF->Kill (); $GF->TimedWait (1);
212 $gf_status = $GF->TerminateWaitKill ($gftarget->ProcessStopWaitInterval());
214 if ($gf_status != 0) {
215 print STDERR
"ERROR: Generic_Factory returned $gf_status\n";
219 $ff_status = $FF->TerminateWaitKill ($fftarget->ProcessStopWaitInterval());
221 if ($ff_status != 0) {
222 print STDERR
"ERROR: Factory_Finder returned $ff_status\n";
226 $sv_status = $SV->TerminateWaitKill ($svtarget->ProcessStopWaitInterval());
228 if ($sv_status != 0) {
229 print STDERR
"ERROR: server returned $sv_status\n";
233 $lc_status = $LC->TerminateWaitKill ($lctarget->ProcessStopWaitInterval());
235 if ($lc_status != 0) {
236 print STDERR
"ERROR: tao_coslifecycle returned $lc_status\n";
240 $ns_status = $NS->TerminateWaitKill ($nstarget->ProcessStopWaitInterval());
242 if ($ns_status != 0) {
243 print STDERR
"ERROR: tao_cosnaming returned $ns_status\n";
247 $nstarget->DeleteFile($nsiorbase);
248 $lctarget->DeleteFile($nsiorbase);
249 $svtarget->DeleteFile($nsiorbase);
250 $fftarget->DeleteFile($nsiorbase);
251 $gftarget->DeleteFile($nsiorbase);
252 $cltarget->DeleteFile($nsiorbase);