Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Pluggable / run_test.pl
blob71cad2ef683f89806aa7f63cc345d08d2ef4c058
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 = 0;
14 my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
15 my $sv = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
16 my $cl = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
18 # amount of delay between running the servers
19 $sleeptime = 10;
21 $nsiorfile = "ns.ior";
22 $inputfile = "test_input";
24 $inputfile = PerlACE::generate_test_file($inputfile, 102400);
25 my $cl_inputfile = $cl->LocalFile ($inputfile);
27 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
28 my $sv_nsiorfile = $sv->LocalFile ($nsiorfile);
29 my $cl_nsiorfile = $cl->LocalFile ($nsiorfile);
30 $ns->DeleteFile ($nsiorfile);
31 $sv->DeleteFile ($nsiorfile);
32 $cl->DeleteFile ($nsiorfile);
34 if ($cl->PutFile ($inputfile) == -1) {
35 print STDERR "ERROR: cannot set file <$cl_inputfile>\n";
36 exit 1;
39 for ($i = 0; $i <= $#ARGV; $i++) {
40 if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
41 print STDERR "\nusage: run_test\n";
43 print STDERR "\t-h shows options menu\n";
45 print STDERR "\t-p: Transport protocols defaults to (";
46 for $protocol (@protocols) {
47 print STDERR "$protocol, ";
49 print STDERR ")\n";
51 print STDERR "\t-d: Debug Level defaults to 0";
53 print STDERR "\n";
55 exit;
57 elsif ($ARGV[$i] eq "-p") {
58 @protocols = split (',', $ARGV[$i + 1]);
59 $i++;
61 elsif ($ARGV[$i] eq "-d") {
62 $debug = $ARGV[$i + 1];
63 $i++;
67 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
68 " -o $ns_nsiorfile");
70 print STDERR "Starting Naming Service\n";
71 $NS_status = $NS->Spawn ();
73 if ($NS_status != 0) {
74 print STDERR "ERROR: Name Service returned $NS_status\n";
75 exit 1;
78 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()+45) == -1) {
79 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
80 $NS->Kill (); $NS->TimedWait (1);
81 exit 1;
84 if ($ns->GetFile ($nsiorfile) == -1) {
85 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
86 $NS->Kill (); $NS->TimedWait (1);
87 exit 1;
89 if ($sv->PutFile ($nsiorfile) == -1) {
90 print STDERR "ERROR: cannot set file <$sv_nsiorfile>\n";
91 $NS->Kill (); $NS->TimedWait (1);
92 exit 1;
94 if ($cl->PutFile ($nsiorfile) == -1) {
95 print STDERR "ERROR: cannot set file <$cl_nsiorfile>\n";
96 $NS->Kill (); $NS->TimedWait (1);
97 exit 1;
101 $outputfile = "TCP_output";
103 for $protocol (@protocols) {
105 $outputfile = $protocol."_output";
107 if ($protocol eq "RTP_UDP") {
108 $protocol = "RTP/UDP";
111 my $sv_outputfile = $sv->LocalFile ($outputfile);
112 $ns->DeleteFile ($outputfile);
114 $SV = $sv->CreateProcess ("server",
115 "-ORBInitRef NameService=file://$sv_nsiorfile ".
116 "-ORBDebugLevel $debug ".
117 "-f $sv_outputfile");
119 $CL = $cl->CreateProcess ("ftp",
120 "-ORBInitRef NameService=file://$cl_nsiorfile ".
121 "-ORBDebugLevel $debug ".
122 "-p $protocol ".
123 "-f $cl_inputfile");
125 print STDERR "Using ".$protocol."\n";
126 print STDERR "Starting Receiver\n";
128 $SV_status = $SV->Spawn ();
129 if ($SV_status != 0) {
130 print STDERR "ERROR: server returned $SV_status\n";
131 $SV->Kill (); $SV->TimedWait (1);
132 $NS->Kill (); $NS->TimedWait (1);
133 exit 1;
136 sleep $sleeptime;
138 print STDERR "Starting Sender\n";
140 $CL_status = $CL->SpawnWaitKill ($cl->ProcessStartWaitInterval()+185);
141 if ($CL_status != 0) {
142 print STDERR "ERROR: ftp returned $CL_status\n";
143 $status = 1;
146 $SV_status = $SV->TerminateWaitKill ($sv->ProcessStopWaitInterval()+185);
147 if ($SV_status != 0) {
148 print STDERR "ERROR: server returned $SV_status\n";
149 $status = 1;
152 $ns->DeleteFile ($outputfile);
155 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval()+985);
156 if ($NS_status != 0) {
157 print STDERR "ERROR: Naming Service returned $NS_status\n";
158 $status = 1;
161 $ns->DeleteFile ($nsiorfile);
162 $sv->DeleteFile ($nsiorfile);
163 $cl->DeleteFile ($nsiorfile);
164 $cl->DeleteFile ($inputfile);
166 exit $status;