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 $client->AddLibPath ('../TP_Foo_A/.');
15 $server->AddLibPath ('../TP_Foo_B/.');
16 $client->AddLibPath ('../TP_Foo_B/.');
17 $server->AddLibPath ('../TP_Foo_C/.');
18 $client->AddLibPath ('../TP_Foo_C/.');
19 $server->AddLibPath ('../TP_Common/.');
20 $client->AddLibPath ('../TP_Common/.');
24 my $iorfname_prefix = "servant";
26 my $num_orb_threads = 1;
27 my $num_remote_clients = 1;
28 my $num_csd_threads = 1;
29 my $num_collocated_clients = 0;
30 my $collocated_client_kind = 0;
43 print STDERR
"ERROR: Too many command-line arguments for $0.\n";
47 my $subtest = $ARGV[0];
49 if ($subtest eq 'remote') {
50 $num_remote_clients = 40;
52 elsif ($subtest eq 'collocated') {
53 $num_remote_clients = 0;
54 $num_collocated_clients = 1;
57 elsif ($subtest eq 'remote_orbthreads') {
59 $num_remote_clients = 40;
61 elsif ($subtest eq 'remote_servants') {
63 $num_remote_clients = 40;
65 elsif ($subtest eq 'remote_csdthreads') {
67 $num_remote_clients = 40;
69 elsif ($subtest eq 'remote_big') {
73 $num_remote_clients = 40;
75 elsif ($subtest eq 'big') {
79 $num_remote_clients = 40;
80 $num_collocated_clients = 40;
82 elsif ($subtest eq 'usage') {
83 print STDOUT
"Usage: $0 [<subtest>]\n" .
85 "Supported <subtest> values:\n" .
89 "\tremote_orbthreads\n" .
90 "\tremote_servants\n" .
91 "\tremote_csdthreads\n" .
98 print STDERR
"ERROR: invalid subtest argument for $0: $subtest\n";
103 #Fill array and delete old ior files.
104 for ($i = 0; $i < $num_servants; $i++) {
105 my $servant_id = sprintf("%02d", ($i + 1));
106 $iorbase[$i] = $iorfname_prefix . "_$servant_id.ior";
107 $server_iorfile[$i] = $server->LocalFile($iorbase[$i]);
108 $client_iorfile[$i] = $client->LocalFile($iorbase[$i]);
109 $server->DeleteFile ($iorbase[$i]);
110 $client->DeleteFile ($iorbase[$i]);
112 $server_fname = $server->LocalFile ($iorfname_prefix);
113 $server->DeleteFile ($server_fname);
115 $SV = $server->CreateProcess ("server_main",
116 "-p $server_fname " .
117 "-s $num_servants " .
118 "-n $num_csd_threads " .
119 "-t $num_orb_threads " .
120 "-r $num_remote_clients " .
121 "-c $num_collocated_clients " .
122 "-k $collocated_client_kind");
125 # Wait for the servant ior files created by server.
126 for ($i = 0; $i < $num_servants; $i++) {
127 if ($server->WaitForFileTimed ($iorbase[$i],
128 2*$server->ProcessStartWaitInterval()) == -1) {
129 print STDERR
"ERROR: cannot find file <$server_iorfile[$i]>\n";
130 $SV->Kill(); $SV->TimedWait(1);
135 for ($i = 0; $i < $num_remote_clients; $i++) {
139 $j = $i % $num_servants;
140 $CLS[$i] = $client->CreateProcess ("client_main",
141 "-i file://$client_iorfile[$j] ".
147 for ($i = 0; $i < $num_remote_clients; $i++) {
148 $client_status = $CLS[$i]->WaitKill($client->ProcessStopWaitInterval () + 60);
150 if ($client_status != 0) {
151 print STDERR
"ERROR: client $i returned $client_status\n";
156 $server_status = $SV->WaitKill($server->ProcessStopWaitInterval () + 60);
158 if ($server_status != 0) {
159 print STDERR
"ERROR: server returned $server_status\n";
163 #Delete ior files generated by this run.
164 for ($i = 0; $i < $num_servants; $i++) {
165 $server->DeleteFile ($iorbase[$i]);
166 $client->DeleteFile ($iorbase[$i]);