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
;
20 my $ns = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
21 my $sv1 = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
22 my $sv2 = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
23 my $cl = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
25 # amount of delay between running the servers
28 $nsiorfile = "ns.ior";
31 $inputfile = "test_input";
32 $conffile = "components_svc".$PerlACE::svcconf_ext
;
34 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
35 my $sv1_nsiorfile = $sv1->LocalFile ($nsiorfile);
36 my $sv2_nsiorfile = $sv2->LocalFile ($nsiorfile);
37 my $cl_nsiorfile = $cl->LocalFile ($nsiorfile);
38 my $sv1_test1file = $sv1->LocalFile ($test1file);
39 my $sv2_test2file = $sv2->LocalFile ($test2file);
40 my $cl_conffile = $cl->LocalFile ($conffile);
41 $ns->DeleteFile ($nsiorfile);
42 $sv1->DeleteFile ($nsiorfile);
43 $sv2->DeleteFile ($nsiorfile);
44 $cl->DeleteFile ($nsiorfile);
45 $cl->DeleteFile ($inputfile);
46 $sv1->DeleteFile ($test1file);
47 $sv2->DeleteFile ($test2file);
49 # generate test stream data
50 # the size of this file is limited by the maximum packet size
51 # windows has a maximum size of 8KB
52 $inputfile = PerlACE
::generate_test_file
($inputfile, 32000);
53 my $cl_inputfile = $cl->LocalFile ($inputfile);
54 if ($cl->PutFile ($inputfile) == -1) {
55 print STDERR
"ERROR: cannot set file <$cl_inputfile>\n";
59 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
61 $SV1 = $sv1->CreateProcess ("server",
62 " -ORBDebugLevel $debug_level ".
63 " -ORBInitRef NameService=file://$sv1_nsiorfile ".
65 $SV2 = $sv2->CreateProcess ("server",
66 " -ORBDebugLevel $debug_level ".
67 " -ORBInitRef NameService=file://$sv2_nsiorfile ".
69 $CL = $cl->CreateProcess ("ftp",
70 "-ORBSvcConf $cl_conffile ".
71 " -ORBInitRef NameService=file://$cl_nsiorfile ".
74 print STDERR
"Starting Naming Service\n";
75 $NS_status = $NS->Spawn ();
77 if ($NS_status != 0) {
78 print STDERR
"ERROR: Name Service returned $NS_status\n";
82 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()+45) == -1) {
83 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
84 $NS->Kill (); $NS->TimedWait (1);
88 if ($ns->GetFile ($nsiorfile) == -1) {
89 print STDERR
"ERROR: cannot retrieve file <$ns_nsiorfile>\n";
90 $NS->Kill (); $NS->TimedWait (1);
93 if ($sv1->PutFile ($nsiorfile) == -1) {
94 print STDERR
"ERROR: cannot set file <$sv1_nsiorfile>\n";
95 $NS->Kill (); $NS->TimedWait (1);
98 if ($sv2->PutFile ($nsiorfile) == -1) {
99 print STDERR
"ERROR: cannot set file <$sv2_nsiorfile>\n";
100 $NS->Kill (); $NS->TimedWait (1);
103 if ($cl->PutFile ($nsiorfile) == -1) {
104 print STDERR
"ERROR: cannot set file <$cl_nsiorfile>\n";
105 $NS->Kill (); $NS->TimedWait (1);
109 print STDERR
"Starting Server 1\n";
110 $SV1_status = $SV1->Spawn ();
111 if ($SV1_status != 0) {
112 print STDERR
"ERROR: Server 1 returned $SV1_status\n";
113 $SV1->Kill (); $SV1->TimedWait (1);
114 $NS->Kill (); $NS->TimedWait (1);
119 print STDERR
"Starting Server 2\n";
120 $SV2_status = $SV2->Spawn ();
121 if ($SV2_status != 0) {
122 print STDERR
"ERROR: Server 2 returned $SV2_status\n";
123 $SV2->Kill (); $SV2->TimedWait (1);
124 $SV1->Kill (); $SV1->TimedWait (1);
125 $NS->Kill (); $NS->TimedWait (1);
130 print STDERR
"Starting Client\n";
131 $CL_status = $CL->SpawnWaitKill ($cl->ProcessStartWaitInterval()+185);
132 if ($CL_status != 0) {
133 print STDERR
"ERROR: client returned $CL_status\n";
137 $SV1_status = $SV1->TerminateWaitKill ($sv1->ProcessStopWaitInterval());
138 if ($SV1_status != 0) {
139 print STDERR
"ERROR: server 1 returned $SV1_status\n";
143 $SV2_status = $SV2->TerminateWaitKill ($sv2->ProcessStopWaitInterval());
144 if ($SV2_status != 0) {
145 print STDERR
"ERROR: server 2 returned $SV2_status\n";
149 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
150 if ($NS_status != 0) {
151 print STDERR
"ERROR: Naming Service returned $NS_status\n";
155 $ns->DeleteFile ($nsiorfile);
156 $sv1->DeleteFile ($nsiorfile);
157 $sv2->DeleteFile ($nsiorfile);
158 $cl->DeleteFile ($nsiorfile);
159 $cl->DeleteFile ($inputfile);
160 $sv1->DeleteFile ($test1file);
161 $sv2->DeleteFile ($test2file);