summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl')
-rwxr-xr-xTAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl187
1 files changed, 121 insertions, 66 deletions
diff --git a/TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl b/TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl
index 819b2375d59..eed9ffff0cc 100755
--- a/TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl
+++ b/TAO/orbsvcs/tests/Bug_1436_Regression/run_test.pl
@@ -2,88 +2,143 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
& eval 'exec perl -S $0 $argv:q'
if 0;
-# -*- perl -*-
# $Id$
+# -*- perl -*-
use lib "$ENV{ACE_ROOT}/bin";
-use PerlACE::Run_Test;
+use PerlACE::TestTarget;
+
+$status = 0;
+$debug_level = '0';
+
+foreach $i (@ARGV) {
+ if ($i eq '-debug') {
+ $debug_level = '10';
+ }
+}
+
+my $ifr_service = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $tao_ifr = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
# The location of the implementation repository binaries
-$ifr_bin_path = "../../IFR_Service";
+my $ifr_bin_path = "../../IFR_Service";
# The location of the tao_ifr IFR utility
-$tao_ifr_bin_path = "$ENV{ACE_ROOT}/bin";
+my $tao_ifr_bin_path = "$ENV{ACE_ROOT}/bin";
-# IOR file names
-$ifr_ior_file = PerlACE::LocalFile("ifr.ior");
+# IOR file
+my $ior_file = "ifr.ior";
# IDL File
-$idl_file = PerlACE::LocalFile("test.idl");
+my $idl_file = "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, $PerlACE::wait_interval_for_process_creation) == -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;
+my @result_files = ();
+for ($i = 0; $i < 2; $i++) {
+ $result_files[$i] = "test_result_$i.log";
+}
+
+#Files specification
+$tao_ifr_idlfile = $tao_ifr->LocalFile($idl_file);
+$tao_ifr_iorfile = $tao_ifr->LocalFile($ior_file);
+
+$ifr_service_iorfile = $ifr_service->LocalFile($ior_file);
+
+$tao_ifr->DeleteFile($ior_file);
+$ifr_service->DeleteFile($ior_file);
+
+$ifr_service_result_file = $ifr_service->LocalFile ($result_files[0]);
+$tao_ifr_result_file = $ifr_service->LocalFile ($result_files[1]);
+$ifr_service->DeleteFile ($result_files[0]);
+$tao_ifr->DeleteFile ($result_files[1]);
+
+$IFRSERVICE = $ifr_service->CreateProcess("$ifr_bin_path/IFR_Service", "-ORBdebuglevel $debug_level ".
+ "-ORBLogFile $ifr_service_result_file ".
+ "-o $ifr_service_iorfile");
+$TAOIFR = $tao_ifr->CreateProcess("$tao_ifr_bin_path/tao_ifr", "-ORBLogFile $tao_ifr_result_file ".
+ "-ORBInitRef InterfaceRepository=file://$tao_ifr_iorfile ".
+ "-Cw $tao_ifr_idlfile");
+
+sub analyse_results {
+ my $result_file = $_[0];
+
+ if (! -r $result_file) {
+ print STDERR "ERROR: cannot find $result_file\n";
+ return 1;
+ }
+
+ my $match = 0;
+ open (FILE, $result_file) or return -1;
+ while (<FILE>) {
+ $match = /Warning - identifier spellings differ only in case:/;
+ last if $match;
+ }
+ close FILE;
+
+ return $match ? 0 : -1;
+}
+
+sub test_body {
+ # Start the IFR Service to generate an IOR file for the tao_ifr to use...
+ $ifr_status = $IFRSERVICE->Spawn ();
+
+ if ($ifr_status != 0) {
+ print STDERR "ERROR: ifr_service Spawn returned $ifr_status\n";
+ return 1;
+ }
+
+ if ($ifr_service->WaitForFileTimed ($ior_file,
+ $ifr_service->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$ifr_service_iorfile>\n";
+ $IFRSERVICE->Kill (); $IFRSERVICE->TimedWait (1);
+ return 1;
+ }
+
+ if ($ifr_service->GetFile ($ior_file) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$ifr_service_iorfile>\n";
+ $IFRSERVICE->Kill (); $IFRSERVICE->TimedWait (1);
+ return 1;
+ }
+
+ if ($tao_ifr->PutFile ($ior_file) == -1) {
+ print STDERR "ERROR: cannot set file <$tao_ifr_iorfile>\n";
+ $IFRSERVICE->Kill (); $IFRSERVICE->TimedWait (1);
+ return 1;
+ }
+
+ $tao_status = $TAOIFR->SpawnWaitKill ($tao_ifr->ProcessStartWaitInterval() + 15);
+ if ($tao_status != 0) {
+ print STDERR "ERROR: tao_ifr returned $tao_status\n";
+ $status = 1;
+ }
+
+ $match = 0;
+# $match = analyse_results ($ifr_service_result_file); $ # this string is not currently needed
+ $match += analyse_results ($tao_ifr_result_file);
+
+ # Tidy up
+ $ifr_status = $IFRSERVICE->TerminateWaitKill ($ifr_service->ProcessStopWaitInterval());
+ if ($ifr_status != 0) {
+ print STDERR "ERROR: ifr_service TerminateWaitKill returned $ifr_status\n";
+ return 1;
+ }
+
+ return $match;
}
# Run regression for bug #1436
-$test_result = test_body();
+$status = test_body();
-if ($test_result != 0)
-{
- print STDERR "ERROR: Regression test for Bug #1436 failed\n";
+if ($status != 0) {
+ print STDERR "ERROR: Regression test for Bug #1436 failed\n";
}
-else
-{
- print "Regression test for Bug #1436 passed.\n";
+else {
+ print "Regression test for Bug #1436 passed.\n";
}
-unlink $ifr_ior_file;
-unlink $result_file;
-exit $test_result;
+$tao_ifr->DeleteFile($ior_file);
+$ifr_service->DeleteFile($ior_file);
+$ifr_service->DeleteFile ($result_files[0]);
+$tao_ifr->DeleteFile ($result_files[1]);
+
+exit $status;