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 $sv = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
22 my $cl = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
24 # amount of delay between running the servers
27 $nsiorfile = "ns.ior";
28 $outputfile = "output";
29 $inputfile = "test_input";
31 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
32 my $sv_nsiorfile = $sv->LocalFile ($nsiorfile);
33 my $cl_nsiorfile = $cl->LocalFile ($nsiorfile);
34 my $sv_outputfile = $sv->LocalFile ($outputfile);
35 $ns->DeleteFile ($nsiorfile);
36 $sv->DeleteFile ($nsiorfile);
37 $cl->DeleteFile ($nsiorfile);
38 $cl->DeleteFile ($inputfile);
39 $sv->DeleteFile ($outputfile);
41 # generate test stream data
42 $inputfile = PerlACE
::generate_test_file
($inputfile, 102400);
43 my $cl_inputfile = $cl->LocalFile ($inputfile);
44 if ($cl->PutFile ($inputfile) == -1) {
45 print STDERR
"ERROR: cannot set file <$cl_inputfile>\n";
49 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
51 $SV = $sv->CreateProcess ("receiver",
52 " -ORBDebugLevel $debug_level ".
53 " -ORBInitRef NameService=file://$sv_nsiorfile ".
55 $CL = $cl->CreateProcess ("sender",
57 " -ORBInitRef NameService=file://$cl_nsiorfile ".
58 "-f $cl_inputfile -r 2");
60 print STDERR
"Starting Naming Service\n";
61 $NS_status = $NS->Spawn ();
63 if ($NS_status != 0) {
64 print STDERR
"ERROR: Name Service returned $NS_status\n";
68 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()+45) == -1) {
69 print STDERR
"ERROR: cannot find file <$ns_nsiorfile>\n";
70 $NS->Kill (); $NS->TimedWait (1);
74 if ($ns->GetFile ($nsiorfile) == -1) {
75 print STDERR
"ERROR: cannot retrieve file <$ns_nsiorfile>\n";
76 $NS->Kill (); $NS->TimedWait (1);
79 if ($sv->PutFile ($nsiorfile) == -1) {
80 print STDERR
"ERROR: cannot set file <$sv_nsiorfile>\n";
81 $NS->Kill (); $NS->TimedWait (1);
84 if ($cl->PutFile ($nsiorfile) == -1) {
85 print STDERR
"ERROR: cannot set file <$cl_nsiorfile>\n";
86 $NS->Kill (); $NS->TimedWait (1);
90 print STDERR
"Starting Receiver\n";
91 $SV_status = $SV->Spawn ();
92 if ($SV_status != 0) {
93 print STDERR
"ERROR: Receiver returned $SV_status\n";
94 $SV->Kill (); $SV->TimedWait (1);
95 $NS->Kill (); $NS->TimedWait (1);
100 print STDERR
"Starting Sender\n";
101 $CL_status = $CL->SpawnWaitKill ($cl->ProcessStartWaitInterval()+185);
102 if ($CL_status != 0) {
103 print STDERR
"ERROR: sender returned $CL_status\n";
107 $SV_status = $SV->TerminateWaitKill ($sv->ProcessStopWaitInterval());
108 if ($SV_status != 0) {
109 print STDERR
"ERROR: receiver returned $SV_status\n";
113 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
114 if ($NS_status != 0) {
115 print STDERR
"ERROR: Naming Service returned $NS_status\n";
119 $ns->DeleteFile ($nsiorfile);
120 $sv->DeleteFile ($nsiorfile);
121 $cl->DeleteFile ($nsiorfile);
122 $cl->DeleteFile ($inputfile);
123 $sv->DeleteFile ($outputfile);