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";
33 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
34 my $sv1_nsiorfile = $sv1->LocalFile ($nsiorfile);
35 my $sv2_nsiorfile = $sv2->LocalFile ($nsiorfile);
36 my $cl_nsiorfile = $cl->LocalFile ($nsiorfile);
37 my $sv1_test1file = $sv1->LocalFile ($test1file);
38 my $sv2_test2file = $sv2->LocalFile ($test2file);
39 $ns->DeleteFile ($nsiorfile);
40 $sv1->DeleteFile ($nsiorfile);
41 $sv2->DeleteFile ($nsiorfile);
42 $cl->DeleteFile ($nsiorfile);
43 $cl->DeleteFile ($inputfile);
44 $sv1->DeleteFile ($test1file);
45 $sv2->DeleteFile ($test2file);
47 # generate test stream data
48 $inputfile = PerlACE
::generate_test_file
($inputfile, 102400);
49 my $cl_inputfile = $cl->LocalFile ($inputfile);
50 if ($cl->PutFile ($inputfile) == -1) {
51 print STDERR
"ERROR: cannot set file <$cl_inputfile>\n";
55 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
57 $SV1 = $sv1->CreateProcess ("server",
58 " -ORBDebugLevel $debug_level ".
59 " -ORBInitRef NameService=file://$sv1_nsiorfile ".
61 $SV2 = $sv2->CreateProcess ("server",
62 " -ORBDebugLevel $debug_level ".
63 " -ORBInitRef NameService=file://$sv2_nsiorfile ".
65 $CL = $cl->CreateProcess ("ftp",
66 " -ORBInitRef NameService=file://$cl_nsiorfile ".
69 print STDERR
"Starting Naming Service\n";
70 $NS_status = $NS->Spawn ();
72 if ($NS_status != 0) {
73 print STDERR
"ERROR: Name Service returned $NS_status\n";
77 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()+45) == -1) {
78 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
79 $NS->Kill (); $NS->TimedWait (1);
83 if ($ns->GetFile ($nsiorfile) == -1) {
84 print STDERR
"ERROR: cannot retrieve file <$ns_nsiorfile>\n";
85 $NS->Kill (); $NS->TimedWait (1);
88 if ($sv1->PutFile ($nsiorfile) == -1) {
89 print STDERR
"ERROR: cannot set file <$sv1_nsiorfile>\n";
90 $NS->Kill (); $NS->TimedWait (1);
93 if ($sv2->PutFile ($nsiorfile) == -1) {
94 print STDERR
"ERROR: cannot set file <$sv2_nsiorfile>\n";
95 $NS->Kill (); $NS->TimedWait (1);
98 if ($cl->PutFile ($nsiorfile) == -1) {
99 print STDERR
"ERROR: cannot set file <$cl_nsiorfile>\n";
100 $NS->Kill (); $NS->TimedWait (1);
104 print STDERR
"Starting Server 1\n";
105 $SV1_status = $SV1->Spawn ();
106 if ($SV1_status != 0) {
107 print STDERR
"ERROR: Server 1 returned $SV1_status\n";
108 $SV1->Kill (); $SV1->TimedWait (1);
109 $NS->Kill (); $NS->TimedWait (1);
114 print STDERR
"Starting Server 2\n";
115 $SV2_status = $SV2->Spawn ();
116 if ($SV2_status != 0) {
117 print STDERR
"ERROR: Server 2 returned $SV2_status\n";
118 $SV2->Kill (); $SV2->TimedWait (1);
119 $SV1->Kill (); $SV1->TimedWait (1);
120 $NS->Kill (); $NS->TimedWait (1);
125 print STDERR
"Starting Client\n";
126 $CL_status = $CL->SpawnWaitKill ($cl->ProcessStartWaitInterval()+45);
127 if ($CL_status != 0) {
128 print STDERR
"ERROR: client returned $CL_status\n";
132 $SV1_status = $SV1->TerminateWaitKill ($sv1->ProcessStopWaitInterval());
133 if ($SV1_status != 0) {
134 print STDERR
"ERROR: server 1 returned $SV1_status\n";
138 $SV2_status = $SV2->TerminateWaitKill ($sv2->ProcessStopWaitInterval());
139 if ($SV2_status != 0) {
140 print STDERR
"ERROR: server 2 returned $SV2_status\n";
144 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
145 if ($NS_status != 0) {
146 print STDERR
"ERROR: Naming Service returned $NS_status\n";
150 $ns->DeleteFile ($nsiorfile);
151 $sv1->DeleteFile ($nsiorfile);
152 $sv2->DeleteFile ($nsiorfile);
153 $cl->DeleteFile ($nsiorfile);
154 $cl->DeleteFile ($inputfile);
155 $sv1->DeleteFile ($test1file);
156 $sv2->DeleteFile ($test2file);