Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Multicast / run_test.pl
blob793decde13082766c7dcf6d1e76f9f7171afcc60
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 $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
26 $sleeptime = 6;
28 $nsiorfile = "ns.ior";
29 $test1file = "test1";
30 $test2file = "test2";
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";
56 exit 1;
59 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
60 " -o $ns_nsiorfile");
61 $SV1 = $sv1->CreateProcess ("server",
62 " -ORBDebugLevel $debug_level ".
63 " -ORBInitRef NameService=file://$sv1_nsiorfile ".
64 "-f $sv1_test1file");
65 $SV2 = $sv2->CreateProcess ("server",
66 " -ORBDebugLevel $debug_level ".
67 " -ORBInitRef NameService=file://$sv2_nsiorfile ".
68 "-f $sv2_test2file");
69 $CL = $cl->CreateProcess ("ftp",
70 "-ORBSvcConf $cl_conffile ".
71 " -ORBInitRef NameService=file://$cl_nsiorfile ".
72 "-f $cl_inputfile");
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";
79 exit 1;
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);
85 exit 1;
88 if ($ns->GetFile ($nsiorfile) == -1) {
89 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
90 $NS->Kill (); $NS->TimedWait (1);
91 exit 1;
93 if ($sv1->PutFile ($nsiorfile) == -1) {
94 print STDERR "ERROR: cannot set file <$sv1_nsiorfile>\n";
95 $NS->Kill (); $NS->TimedWait (1);
96 exit 1;
98 if ($sv2->PutFile ($nsiorfile) == -1) {
99 print STDERR "ERROR: cannot set file <$sv2_nsiorfile>\n";
100 $NS->Kill (); $NS->TimedWait (1);
101 exit 1;
103 if ($cl->PutFile ($nsiorfile) == -1) {
104 print STDERR "ERROR: cannot set file <$cl_nsiorfile>\n";
105 $NS->Kill (); $NS->TimedWait (1);
106 exit 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);
115 exit 1;
117 sleep $sleeptime;
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);
126 exit 1;
128 sleep $sleeptime;
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";
134 $status = 1;
137 $SV1_status = $SV1->TerminateWaitKill ($sv1->ProcessStopWaitInterval());
138 if ($SV1_status != 0) {
139 print STDERR "ERROR: server 1 returned $SV1_status\n";
140 $status = 1;
143 $SV2_status = $SV2->TerminateWaitKill ($sv2->ProcessStopWaitInterval());
144 if ($SV2_status != 0) {
145 print STDERR "ERROR: server 2 returned $SV2_status\n";
146 $status = 1;
149 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
150 if ($NS_status != 0) {
151 print STDERR "ERROR: Naming Service returned $NS_status\n";
152 $status = 1;
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);
163 exit $status;