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;
57 elsif ($subtest eq 'collocated_big') {
58 $num_remote_clients = 0;
60 $num_collocated_clients = 40;
62 elsif ($subtest eq 'remote_orbthreads') {
64 $num_remote_clients = 40;
66 elsif ($subtest eq 'remote_servants') {
68 $num_remote_clients = 40;
70 elsif ($subtest eq 'remote_csdthreads') {
72 $num_remote_clients = 40;
74 elsif ($subtest eq 'remote_big') {
78 $num_remote_clients = 40;
80 elsif ($subtest eq 'big') {
84 $num_remote_clients = 40;
85 $num_collocated_clients = 40;
87 elsif ($subtest eq 'usage') {
88 print STDOUT
"Usage: $0 [<subtest>]\n" .
90 "Supported <subtest> values:\n" .
94 "\tcollocated_big\n" .
95 "\tremote_orbthreads\n" .
96 "\tremote_servants\n" .
97 "\tremote_csdthreads\n" .
105 print STDERR
"ERROR: invalid subtest argument for $0: $subtest\n";
110 #Fill array and delete old ior files.
111 for ($i = 0; $i < $num_servants; $i++) {
112 my $servant_id = sprintf("%02d", ($i + 1));
113 $iorbase[$i] = $iorfname_prefix . "_$servant_id.ior";
114 $server_iorfile[$i] = $server->LocalFile($iorbase[$i]);
115 $client_iorfile[$i] = $client->LocalFile($iorbase[$i]);
116 $server->DeleteFile ($iorbase[$i]);
117 $client->DeleteFile ($iorbase[$i]);
119 $server_fname = $server->LocalFile ($iorfname_prefix);
121 $SV = $server->CreateProcess ("server_main",
122 "-p $server_fname " .
123 "-s $num_servants " .
124 "-n $num_csd_threads " .
125 "-t $num_orb_threads " .
126 "-r $num_remote_clients " .
127 "-c $num_collocated_clients " .
128 "-k $collocated_client_kind");
131 # Wait for the servant ior files created by server.
132 for ($i = 0; $i < $num_servants; $i++) {
133 if ($server->WaitForFileTimed ($iorbase[$i],
134 $server->ProcessStartWaitInterval()) == -1) {
135 print STDERR
"ERROR: cannot find file <$server_iorfile[$i]>\n";
136 $SV->Kill(); $SV->TimedWait(1);
141 for ($i = 0; $i < $num_remote_clients; $i++) {
145 $j = $i % $num_servants;
146 $CLS[$i] = $client->CreateProcess ("client_main",
147 "-i file://$client_iorfile[$j] ".
153 for ($i = 0; $i < $num_remote_clients; $i++) {
154 $client_status = $CLS[$i]->WaitKill($client->ProcessStopWaitInterval () + 60);
156 if ($client_status != 0) {
157 print STDERR
"ERROR: client $i returned $client_status\n";
162 $server_status = $SV->WaitKill($server->ProcessStopWaitInterval () + 60);
164 if ($server_status != 0) {
165 print STDERR
"ERROR: server returned $server_status\n";
169 #Delete ior files generated by this run.
170 for ($i = 0; $i < $num_servants; $i++) {
171 $server->DeleteFile ($iorbase[$i]);
172 $client->DeleteFile ($iorbase[$i]);