summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Bug_1393_Regression/run_test.pl
blob: 816c0a4a17cb41c9877eedabc9f709a458f6dd31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
     & eval 'exec perl -S $0 $argv:q'
     if 0;

# -*- perl -*-
# $Id$

use lib "$ENV{ACE_ROOT}/bin";
use PerlACE::Run_Test;

$status = 0;

# The location of the IFR_Service binary
$ifr_service_bin = "../../IFR_Service";

# The location of the tao_ifr utility binary
$tao_ifr_bin = "../../../../bin";

# The location of the tao_idl utility binary
$tao_idl_bin = "../../../../bin";

# The idl file to be used for the test
$test_idl = PerlACE::LocalFile("test.idl");

# Create an idl file contaning an interface with a C++ reserved word name
open(HANDLE, ">$test_idl");
print HANDLE <<_EOF_
interface int 
{
};
_EOF_
;
close(HANDLE);

$TAO_IDL    = new PerlACE::Process("$tao_idl_bin/tao_idl");
$TAO_IDL->Arguments("$test_idl");
$result = $TAO_IDL->SpawnWaitKill (30);

# Search one of the stub files for the munged for of the interface name
if ($result == 0) 
{
   $result = 1;
   open (HANDLE, "<testC.h");
   while (<HANDLE>)
   {
      if (/^class\s+_cxx_int/)
      {
         $result = 0;
         last;
      }
   }
   close(HANDLE);  
}

# Check result of idl compiler test
if ($result != 0)
{
   print STDERR "ERROR: Bug #1393 Idl compiler test failed\n";
   $status = 1;
}

# Delete files created during IDL compilation
unlink <test*.h>;
unlink <test*.cpp>;
unlink <test*.inl>;
   
# The file name for the IFR service IOR
$ifr_service_ior_file = PerlACE::LocalFile("ifr.ior");
unlink $ifr_service_ior_file;   
   
# Start the IFR service
$IFR_SERVICE = new PerlACE::Process("$ifr_service_bin/IFR_Service");
$IFR_SERVICE->Arguments("-o $ifr_service_ior_file");
$IFR_SERVICE->Spawn();

if (PerlACE::waitforfile_timed ($ifr_service_ior_file, 10) == -1) 
{
   print STDERR "ERROR: cannot find $ifr_service_ior_file\n";
   $IFR_SERVICE->Kill ();
   $status = 1; 
}

# Use the iao_ifr utility to add our test IDL 
$TAO_IFR = new PerlACE::Process("$tao_ifr_bin/tao_ifr");
$TAO_IFR->Arguments("-ORBInitRef InterfaceRepository=file://$ifr_service_ior_file $test_idl"); 
$result = $TAO_IFR->SpawnWaitKill (30);

if ($result != 0)
{
   print STDERR "ERROR: Failed to add IDL to interface repository\n";
   $status = 1;
}

# Invoke the client code that retrieves the interface and checks it's not munged   
$CLIENT = new PerlACE::Process("client");
$CLIENT->Arguments("-ORBInitRef InterfaceRepository=file://$ifr_service_ior_file");
$result = $CLIENT->SpawnWaitKill (30);

if ($result != 0)
{
   print STDERR "ERROR: Interface definition incorrect in IFR\n";
   $status = 1;
}

# Tidy up
$IFR_SERVICE->TerminateWaitKill (10);
unlink $test_idl;
unlink $ifr_service_ior_file;

exit $status;