1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
7 use lib
"$ENV{ACE_ROOT}/bin";
8 use PerlACE
::TestTarget
;
10 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
11 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
13 $server->AddLibPath ('../TestInf/.');
14 $server->AddLibPath ('../TestServant/.');
15 $client->AddLibPath ('../TestInf/.');
16 $client->AddLibPath ('../TestServant/.');
18 # 5 Minute server timeout.
19 my $server_timeout_secs = 300;
23 my $iorfname_prefix = "servant";
25 my $num_orb_threads = 1;
26 my $num_remote_clients = 1;
27 my $num_csd_threads = 1;
28 my $num_collocated_clients = 0;
31 my $scenario_id = "UnsetScenarioId";
44 print STDERR
"ERROR: Too many command-line arguments for $0.\n";
49 print STDERR
"ERROR: Too few command-line arguments for $0.\n";
54 $num_loops = $ARGV[2];
57 $scenario_id = $ARGV[0];
60 my $subtest = $ARGV[0];
62 if ($subtest =~ /^x_(.+)$/) {
67 if ($subtest eq 'remote') {
68 $num_remote_clients = 40;
70 elsif ($subtest eq 'collocated') {
71 $num_remote_clients = 0;
72 $num_collocated_clients = 10;
74 elsif ($subtest eq 'remote_orbthreads') {
76 $num_remote_clients = 40;
78 elsif ($subtest eq 'remote_servants') {
80 $num_remote_clients = 40;
82 elsif ($subtest eq 'remote_csdthreads') {
85 $num_remote_clients = 40;
87 elsif ($subtest eq 'remote_big') {
91 $num_remote_clients = 40;
93 elsif ($subtest eq 'collocated_big') {
96 $num_remote_clients = 0;
97 $num_collocated_clients = 40;
99 elsif ($subtest eq 'big') {
100 $num_csd_threads = 5;
102 $num_orb_threads = 4;
103 $num_remote_clients = 40;
104 $num_collocated_clients = 40;
106 elsif ($subtest eq 'remote_huge') {
107 $num_csd_threads = 5;
109 $num_orb_threads = 4;
110 $num_remote_clients = 400;
111 $num_loops = $num_loops / 10;
112 # 15 minute server timeout
113 $server_timeout_secs = 1800;
115 elsif ($subtest eq 'collocated_huge') {
116 $num_csd_threads = 20;
118 $num_remote_clients = 0;
119 $num_collocated_clients = 40;
121 elsif ($subtest eq 'usage') {
122 print STDOUT
"Usage: $0 [<subtest>]\n" .
124 "Supported <subtest> values:\n" .
128 "\tremote_orbthreads\n" .
129 "\tremote_servants\n" .
130 "\tremote_csdthreads\n" .
132 "\tcollocated_big\n" .
135 "\tcollocated_huge\n" .
141 print STDERR
"ERROR: invalid subtest argument for $0: $subtest\n";
146 #Fill array and delete old ior files.
147 for ($i = 0; $i < $num_servants; $i++) {
148 my $servant_id = sprintf("%02d", ($i + 1));
149 $iorbase[$i] = $iorfname_prefix . "_$servant_id.ior";
150 $server_iorfile[$i] = $server->LocalFile($iorbase[$i]);
151 $client_iorfile[$i] = $client->LocalFile($iorbase[$i]);
152 $server->DeleteFile ($iorbase[$i]);
153 $client->DeleteFile ($iorbase[$i]);
155 $server_fname = $server->LocalFile ($iorfname_prefix);
157 $SV = $server->CreateProcess ("server_main",
158 "-p $server_fname " .
159 "-s $num_servants " .
160 "-n $num_csd_threads " .
161 "-t $num_orb_threads " .
162 "-r $num_remote_clients " .
163 "-c $num_collocated_clients " .
170 # Wait for the servant ior files created by server.
171 for ($i = 0; $i < $num_servants; $i++) {
172 if ($server->WaitForFileTimed ($iorbase[$i],
173 $server->ProcessStartWaitInterval()) == -1) {
174 print STDERR
"ERROR: cannot find file <$server_iorfile[$i]>\n";
175 $SV->Kill(); $SV->TimedWait(1);
180 for ($i = 0; $i < $num_remote_clients; $i++) {
184 $j = $i % $num_servants;
185 $CLS[$i] = $client->CreateProcess ("client_main",
186 "-i file://$client_iorfile[$j] ".
192 for ($i = 0; $i < $num_remote_clients; $i++) {
193 $client_status = $CLS[$i]->WaitKill($client->ProcessStopWaitInterval () + 600);
195 if ($client_status != 0) {
196 print STDERR
"ERROR: client $i returned $client_status\n";
201 $server_status = $SV->WaitKill($server->ProcessStopWaitInterval () + 600);
203 if ($server_status != 0) {
204 print STDERR
"ERROR: server returned $server_status\n";
208 #Delete ior files generated by this run.
209 for ($i = 0; $i < $num_servants; $i++) {
210 $server->DeleteFile ($iorbase[$i]);
211 $client->DeleteFile ($iorbase[$i]);