Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / DIOP / run_test.pl
blob8765f1731bab7b407becefe3a3b000e6ea887250
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 $iterations = '10';
14 $port = '8888';
15 $timeout = '10';
17 foreach $i (@ARGV) {
18 if ($i eq '-debug') {
19 $debug_level = '10';
23 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
24 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
26 my $iorbase = "test.ior";
27 my $server_iorfile = $server->LocalFile ($iorbase);
28 my $client_iorfile = $client->LocalFile ($iorbase);
29 $server->DeleteFile($iorbase);
30 $client->DeleteFile($iorbase);
33 $SV = $server->CreateProcess ("server",
34 "-ORBdebuglevel $debug_level " .
35 "-ORBEndpoint diop://:$port " .
36 "-o $server_iorfile");
38 $CL = $client->CreateProcess ("client",
39 "-ORBdebuglevel $debug_level " .
40 "-k file://$client_iorfile " .
41 "-t $timeout -i $iterations");
43 $server_status = $SV->Spawn ();
45 if ($server_status != 0) {
46 print STDERR "ERROR: server returned $server_status\n";
47 exit 1;
50 if ($server->WaitForFileTimed ($iorbase,
51 $server->ProcessStartWaitInterval()) == -1) {
52 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
53 $SV->Kill (); $SV->TimedWait (1);
54 exit 1;
57 if ($server->GetFile ($iorbase) == -1) {
58 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
59 $SV->Kill (); $SV->TimedWait (1);
60 exit 1;
62 if ($client->PutFile ($iorbase) == -1) {
63 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
64 $SV->Kill (); $SV->TimedWait (1);
65 exit 1;
68 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 75);
70 if ($client_status != 0) {
71 print STDERR "ERROR: client returned $client_status\n";
72 $status = 1;
75 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
77 if ($server_status != 0) {
78 print STDERR "ERROR: server returned $server_status\n";
79 $status = 1;
82 $server->DeleteFile($iorbase);
83 $client->DeleteFile($iorbase);
85 exit $status;