Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / DevGuideExamples / SmartProxies / run_test.pl
blobee78c153dd0240c25aa34c61392d43824ddb263d
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 $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $logger = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 my $iorbase = "Messenger.ior";
24 my $iorlogger = "Logger.ior";
26 my $server_iorfile_base = $server->LocalFile ($iorbase);
27 my $client_iorfile_base = $client->LocalFile ($iorbase);
28 my $logger_iorfile_logger = $logger->LocalFile ($iorlogger);
29 $server->DeleteFile($iorbase);
30 $client->DeleteFile($iorbase);
31 $logger->DeleteFile($iorlogger);
33 $SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level ".
34 "-o $server_iorfile_base");
35 $CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile_base");
36 $LR = $logger->CreateProcess ("LoggerServer", "-ORBdebuglevel $debug_level ".
37 "-o $logger_iorfile_logger");
38 $server_status = $SV->Spawn ();
40 if ($server_status != 0) {
41 print STDERR "ERROR: server returned $server_status\n";
42 exit 1;
45 if ($server->WaitForFileTimed ($iorbase,
46 $server->ProcessStartWaitInterval()) == -1) {
47 print STDERR "ERROR: cannot find file <$server_iorfile_base>\n";
48 $SV->Kill (); $SV->TimedWait (1);
49 exit 1;
52 if ($server->GetFile ($iorbase) == -1) {
53 print STDERR "ERROR: cannot retrieve file <$server_iorfile_base>\n";
54 $SV->Kill (); $SV->TimedWait (1);
55 exit 1;
58 if ($client->PutFile ($iorbase) == -1) {
59 print STDERR "ERROR: cannot set file <$client_iorfile_base>\n";
60 $SV->Kill (); $SV->TimedWait (1);
61 exit 1;
64 $logger_status = $LR->Spawn ();
66 if ($logger_status != 0) {
67 print STDERR "ERROR: logger returned $logger_status\n";
68 exit 1;
71 if ($logger->WaitForFileTimed ($iorlogger,
72 $logger->ProcessStartWaitInterval()) == -1) {
73 print STDERR "ERROR: cannot find file <$logger_iorfile_logger>\n";
74 $LR->Kill (); $LR->TimedWait (1);
75 $SV->Kill (); $SV->TimedWait (1);
76 exit 1;
79 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
81 if ($client_status != 0) {
82 print STDERR "ERROR: client returned $client_status\n";
83 $status = 1;
86 $server_status = $SV->Kill ();
88 if ($server_status != 0) {
89 print STDERR "ERROR: server returned $server_status\n";
90 $status = 1;
93 $logger_status = $LR->Kill ();
95 if ($logger_status != 0) {
96 print STDERR "ERROR: logger returned $logger_status\n";
97 $status = 1;
100 $server->DeleteFile($iorbase);
101 $client->DeleteFile($iorbase);
102 $logger->DeleteFile($iorlogger);
104 exit $status;