Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_1437_Regression / run_test.pl
blobd67223afd2b23d823db4a03440e3d3245cd9965e
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 $locator = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $activator = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $tao_imr = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 # The location of the implementation repository binaries
24 my $imr_bin_path = "";
26 my $imr_ior = "impl.ior";
27 my $activator_ior = "activator.ior";
29 my $locator_imr_iorfile = $locator->LocalFile ($imr_ior);
30 my $activator_iorfile = $activator->LocalFile ($activator_ior);
31 my $activator_imr_iorfile = $activator->LocalFile ($imr_ior);
32 my $tao_imr_imr_iorfile = $tao_imr->LocalFile ($imr_ior);
33 $locator->DeleteFile ($imr_ior);
34 $activator->DeleteFile ($activator_ior);
35 $activator->DeleteFile ($imr_ior);
36 $tao_imr->DeleteFile ($imr_ior);
38 # Run the IMR locator on a fixed port
39 my $locator_port = $locator->RandomPort();
41 $LC = $locator->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_locator",
42 "-ORBdebuglevel $debug_level -o $locator_imr_iorfile ".
43 "-ORBEndpoint iiop://:$locator_port");
45 $AC = $activator->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_activator",
46 "-ORBdebuglevel $debug_level -o $activator_iorfile ".
47 "-ORBInitRef ImplRepoService=file://$activator_imr_iorfile");
49 $TI = $tao_imr->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_imr",
50 "-ORBInitRef ImplRepoService=file://$tao_imr_imr_iorfile add \"\"");
52 sub test_body {
54 $process_status = $LC->Spawn ();
56 if ($process_status != 0) {
57 print STDERR "ERROR: locator returned $process_status\n";
58 return 1;
61 if ($locator->WaitForFileTimed ($imr_ior,
62 $locator->ProcessStartWaitInterval()) == -1) {
63 print STDERR "ERROR: cannot find file <$locator_imr_iorfile>\n";
64 $LC->Kill (); $LC->TimedWait (1);
65 return 1;
68 if ($locator->GetFile ($imr_ior) == -1) {
69 print STDERR "ERROR: cannot retrieve file <$locator_imr_iorfile>\n";
70 $LC->Kill (); $LC->TimedWait (1);
71 return 1;
74 if ($activator->PutFile ($imr_ior) == -1) {
75 print STDERR "ERROR: cannot set file <$activator_imr_iorfile>\n";
76 $LC->Kill (); $LC->TimedWait (1);
77 return 1;
80 if ($tao_imr->PutFile ($imr_ior) == -1) {
81 print STDERR "ERROR: cannot set file <$tao_imr_imr_iorfile>\n";
82 $LC->Kill (); $LC->TimedWait (1);
83 return 1;
86 $process_status = $AC->Spawn ();
88 if ($process_status != 0) {
89 print STDERR "ERROR: activator returned $process_status\n";
90 $LC->Kill (); $LC->TimedWait (1);
91 return 1;
94 if ($activator->WaitForFileTimed ($activator_ior,
95 $activator->ProcessStartWaitInterval()) == -1) {
96 print STDERR "ERROR: cannot find file <$activator_iorfile>\n";
97 $AC->Kill (); $AC->TimedWait (1);
98 $LC->Kill (); $LC->TimedWait (1);
99 return 1;
102 # Add the illegal persistent POA name to the IMR
103 $result = $TI->SpawnWaitKill ($tao_imr->ProcessStartWaitInterval() + 15);
105 # If the add of an empty string failed, then
106 # the test of the tao_imr succeeded.
107 if ($result != 0) {
108 $result = 0;
110 else {
111 $result = -1;
114 # Tidy up
115 $AC->TerminateWaitKill ($activator->ProcessStopWaitInterval());
116 $LC->TerminateWaitKill ($locator->ProcessStopWaitInterval());
117 return $result;
120 # Run regression for bug #1437
121 $status = test_body();
123 if ($status != 0) {
124 print STDERR "ERROR: Regression test for Bug #1437 failed\n";
126 else {
127 print "Regression test for Bug #1437 passed.\n";
130 $locator->DeleteFile ($imr_ior);
131 $activator->DeleteFile ($activator_ior);
132 $activator->DeleteFile ($imr_ior);
133 $tao_imr->DeleteFile ($imr_ior);
135 exit $status;