Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / examples / Persistent_Grid / run_test.pl
blob4dee14d76e555094f94a729b64d2661f3d1aba35
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";
20 my $client1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $client2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 my $iorbase = "server.ior";
24 my $membase = "foobar";
25 my $server_iorfile = $server->LocalFile ($iorbase);
26 my $server_memfile = $server->LocalFile ($membase);
27 my $client1_iorfile = $client1->LocalFile ($iorbase);
28 my $client2_iorfile = $client2->LocalFile ($iorbase);
29 $server->DeleteFile($iorbase);
30 $server->DeleteFile($membase);
31 $client1->DeleteFile($iorbase);
32 $client2->DeleteFile($iorbase);
34 $SV = $server->CreateProcess ("server",
35 "-ORBdebuglevel $debug_level " .
36 "-o $server_iorfile -m $server_memfile");
37 $CL1 = $client1->CreateProcess ("client", "-k file://$client1_iorfile");
38 $CL2 = $client2->CreateProcess ("persistent_client",
39 "-k file://$client2_iorfile -w 10 -h 10");
41 $server_status = $SV->Spawn ();
43 if ($server_status != 0) {
44 print STDERR "ERROR: server returned $server_status\n";
45 exit 1;
48 if ($server->WaitForFileTimed ($iorbase,
49 $server->ProcessStartWaitInterval()) == -1) {
50 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
51 $SV->Kill (); $SV->TimedWait (1);
52 exit 1;
55 if ($server->GetFile ($iorbase) == -1) {
56 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
57 $SV->Kill (); $SV->TimedWait (1);
58 exit 1;
60 if ($client1->PutFile ($iorbase) == -1) {
61 print STDERR "ERROR: cannot set file <$client1_iorfile>\n";
62 $SV->Kill (); $SV->TimedWait (1);
63 exit 1;
66 $client_status = $CL1->SpawnWaitKill ($client1->ProcessStartWaitInterval() + 45);
68 if ($client_status != 0) {
69 print STDERR "ERROR: client returned $client_status\n";
70 $SV->Kill (); $SV->TimedWait (1);
71 exit 1;
74 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
76 if ($server_status != 0) {
77 print STDERR "ERROR: server returned $server_status\n";
78 exit 1;
81 $server->DeleteFile($iorbase);
82 $client1->DeleteFile($iorbase);
83 $client2->DeleteFile($iorbase);
85 $server_status = $SV->Spawn ();
87 if ($server_status != 0) {
88 print STDERR "ERROR: server returned $server_status\n";
89 exit 1;
92 if ($server->WaitForFileTimed ($iorbase,
93 $server->ProcessStartWaitInterval()) == -1) {
94 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
95 $SV->Kill (); $SV->TimedWait (1);
96 exit 1;
99 if ($server->GetFile ($iorbase) == -1) {
100 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
101 $SV->Kill (); $SV->TimedWait (1);
102 exit 1;
104 if ($client2->PutFile ($iorbase) == -1) {
105 print STDERR "ERROR: cannot set file <$client2_iorfile>\n";
106 $SV->Kill (); $SV->TimedWait (1);
107 exit 1;
110 $client_status = $CL2->SpawnWaitKill ($client2->ProcessStartWaitInterval() + 45);
112 if ($client_status != 0) {
113 print STDERR "ERROR: client returned $client_status\n";
114 $SV->Kill (); $SV->TimedWait (1);
115 exit 1;
118 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
120 if ($server_status != 0) {
121 print STDERR "ERROR: server returned $server_status\n";
122 $status = 1;
125 $server->DeleteFile($iorbase);
126 $server->DeleteFile($membase);
127 $client1->DeleteFile($iorbase);
128 $client2->DeleteFile($iorbase);
130 exit $status;