Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Pluggable_Flow_Protocol / run_test.pl
blobcef32bfd2478d104d5ae680f586d992bea5919b8
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 use lib "$ENV{ACE_ROOT}/bin";
8 use PerlACE::TestTarget;
9 use File::stat;
11 $status = 0;
12 $debug_level = '0';
14 foreach $i (@ARGV) {
15 if ($i eq '-debug') {
16 $debug_level = '10';
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
25 $sleeptime = 2;
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";
46 exit 1;
49 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
50 " -o $ns_nsiorfile");
51 $SV = $sv->CreateProcess ("receiver",
52 " -ORBDebugLevel $debug_level ".
53 " -ORBInitRef NameService=file://$sv_nsiorfile ".
54 "-f $sv_outputfile");
55 $CL = $cl->CreateProcess ("sender",
56 "-ORBDebugLevel 2 ".
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";
65 exit 1;
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);
71 exit 1;
74 if ($ns->GetFile ($nsiorfile) == -1) {
75 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
76 $NS->Kill (); $NS->TimedWait (1);
77 exit 1;
79 if ($sv->PutFile ($nsiorfile) == -1) {
80 print STDERR "ERROR: cannot set file <$sv_nsiorfile>\n";
81 $NS->Kill (); $NS->TimedWait (1);
82 exit 1;
84 if ($cl->PutFile ($nsiorfile) == -1) {
85 print STDERR "ERROR: cannot set file <$cl_nsiorfile>\n";
86 $NS->Kill (); $NS->TimedWait (1);
87 exit 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);
96 exit 1;
98 sleep $sleeptime;
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";
104 $status = 1;
107 $SV_status = $SV->TerminateWaitKill ($sv->ProcessStopWaitInterval());
108 if ($SV_status != 0) {
109 print STDERR "ERROR: receiver returned $SV_status\n";
110 $status = 1;
113 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
114 if ($NS_status != 0) {
115 print STDERR "ERROR: Naming Service returned $NS_status\n";
116 $status = 1;
119 $ns->DeleteFile ($nsiorfile);
120 $sv->DeleteFile ($nsiorfile);
121 $cl->DeleteFile ($nsiorfile);
122 $cl->DeleteFile ($inputfile);
123 $sv->DeleteFile ($outputfile);
125 exit $status;