Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / Bug_2494_Regression / run_test.pl
blob7e075ee3f60459469394edda0f52b306ccca79b3
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 $srv_threads = '4';
12 $cli_threads = '30';
14 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
15 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
17 my $iorbase = "test.ior";
18 my $server_iorfile = $server->LocalFile ($iorbase);
19 my $client_iorfile = $client->LocalFile ($iorbase);
20 $server->DeleteFile($iorbase);
21 $client->DeleteFile($iorbase);
23 $srvdownfile = "server_terminated";
24 $server_srvdownfile = $server->LocalFile ($srvdownfile);
26 $SV = $server->CreateProcess ("server",
27 "-o $server_iorfile " .
28 "-n $srv_threads");
30 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile -n $cli_threads");
32 $server_status = $SV->Spawn ();
34 if ($server_status != 0) {
35 print STDERR "ERROR: server returned $server_status\n";
36 exit 1;
38 if ($server->WaitForFileTimed ($iorbase,
39 $server->ProcessStartWaitInterval()) == -1) {
40 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
41 $SV->Kill (); $SV->TimedWait (1);
42 exit 1;
45 if ($server->GetFile ($iorbase) == -1) {
46 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
47 $SV->Kill (); $SV->TimedWait (1);
48 exit 1;
50 if ($client->PutFile ($iorbase) == -1) {
51 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
52 $SV->Kill (); $SV->TimedWait (1);
53 exit 1;
56 $CL->Spawn ();
57 #Client will not terminate on its own, kill it after 30 seconds
58 $CL->TimedWait ($client->ProcessStartWaitInterval() + 15);
59 $CL->Kill ();
61 print "***Client has been killed***\n";
63 #Server should still be running at this point, now start the client that asks
64 #the server to shut itself down
66 $CL->Arguments ("-k file://$client_iorfile -x");
68 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
69 if ($client_status != 0) {
70 print STDERR "ERROR: client returned $client_status\n";
71 $status = 1;
74 #Server should now be shutdown
75 if ($server->WaitForFileTimed ($srvdownfile,
76 $server->ProcessStartWaitInterval()) == -1) {
77 print STDERR "ERROR: cannot find file <$server_srvdownfile>".
78 " -- server has not shut down cleanly.\n";
79 $SV->Kill (); $SV->TimedWait (1);
80 exit 1;
83 $status_server = $SV->WaitKill ($server->ProcessStopWaitInterval());
85 if ($status_server != 0) {
86 print STDERR "ERROR: server returned $status_server\n";
87 $status = 1;
90 $server->DeleteFile ($iorbase);
91 $client->DeleteFile ($iorbase);
92 $server->DeleteFile ($srvdownfile);
94 exit $status;