=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / tests / CSD_Strategy_Tests / TP_Test_4 / run_test.pl
blob87da3ddf73cf91ba9d79b6e5f2df5b94b84a80fd
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 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/.');
23 my $status = 0;
25 my $iorfname_prefix = "servant";
26 my $num_servants = 1;
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;
32 my $client_kind = 0;
34 my $i;
35 my $j;
36 my @iorbase;
37 my @server_iorfile;
38 my @client_iorfile;
40 my $ARGC = @ARGV;
42 if ($ARGC > 0) {
43 if ($ARGC > 1) {
44 print STDERR "ERROR: Too many command-line arguments for $0.\n";
45 exit 1;
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;
59 $num_csd_threads = 5;
60 $num_collocated_clients = 40;
62 elsif ($subtest eq 'remote_orbthreads') {
63 $num_orb_threads = 5;
64 $num_remote_clients = 40;
66 elsif ($subtest eq 'remote_servants') {
67 $num_servants = 5;
68 $num_remote_clients = 40;
70 elsif ($subtest eq 'remote_csdthreads') {
71 $num_csd_threads = 5;
72 $num_remote_clients = 40;
74 elsif ($subtest eq 'remote_big') {
75 $num_csd_threads = 5;
76 $num_servants = 10;
77 $num_orb_threads = 4;
78 $num_remote_clients = 40;
80 elsif ($subtest eq 'big') {
81 $num_csd_threads = 5;
82 $num_servants = 10;
83 $num_orb_threads = 4;
84 $num_remote_clients = 40;
85 $num_collocated_clients = 40;
87 elsif ($subtest eq 'usage') {
88 print STDOUT "Usage: $0 [<subtest>]\n" .
89 "\n" .
90 "Supported <subtest> values:\n" .
91 "\n" .
92 "\tremote\n" .
93 "\tcollocated\n" .
94 "\tcollocated_big\n" .
95 "\tremote_orbthreads\n" .
96 "\tremote_servants\n" .
97 "\tremote_csdthreads\n" .
98 "\tremote_big\n" .
99 "\tbig\n" .
100 "\tusage\n" .
101 "\n";
102 exit 0;
104 else {
105 print STDERR "ERROR: invalid subtest argument for $0: $subtest\n";
106 exit 1;
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");
129 $SV->Spawn();
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);
137 exit 1;
141 for ($i = 0; $i < $num_remote_clients; $i++) {
143 $client_id = $i+1;
145 $j = $i % $num_servants;
146 $CLS[$i] = $client->CreateProcess ("client_main",
147 "-i file://$client_iorfile[$j] ".
148 "-k $client_kind ".
149 "-n $client_id");
150 $CLS[$i]->Spawn();
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";
158 $status = 1;
162 $server_status = $SV->WaitKill($server->ProcessStopWaitInterval () + 60);
164 if ($server_status != 0) {
165 print STDERR "ERROR: server returned $server_status\n";
166 $status = 1;
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]);
175 exit $status;