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 ('../TP_Foo_A/.');
14 $server->AddLibPath ('../TP_Foo_B/.');
15 $server->AddLibPath ('../TP_Foo_C/.');
16 $server->AddLibPath ('../TP_Common/.');
18 $client->AddLibPath ('../TP_Foo_A/.');
19 $client->AddLibPath ('../TP_Foo_B/.');
20 $client->AddLibPath ('../TP_Foo_C/.');
21 $client->AddLibPath ('../TP_Common/.');
25 my $iorfname_prefix = "servant";
27 my $num_orb_threads = 1;
28 my $num_remote_clients = 1;
29 my $num_csd_threads = 1;
30 my $num_collocated_clients = 0;
31 my $collocated_client_kind = 0;
44 print STDERR
"ERROR: Too many command-line arguments for $0.\n";
48 my $subtest = $ARGV[0];
50 if ($subtest eq 'remote') {
51 $num_remote_clients = 40;
53 elsif ($subtest eq 'collocated') {
54 $num_remote_clients = 0;
55 $num_collocated_clients = 1;
56 $num_collocated_clients = 1;
58 elsif ($subtest eq 'remote_orbthreads') {
60 $num_remote_clients = 40;
62 elsif ($subtest eq 'remote_servants') {
64 $num_remote_clients = 40;
66 elsif ($subtest eq 'remote_csdthreads') {
68 $num_remote_clients = 40;
70 elsif ($subtest eq 'remote_big') {
74 $num_remote_clients = 40;
76 elsif ($subtest eq 'big') {
80 $num_remote_clients = 40;
81 $num_collocated_clients = 40;
83 elsif ($subtest eq 'usage') {
84 print STDOUT
"Usage: $0 [<subtest>]\n" .
86 "Supported <subtest> values:\n" .
90 "\tremote_orbthreads\n" .
91 "\tremote_servants\n" .
92 "\tremote_csdthreads\n" .
100 print STDERR
"ERROR: invalid subtest argument for $0: $subtest\n";
105 #Fill array and delete old ior files.
106 for ($i = 0; $i < $num_servants; $i++) {
107 my $servant_id = sprintf("%02d", ($i + 1));
108 $iorbase[$i] = $iorfname_prefix . "_$servant_id.ior";
109 $server_iorfile[$i] = $server->LocalFile($iorbase[$i]);
110 $client_iorfile[$i] = $client->LocalFile($iorbase[$i]);
111 $server->DeleteFile ($iorbase[$i]);
112 $client->DeleteFile ($iorbase[$i]);
114 $server_fname = $server->LocalFile ($iorfname_prefix);
116 $SV = $server->CreateProcess ("server_main",
117 "-p $server_fname " .
118 "-s $num_servants " .
119 "-n $num_csd_threads " .
120 "-t $num_orb_threads " .
121 "-r $num_remote_clients " .
122 "-c $num_collocated_clients " .
123 "-k $collocated_client_kind");
126 # Wait for the servant ior files created by server.
127 for ($i = 0; $i < $num_servants; $i++) {
128 if ($server->WaitForFileTimed ($iorbase[$i],
129 $server->ProcessStartWaitInterval()) == -1) {
130 print STDERR
"ERROR: cannot find file <$server_iorfile[$i]>\n";
131 $SV->Kill(); $SV->TimedWait(1);
136 for ($i = 0; $i < $num_remote_clients; $i++) {
140 $j = $i % $num_servants;
141 $CLS[$i] = $client->CreateProcess ("client_main",
142 "-i file://$client_iorfile[$j] ".
148 for ($i = 0; $i < $num_remote_clients; $i++) {
149 $client_status = $CLS[$i]->WaitKill($client->ProcessStopWaitInterval () + 60);
151 if ($client_status != 0) {
152 print STDERR
"ERROR: client $i returned $client_status\n";
157 $server_status = $SV->WaitKill($server->ProcessStopWaitInterval () + 60);
159 if ($server_status != 0) {
160 print STDERR
"ERROR: server returned $server_status\n";
164 #Delete ior files generated by this run.
165 for ($i = 0; $i < $num_servants; $i++) {
166 $server->DeleteFile ($iorbase[$i]);
167 $client->DeleteFile ($iorbase[$i]);