Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / EC_Throughput / run_test_overflow.pl
blob38d88e43283169b892f59a12d96cedeee3ed98e3
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;
10 $status = 0;
11 $debug_level = '0';
13 foreach $i (@ARGV) {
14 if ($i eq '-debug') {
15 $debug_level = '10';
19 my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $es = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $con = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
22 my $sup = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
23 my $sup2 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
25 $nsiorfile = "NameService.ior";
26 $ecmtconffile = "ec_mt_overflow$PerlACE::svcconf_ext";
28 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
29 my $es_nsiorfile = $es->LocalFile ($nsiorfile);
30 my $con_nsiorfile = $con->LocalFile ($nsiorfile);
31 my $sup_nsiorfile = $sup->LocalFile ($nsiorfile);
32 my $sup2_nsiorfile = $sup2->LocalFile ($nsiorfile);
33 my $es_ecmtconffile = $es->LocalFile ($ecmtconffile);
34 $ns->DeleteFile ($nsiorfile);
35 $es->DeleteFile ($nsiorfile);
36 $con->DeleteFile ($nsiorfile);
37 $sup->DeleteFile ($nsiorfile);
38 $sup2->DeleteFile ($nsiorfile);
41 print STDERR "================ Overflow test\n";
43 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
44 "-o $ns_nsiorfile");
46 $ES = $es->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Event_Service/tao_rtevent",
47 "-ORBInitRef NameService=file://$es_nsiorfile ".
48 " -ORBSvcConf $es_ecmtconffile ".
49 " -s local");
51 $CON = $con->CreateProcess ("ECT_Consumer",
52 "-ORBDebugLevel $debug_level ".
53 "-ORBInitRef NameService=file://$con_nsiorfile ".
54 " -x -c 1 -s 3 -o 30");
56 $SUP = $sup->CreateProcess ("ECT_Supplier",
57 "-ORBInitRef NameService=file://$sup_nsiorfile ".
58 " -s 3 -u 10000 -n 1 -t 0 -b 8");
60 $SUP2 = $sup2->CreateProcess ("ECT_Supplier",
61 "-ORBInitRef NameService=file://$sup2_nsiorfile ".
62 " -s 1 -u 10 -n 1 -t 0");
64 $NS_status = $NS->Spawn ();
65 if ($NS_status != 0) {
66 print STDERR "ERROR: Name Service returned $NS_status\n";
67 $NS->Kill (); $NS->TimedWait (1);
68 exit 1;
70 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
71 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
72 $NS->Kill (); $NS->TimedWait (1);
73 exit 1;
75 if ($ns->GetFile ($nsiorfile) == -1) {
76 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
77 $NS->Kill (); $NS->TimedWait (1);
78 exit 1;
80 if ($es->PutFile ($nsiorfile) == -1) {
81 print STDERR "ERROR: cannot set file <$es_nsiorfile>\n";
82 $NS->Kill (); $NS->TimedWait (1);
83 exit 1;
85 if ($con->PutFile ($nsiorfile) == -1) {
86 print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
87 $NS->Kill (); $NS->TimedWait (1);
88 exit 1;
90 if ($sup->PutFile ($nsiorfile) == -1) {
91 print STDERR "ERROR: cannot set file <$sup_nsiorfile>\n";
92 $NS->Kill (); $NS->TimedWait (1);
93 exit 1;
95 if ($sup2->PutFile ($nsiorfile) == -1) {
96 print STDERR "ERROR: cannot set file <$sup2_nsiorfile>\n";
97 $NS->Kill (); $NS->TimedWait (1);
98 exit 1;
101 $ES_status = $ES->Spawn ();
102 if ($ES_status != 0) {
103 print STDERR "ERROR: Event Service returned $ES_status\n";
104 $ES->Kill (); $ES->TimedWait (1);
105 $NS->Kill (); $NS->TimedWait (1);
106 exit 1;
109 sleep 10;
111 $CON_status = $CON->Spawn ();
112 if ($CON_status != 0) {
113 print STDERR "ERROR: Consumer returned $CON_status\n";
114 $CON->Kill (); $CON->TimedWait (1);
115 $ES->Kill (); $ES->TimedWait (1);
116 $NS->Kill (); $NS->TimedWait (1);
117 exit 1;
120 $SUP_status = $SUP->Spawn ();
121 if ($SUP_status != 0) {
122 print STDERR "ERROR: Supplier returned $SUP_status\n";
123 $SUP->Kill (); $SUP->TimedWait (1);
124 $CON->Kill (); $CON->TimedWait (1);
125 $ES->Kill (); $ES->TimedWait (1);
126 $NS->Kill (); $NS->TimedWait (1);
127 exit 1;
130 $SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval()+285);
131 if ($SUP_status != 0) {
132 print STDERR "ERROR: Supplier returned $SUP_status\n";
133 $status = 1;
136 $CON_status = $CON->WaitKill ($con->ProcessStopWaitInterval()+285);
137 if ($CON_status != 0) {
138 print STDERR "ERROR: Consumer returned $CON_status\n";
139 $status = 1;
142 # The consumer will probably fail to get all the messages due to the
143 # EC dropping them. We dont care if the Consumer fails.
145 $SUP2_status = $SUP2->SpawnWaitKill ($sup2->ProcessStartWaitInterval()+45);
146 if ($SUP2_status != 0) {
147 print STDERR "ERROR: Supplier2 returned $SUP2_status\n";
148 $status = 1;
152 $ES_status = $ES->TerminateWaitKill ($es->ProcessStopWaitInterval());
153 if ($ES_status != 0) {
154 print STDERR "ERROR: Event Service returned $ES_status\n";
155 $status = 1;
158 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
159 if ($NS_status != 0) {
160 print STDERR "ERROR: Naming Service returned $NS_status\n";
161 $status = 1;
164 $ns->DeleteFile ($nsiorfile);
165 $es->DeleteFile ($nsiorfile);
166 $con->DeleteFile ($nsiorfile);
167 $sup->DeleteFile ($nsiorfile);
169 exit $status;