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
;
13 local $start_time = time();
14 local $max_running_time = 300; # 5 minutes
15 local $elapsed = time() - $start_time;
23 $max_running_time = 1;
27 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
28 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
30 my $iorbase = "server.ior";
31 my $server_iorfile = $server->LocalFile ($iorbase);
32 my $client_iorfile = $client->LocalFile ($iorbase);
33 $server->DeleteFile($iorbase);
34 $client->DeleteFile($iorbase);
36 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level -o $server_iorfile");
37 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile");
39 $server_status = $SV->Spawn ();
41 if ($server_status != 0) {
42 print STDERR
"ERROR: server returned $server_status\n";
46 if ($server->WaitForFileTimed ($iorbase,
47 $server->ProcessStartWaitInterval()) == -1) {
48 print STDERR
"ERROR: cannot find file <$server_iorfile>\n";
49 $SV->Kill (); $SV->TimedWait (1);
53 if ($server->GetFile ($iorbase) == -1) {
54 print STDERR
"ERROR: cannot retrieve file <$server_iorfile>\n";
55 $SV->Kill (); $SV->TimedWait (1);
58 if ($client->PutFile ($iorbase) == -1) {
59 print STDERR
"ERROR: cannot set file <$client_iorfile>\n";
60 $SV->Kill (); $SV->TimedWait (1);
64 print STDERR
"elaped is $elapsed\n";
65 while($elapsed < $max_running_time) {
66 print STDERR
"**************************** \n";
67 # Start all clients in parallel
68 $client = $CL->Spawn ();
70 # ... wait for the clients to die unless they did not startup,
71 # ignore errors because they intentionally crash themselves!
72 $CL->WaitKill($server->ProcessStartWaitInterval() + 20, {self_crash
=> 1}) unless $client < 0;
74 $elapsed = time() - $start_time;
78 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
80 if ($server_status != 0) {
81 print STDERR
"ERROR: server returned $server_status\n";
85 $server->DeleteFile($iorbase);