Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / CSD_Strategy_Tests / TP_Test_Static / run_test.pl
blobeec16e11d430ef6f3b912a2bb198abaa53ace6da
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';
13 foreach $i (@ARGV) {
14 if ($i eq '-debug') {
15 $debug_level = '10';
19 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
21 $server->AddLibPath ('../TP_Foo_A/.');
22 $server->AddLibPath ('../TP_Foo_B/.');
23 $server->AddLibPath ('../TP_Foo_C/.');
24 $server->AddLibPath ('../TP_Common/.');
26 my $iorbase = "server.ior";
27 my $num_clients = 40;
29 my $server_iorfile = $server->LocalFile ($iorbase);
30 $server->DeleteFile($iorbase);
32 $SV = $server->CreateProcess ("server_main", "-ORBdebuglevel $debug_level ".
33 "-o $server_iorfile -n $num_clients");
35 @clients = ();
36 @CLS = ();
37 @clients_iorfile = ();
39 for ($i = 0; $i < $num_clients; $i++) {
40 $clients[$i] = PerlACE::TestTarget::create_target ($i + 2) || die "Create target " . ($i + 2) . " failed\n";
42 $clients[$i]->AddLibPath ('../TP_Foo_A/.');
43 $clients[$i]->AddLibPath ('../TP_Foo_B/.');
44 $clients[$i]->AddLibPath ('../TP_Foo_C/.');
45 $clients[$i]->AddLibPath ('../TP_Common/.');
47 $clients_iorfile[$i] = $clients[$i]->LocalFile ($iorbase);
48 $clients[$i]->DeleteFile($iorbase);
50 $CLS[$i] = $clients[$i]->CreateProcess ("client_main", "-k file://$clients_iorfile[$i]");
53 $server_status = $SV->Spawn ();
55 if ($server_status != 0) {
56 print STDERR "ERROR: server returned $server_status\n";
57 exit 1;
60 if ($server->WaitForFileTimed ($iorbase,
61 $server->ProcessStartWaitInterval()) == -1) {
62 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
63 $SV->Kill (); $SV->TimedWait (1);
64 exit 1;
67 if ($server->GetFile ($iorbase) == -1) {
68 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
69 $SV->Kill (); $SV->TimedWait (1);
70 exit 1;
74 for ($i = 0; $i < $num_clients; $i++) {
75 if ($clients[$i]->PutFile ($iorbase) == -1) {
76 print STDERR "ERROR: cannot set file <$clients_iorfile[$i]>\n";
77 $i = $num_clients; $status = 1;
81 if ($status != 0) {
82 $SV->Kill (); $SV->TimedWait (1);
83 exit $status;
86 my $broken_number = 0;
87 for ($i = 0; $i < $num_clients; $i++) {
88 $client_status = $CLS[$i]->Spawn ();
90 if ($client_status != 0) {
91 print STDERR "ERROR: client $i returned $client_status\n";
92 $broken_number = $i; $i = $num_clients; $status = 1;
96 if ($status != 0) {
97 for ($i = 0; $i < $broken_number; $i++) {
98 $CLS[$i] = Kill ();
101 $SV->Kill (); $SV->TimedWait (1);
102 exit $status;
105 for ($i = 0; $i < $num_clients; $i++) {
106 $client_status = $CLS[$i]->WaitKill ($clients[$i]->ProcessStartWaitInterval() + 45);
108 if ($client_status != 0) {
109 print STDERR "ERROR: client $i returned $client_status\n";
110 $status = 1;
114 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 45);
116 if ($server_status != 0) {
117 print STDERR "ERROR: server returned $server_status\n";
118 $status = 1;
121 $server->DeleteFile($iorbase);
122 for ($i = 0; $i < $num_clients; $i++) {
123 $clients[$i]->DeleteFile($iorbase);
126 exit $status;