Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Multicast_Full_Profile / run_test.pl
blob872e135487f85ce6c01b1881fda2e886d5a79361
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";
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";
52 exit 1;
55 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
56 " -o $ns_nsiorfile");
57 $SV1 = $sv1->CreateProcess ("server",
58 " -ORBDebugLevel $debug_level ".
59 " -ORBInitRef NameService=file://$sv1_nsiorfile ".
60 "-f $sv1_test1file");
61 $SV2 = $sv2->CreateProcess ("server",
62 " -ORBDebugLevel $debug_level ".
63 " -ORBInitRef NameService=file://$sv2_nsiorfile ".
64 "-f $sv2_test2file");
65 $CL = $cl->CreateProcess ("ftp",
66 " -ORBInitRef NameService=file://$cl_nsiorfile ".
67 "-f $cl_inputfile");
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";
74 exit 1;
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);
80 exit 1;
83 if ($ns->GetFile ($nsiorfile) == -1) {
84 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
85 $NS->Kill (); $NS->TimedWait (1);
86 exit 1;
88 if ($sv1->PutFile ($nsiorfile) == -1) {
89 print STDERR "ERROR: cannot set file <$sv1_nsiorfile>\n";
90 $NS->Kill (); $NS->TimedWait (1);
91 exit 1;
93 if ($sv2->PutFile ($nsiorfile) == -1) {
94 print STDERR "ERROR: cannot set file <$sv2_nsiorfile>\n";
95 $NS->Kill (); $NS->TimedWait (1);
96 exit 1;
98 if ($cl->PutFile ($nsiorfile) == -1) {
99 print STDERR "ERROR: cannot set file <$cl_nsiorfile>\n";
100 $NS->Kill (); $NS->TimedWait (1);
101 exit 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);
110 exit 1;
112 sleep $sleeptime;
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);
121 exit 1;
123 sleep $sleeptime;
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";
129 $status = 1;
132 $SV1_status = $SV1->TerminateWaitKill ($sv1->ProcessStopWaitInterval());
133 if ($SV1_status != 0) {
134 print STDERR "ERROR: server 1 returned $SV1_status\n";
135 $status = 1;
138 $SV2_status = $SV2->TerminateWaitKill ($sv2->ProcessStopWaitInterval());
139 if ($SV2_status != 0) {
140 print STDERR "ERROR: server 2 returned $SV2_status\n";
141 $status = 1;
144 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
145 if ($NS_status != 0) {
146 print STDERR "ERROR: Naming Service returned $NS_status\n";
147 $status = 1;
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);
158 exit $status;