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
;
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";
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");
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";
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);
67 if ($server->GetFile ($iorbase) == -1) {
68 print STDERR
"ERROR: cannot retrieve file <$server_iorfile>\n";
69 $SV->Kill (); $SV->TimedWait (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;
82 $SV->Kill (); $SV->TimedWait (1);
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;
97 for ($i = 0; $i < $broken_number; $i++) {
101 $SV->Kill (); $SV->TimedWait (1);
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";
114 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 45);
116 if ($server_status != 0) {
117 print STDERR
"ERROR: server returned $server_status\n";
121 $server->DeleteFile($iorbase);
122 for ($i = 0; $i < $num_clients; $i++) {
123 $clients[$i]->DeleteFile($iorbase);