summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl
blob: 0df86c0cb02b1bbbee01d5e3f23ed11dad04d55a (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
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;

# The location of the implementation repository binaries
$ifr_bin_path = "../../IFR_Service";

# The location of the tao_ifr IFR utility
$tao_ifr_bin_path = "$ENV{ACE_ROOT}/bin";

# IOR file names
$ifr_ior_file = PerlACE::LocalFile("ifr.ior");

# IDL File
$idl_file = PerlACE::LocalFile("test.idl");

#Log file
$result_file = PerlACE::LocalFile("test_result.log");

$IFRSERVICE = new PerlACE::Process("$ifr_bin_path/IFR_Service");
$TAO_IFR    = new PerlACE::Process("$tao_ifr_bin_path/tao_ifr");

sub test_body
{
   unlink $ifr_ior_file;

   # Start the IFR Service to generate an IOR file for the tao_ifr to use...
   $IFRSERVICE->Arguments("-o $ifr_ior_file ");
   $IFRSERVICE->Spawn ();

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

   # Redirect STDERR to a log file so that
   # we can make sure that we got a warning
   open(SAVEERR, ">&STDERR");
   open(STDERR, ">$result_file");

   $TAO_IFR->Arguments("-ORBInitRef InterfaceRepository=file://$ifr_ior_file -Cw $idl_file");
   $TAO_IFR->SpawnWaitKill (30);

   # Close the log file and restore STDERR
   close(STDERR);
   open(STDERR, ">&SAVEERR");

   if (! -r $result_file) {
      print STDERR "ERROR: cannot find $result_file\n";
      $IFRSERVICE->Kill ();
      $TAO_IFR->Kill ();
      return 1;
   }

   $match = 0;
   open (FILE, $result_file) or return -1;
   while (<FILE>) {
       $match = /Warning - identifier spellings differ only in case:/;
       last if $match;
      }
   close FILE;
   # Tidy up
   $IFRSERVICE->TerminateWaitKill (5);
   return $match ? 0 : -1;
}

# Run regression for bug #1436
$test_result = test_body();

if ($test_result != 0)
{
   print STDERR "ERROR: Regression test for Bug #1436 failed\n";
}
else
{
   print "Regression test for Bug #1436 passed.\n";
}

unlink $ifr_ior_file;
unlink $result_file;
exit $test_result;