Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / examples / CSD_Strategy / ThreadPool3 / run_test.pl
blob1eb9b2e276cda495d56cbd265a18f1544a543bbb
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 $status = 0;
11 $debug_level = '0';
12 $num_clients = 40;
13 $num_orb_threads = 4;
15 foreach $i (@ARGV) {
16 if ($i eq '-debug') {
17 $debug_level = '10';
21 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
22 my @clients = ();
23 for ($i = 0; $i < $num_clients; $i++) {
24 $clients[$i] = PerlACE::TestTarget::create_target ($i+1) || die "Create target $i+1 failed\n";
27 my $iorbase = "server.ior";
29 my $server_iorfile = $server->LocalFile ($iorbase);
30 $server->DeleteFile($iorbase);
31 $SV = $server->CreateProcess ("server_main", "-ORBdebuglevel $debug_level ".
32 "-o $server_iorfile ".
33 "-n $num_clients -t $num_orb_threads");
35 my @CLS = ();
36 my @clients_iorfile = ();
37 for ($i = 0; $i < $num_clients; $i++) {
38 $clients_iorfile[$i] = $clients[$i]->LocalFile ($iorbase);
39 $clients[$i]->DeleteFile($iorbase);
40 $CLS[$i] = $clients[$i]->CreateProcess ("client_main", "-i file://$clients_iorfile[$i]");
43 $server_status = $SV->Spawn ();
45 if ($server_status != 0) {
46 print STDERR "ERROR: server returned $server_status\n";
47 exit 1;
50 if ($server->WaitForFileTimed ($iorbase,
51 $server->ProcessStartWaitInterval()) == -1) {
52 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
53 $SV->Kill (); $SV->TimedWait (1);
54 exit 1;
57 if ($server->GetFile ($iorbase) == -1) {
58 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
59 $SV->Kill (); $SV->TimedWait (1);
60 exit 1;
63 for ($i = 0; $i < $num_clients; $i++) {
64 if ($clients[$i]->PutFile ($iorbase) == -1) {
65 print STDERR "ERROR: client $i cannot set file <$clients_iorfile[$i]>\n";
66 $SV->Kill (); $SV->TimedWait (1);
67 exit 1;
71 for ($i = 0; $i < $num_clients; $i++) {
72 my $client_status = $CLS[$i]->Spawn();
73 if ($client_status != 0) {
74 print STDERR "ERROR: client $i Spawn returned $client_status\n";
75 $status = 1;
79 for ($i = 0; $i < $num_clients; $i++) {
80 my $client_status = $CLS[$i]->WaitKill ($clients[$i]->ProcessStartWaitInterval() + 45);
82 if ($client_status != 0) {
83 print STDERR "ERROR: client returned $client_status\n";
84 $status = 1;
88 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 45);
90 if ($server_status != 0) {
91 print STDERR "ERROR: server returned $server_status\n";
92 $status = 1;
95 $server->DeleteFile($iorbase);
96 for ($i = 0; $i < $num_clients; $i++) {
97 $clients[$i]->DeleteFile($iorbase);
100 exit $status;