Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / orbsvcs / tests / EC_Throughput / run_test.pl
blob19237263edcd33c176f45d657ea9bfc5b9634db7
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 $test = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
25 $nsiorfile = "NameService.ior";
26 $ecconffile = "ec$PerlACE::svcconf_ext";
27 $ecmtconffile = "ec$PerlACE::svcconf_ext";
29 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
30 my $es_nsiorfile = $es->LocalFile ($nsiorfile);
31 my $con_nsiorfile = $con->LocalFile ($nsiorfile);
32 my $sup_nsiorfile = $sup->LocalFile ($nsiorfile);
33 my $test_ecconffile = $test->LocalFile ($ecconffile);
34 my $es_ecconffile = $es->LocalFile ($ecconffile);
35 my $test_ecmtconffile = $test->LocalFile ($ecmtconffile);
36 $ns->DeleteFile ($nsiorfile);
37 $es->DeleteFile ($nsiorfile);
38 $con->DeleteFile ($nsiorfile);
39 $sup->DeleteFile ($nsiorfile);
41 print STDERR "================ Collocated tests, single threaded\n";
43 $T = $test->CreateProcess ("ECT_Throughput",
44 "-ORBSvcConf $test_ecconffile ".
45 "-u 10000 -n 1 -t 0 -c 4");
47 $T_status = $T->SpawnWaitKill ($test->ProcessStartWaitInterval()+105);
48 if ($T_status != 0) {
49 print STDERR "ERROR: test returned $T_status\n";
50 $status = 1;
53 print STDERR "================ Collocated tests, multi threaded\n";
55 $T = $test->CreateProcess ("ECT_Throughput",
56 "-ORBSvcConf $test_ecmtconffile ".
57 "-u 10000 -n 1 -t 0 -c 4");
59 $T_status = $T->SpawnWaitKill ($test->ProcessStartWaitInterval()+105);
60 if ($T_status != 0) {
61 print STDERR "ERROR: test returned $T_status\n";
62 $status = 1;
65 print STDERR "================ Remote test\n";
67 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
68 "-o $ns_nsiorfile");
70 $ES = $es->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Event_Service/tao_rtevent",
71 "-ORBInitRef NameService=file://$es_nsiorfile ".
72 "-ORBSvcConf $es_ecconffile ".
73 "-s local");
75 $CON = $con->CreateProcess ("ECT_Consumer",
76 "-ORBDebugLevel $debug_level ".
77 "-ORBInitRef NameService=file://$con_nsiorfile ".
78 "-c 4 -s 1");
80 $SUP = $sup->CreateProcess ("ECT_Supplier",
81 "-ORBInitRef NameService=file://$sup_nsiorfile ".
82 " -s 1 -u 5000 -n 1 -t 0");
84 $NS_status = $NS->Spawn ();
85 if ($NS_status != 0) {
86 print STDERR "ERROR: Name Service returned $NS_status\n";
87 $NS->Kill (); $NS->TimedWait (1);
88 exit 1;
90 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
91 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
92 $NS->Kill (); $NS->TimedWait (1);
93 exit 1;
95 if ($ns->GetFile ($nsiorfile) == -1) {
96 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
97 $NS->Kill (); $NS->TimedWait (1);
98 exit 1;
100 if ($es->PutFile ($nsiorfile) == -1) {
101 print STDERR "ERROR: cannot set file <$es_nsiorfile>\n";
102 $NS->Kill (); $NS->TimedWait (1);
103 exit 1;
105 if ($con->PutFile ($nsiorfile) == -1) {
106 print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
107 $NS->Kill (); $NS->TimedWait (1);
108 exit 1;
110 if ($sup->PutFile ($nsiorfile) == -1) {
111 print STDERR "ERROR: cannot set file <$sup_nsiorfile>\n";
112 $NS->Kill (); $NS->TimedWait (1);
113 exit 1;
116 $ES_status = $ES->Spawn ();
117 if ($ES_status != 0) {
118 print STDERR "ERROR: Event Service returned $ES_status\n";
119 $ES->Kill (); $ES->TimedWait (1);
120 $NS->Kill (); $NS->TimedWait (1);
121 exit 1;
124 sleep 10;
126 $CON_status = $CON->Spawn ();
127 if ($CON_status != 0) {
128 print STDERR "ERROR: Consumer returned $CON_status\n";
129 $CON->Kill (); $CON->TimedWait (1);
130 $ES->Kill (); $ES->TimedWait (1);
131 $NS->Kill (); $NS->TimedWait (1);
132 exit 1;
135 $SUP_status = $SUP->Spawn ();
136 if ($SUP_status != 0) {
137 print STDERR "ERROR: Supplier returned $SUP_status\n";
138 $SUP->Kill (); $SUP->TimedWait (1);
139 $CON->Kill (); $CON->TimedWait (1);
140 $ES->Kill (); $ES->TimedWait (1);
141 $NS->Kill (); $NS->TimedWait (1);
142 exit 1;
145 $SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval()+285);
146 if ($SUP_status != 0) {
147 print STDERR "ERROR: Supplier returned $SUP_status\n";
148 $status = 1;
151 $CON_status = $CON->WaitKill ($con->ProcessStopWaitInterval()+45);
152 if ($CON_status != 0) {
153 print STDERR "ERROR: Consumer returned $CON_status\n";
154 $status = 1;
157 $ES_status = $ES->TerminateWaitKill ($es->ProcessStopWaitInterval());
158 if ($ES_status != 0) {
159 print STDERR "ERROR: Event Service returned $ES_status\n";
160 $status = 1;
163 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
164 if ($NS_status != 0) {
165 print STDERR "ERROR: Naming Service returned $NS_status\n";
166 $status = 1;
169 $ns->DeleteFile ($nsiorfile);
170 $es->DeleteFile ($nsiorfile);
171 $con->DeleteFile ($nsiorfile);
172 $sup->DeleteFile ($nsiorfile);
174 exit $status;