Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_1393_Regression / run_test.pl
blobe4aec517a7e66bcb49b311515df880cf44fd7568
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;
12 my @generated_files = ("testC.h", "testC.cpp", "testC.inl", "testS.h", "testS.cpp");
14 # The location of the IFR_Service binary
15 my $ifr_service_bin = "$ENV{TAO_ROOT}/orbsvcs/IFR_Service";
17 # The location of the tao_ifr utility binary
18 my $tao_ifr_bin = "$ENV{ACE_ROOT}/bin";
20 # The location of the tao_idl utility binary
21 my $tao_idl = "$ENV{ACE_ROOT}/bin/tao_idl";
22 if (exists $ENV{HOST_ROOT}) {
23 $tao_idl = "$ENV{HOST_ROOT}/bin/tao_idl";
26 my $service = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
27 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
28 my $taoifr = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
30 # The idl file to be used for the test
31 my $test_idl = "test.idl";
32 my $ifr_ior = "ifr.ior";
33 my $service_test_idl = $service->LocalFile ($test_idl);
34 my $taoifr_test_idl = $taoifr->LocalFile ($test_idl);
35 my $service_ifr_ior = $service->LocalFile($ifr_ior);
36 my $taoifr_ifr_ior = $taoifr->LocalFile($ifr_ior);
37 my $client_ifr_ior = $client->LocalFile($ifr_ior);
38 $service->DeleteFile ($ifr_ior);
39 $client->DeleteFile ($ifr_ior);
40 $taoifr->DeleteFile ($ifr_ior);
42 $TAO_IDL = $service->CreateProcess("$tao_idl", "$service_test_idl");
43 $IFR_SERVICE = $service->CreateProcess("$ifr_service_bin/tao_ifr_service", "-o $service_ifr_ior");
44 $TAO_IFR = $service->CreateProcess("$tao_ifr_bin/tao_ifr",
45 "-ORBInitRef InterfaceRepository=file://$taoifr_ifr_ior ".
46 "$taoifr_test_idl");
47 $CL = $client->CreateProcess("client", "-ORBInitRef InterfaceRepository=file://$client_ifr_ior");
49 # Create an idl file contaning an interface with a C++ reserved word name
50 open(HANDLE, ">$service_test_idl");
51 print HANDLE <<_EOF_
52 interface int {
54 _EOF_
56 close(HANDLE);
58 my $result = $TAO_IDL->SpawnWaitKill ($service->ProcessStartWaitInterval() + 15);
60 # Search one of the stub files for the munged for of the interface name
61 if ($result == 0) {
62 $result = 1;
63 open (HANDLE, "<testC.h");
64 while (<HANDLE>) {
65 if (/^class\s+_cxx_int/) {
66 $result = 0;
67 last;
70 close (HANDLE);
73 # Check result of idl compiler test
74 if ($result != 0) {
75 print STDERR "ERROR: Bug #1393 Idl compiler test failed\n";
76 $status = 1;
79 # Delete files created during IDL compilation
80 foreach $file(@generated_files) {
81 $service->DeleteFile ($file)
84 # Start the IFR service
85 $result = $IFR_SERVICE->Spawn();
87 if ($result != 0) {
88 print STDERR "ERROR: IFR service returned $result\n";
89 exit 1;
92 if ($service->WaitForFileTimed ($ifr_ior, $service->ProcessStartWaitInterval()) == -1) {
93 print STDERR "ERROR: cannot find $service_ifr_ior\n";
94 $IFR_SERVICE->Kill (); $IFR_SERVICE->TimedWait (1);
95 $status = 1;
98 if ($service->GetFile ($test_idl) == -1) {
99 print STDERR "ERROR: cannot retrieve file <$service_test_idl>\n";
100 $IFR_SERVICE->Kill (); $IFR_SERVICE->TimedWait (1);
101 exit 1;
104 if ($service->GetFile ($ifr_ior) == -1) {
105 print STDERR "ERROR: cannot retrieve file <$service_ifr_ior>\n";
106 $IFR_SERVICE->Kill (); $IFR_SERVICE->TimedWait (1);
107 exit 1;
110 if ($taoifr->PutFile ($test_idl) == -1) {
111 print STDERR "ERROR: cannot set file <$taoifr_test_idl>\n";
112 $IFR_SERVICE->Kill (); $IFR_SERVICE->TimedWait (1);
113 exit 1;
116 if ($taoifr->PutFile ($ifr_ior) == -1) {
117 print STDERR "ERROR: cannot set file <$taoifr_ifr_ior>\n";
118 $IFR_SERVICE->Kill (); $IFR_SERVICE->TimedWait (1);
119 exit 1;
122 if ($client->PutFile ($ifr_ior) == -1) {
123 print STDERR "ERROR: cannot set file <$client_ifr_ior>\n";
124 $IFR_SERVICE->Kill (); $IFR_SERVICE->TimedWait (1);
125 exit 1;
128 # Use the iao_ifr utility to add our test IDL
129 $result = $TAO_IFR->SpawnWaitKill ($taoifr->ProcessStartWaitInterval() + 15);
131 if ($result != 0) {
132 print STDERR "ERROR: Failed to add IDL to interface repository\n";
133 $status = 1;
136 # Invoke the client code that retrieves the interface and checks it's not munged
137 $result = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 15);
139 if ($result != 0) {
140 print STDERR "ERROR: Interface definition incorrect in IFR\n";
141 $status = 1;
144 # Tidy up
145 $IFR_SERVICE->TerminateWaitKill ($service->ProcessStopWaitInterval());
147 $service->DeleteFile ($test_idl);
148 $taoifr->DeleteFile ($test_idl);
149 $service->DeleteFile ($ifr_ior);
150 $client->DeleteFile ($ifr_ior);
151 $taoifr->DeleteFile ($ifr_ior);
153 exit $status;