Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / Bug_1020_Basic_Regression / run_test.pl
blob5b0df8e1a27a44c221fdedc0bf94c0e07d7e7a33
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 local $start_time = time();
14 local $max_running_time = 300; # 5 minutes
15 local $elapsed = time() - $start_time;
17 foreach $i (@ARGV) {
18 if ($i eq '-debug') {
19 $debug_level = '10';
21 if ($i eq '-quick') {
22 $elapsed = 0;
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";
43 exit 1;
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);
50 exit 1;
53 if ($server->GetFile ($iorbase) == -1) {
54 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
55 $SV->Kill (); $SV->TimedWait (1);
56 exit 1;
58 if ($client->PutFile ($iorbase) == -1) {
59 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
60 $SV->Kill (); $SV->TimedWait (1);
61 exit 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";
82 $status = 1;
85 $server->DeleteFile($iorbase);
87 exit $status;