Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / InterfaceRepo / IDL3_Test / run_test.pl
blobf1cc0540573e49e5e9134953f4e50301ad4d35c0
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 $includes = "-I ../../../.. -I ../../../../orbsvcs";
12 $status = 0;
13 $debug_level = '0';
14 $debug_client = '';
16 foreach $i (@ARGV) {
17 if ($i eq '-debug') {
18 $debug_level = '10';
20 if ($i eq '-d') {
21 $debug_client = "-n";
25 my $server1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
26 my $server2 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
27 my $client = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
29 my $ior1file = "ifr.ior";
31 #Files which used by server1
32 my $server1_ior1file = $server1->LocalFile ($ior1file);
33 $server1->DeleteFile($ior1file);
35 #Files which used by server2
36 my $server2_ior1file = $server2->LocalFile ($ior1file);
37 $server2->DeleteFile($ior1file);
39 #Files which used by client
40 my $client_ior1file = $client->LocalFile ($ior1file);
41 $client->DeleteFile($ior1file);
44 $SV1 = $server1->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/IFR_Service/tao_ifr_service",
45 "-ORBdebuglevel $debug_level " .
46 "-o $server1_ior1file");
48 $SV2 = $server2->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_ifr",
49 "-ORBdebuglevel $debug_level " .
50 "-ORBInitRef InterfaceRepository=file://$server1_ior1file $includes test.idl");
52 $CL = $client->CreateProcess ("IDL3_Test",
53 "-ORBInitRef InterfaceRepository=file://$client_ior1file " .
54 "$debug_client");
56 $server_status = $SV1->Spawn ();
58 if ($server_status != 0) {
59 print STDERR "ERROR: server returned $server_status\n";
60 exit 1;
63 if ($server1->WaitForFileTimed ($ior1file,
64 $server1->ProcessStartWaitInterval()) == -1) {
65 print STDERR "ERROR: cannot find file <$server1_ior1file>\n";
66 $SV1->Kill (); $SV1->TimedWait (1);
67 exit 1;
70 if ($server1->GetFile ($ior1file) == -1) {
71 print STDERR "ERROR: cannot retrieve file <$server1_ior1file>\n";
72 $SV1->Kill (); $SV1->TimedWait (1);
73 exit 1;
76 if ($server2->PutFile ($ior1file) == -1) {
77 print STDERR "ERROR: cannot set file <$server2_ior1file>\n";
78 $SV1->Kill (); $SV1->TimedWait (1);
79 exit 1;
82 if ($client->PutFile ($ior1file) == -1) {
83 print STDERR "ERROR: cannot set file <$client_ior1file>\n";
84 $SV1->Kill (); $SV1->TimedWait (1);
85 exit 1;
88 $server_status = $SV2->SpawnWaitKill ($server2->ProcessStartWaitInterval());
90 if ($server_status != 0) {
91 print STDERR "ERROR: server returned $server_status\n";
92 exit 1;
95 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
97 if ($client_status != 0) {
98 print STDERR "ERROR: client returned $client_status\n";
99 $status = 1;
102 $server_status = $SV1->TerminateWaitKill ($server1->ProcessStopWaitInterval());
104 if ($server_status != 0) {
105 print STDERR "ERROR: server returned $server_status\n";
106 $status = 1;
109 $server1->DeleteFile($ior1file);
110 $server2->DeleteFile($ior1file);
111 $client->DeleteFile($ior1file);
113 exit $status;