summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorharrisb <harrisb@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2013-01-28 22:23:04 +0000
committerharrisb <harrisb@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2013-01-28 22:23:04 +0000
commit65e9e6f402dc7a95dfd78b269b87da67774f9485 (patch)
tree6682c1f437e41165908f034415fc3beb4101e017
parente4bb0ff296cefcce625dbe6a5441f1a4d98097b4 (diff)
downloadATCD-65e9e6f402dc7a95dfd78b269b87da67774f9485.tar.gz
Mon Jan 28 22:22:09 UTC 2013 Byron Harris <harrisb@ociweb.com>
-rw-r--r--TAO/OCI_RE_ChangeLog6
-rwxr-xr-xTAO/tests/Storable/run_test.pl38
2 files changed, 44 insertions, 0 deletions
diff --git a/TAO/OCI_RE_ChangeLog b/TAO/OCI_RE_ChangeLog
index a94585e01e0..7e3c7171050 100644
--- a/TAO/OCI_RE_ChangeLog
+++ b/TAO/OCI_RE_ChangeLog
@@ -1,3 +1,9 @@
+Mon Jan 28 22:22:09 UTC 2013 Byron Harris <harrisb@ociweb.com>
+
+ * tests/Storable/run_test.pl:
+
+ Redirect output as was similary done in previous commit.
+
Mon Jan 28 20:09:12 UTC 2013 Byron Harris <harrisb@ociweb.com>
* orbsvcs/tests/FT_Naming/FaultTolerant/run_persistence_test.pl:
diff --git a/TAO/tests/Storable/run_test.pl b/TAO/tests/Storable/run_test.pl
index 137da7af005..82f73de38a6 100755
--- a/TAO/tests/Storable/run_test.pl
+++ b/TAO/tests/Storable/run_test.pl
@@ -13,6 +13,38 @@ my $status = 0;
my $test1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $stdout_file = "test.out";
+my $stderr_file = "test.err";
+my $test_stdout_file = $test1->LocalFile ($stdout_file);
+my $test_stderr_file = $test1->LocalFile ($stderr_file);
+
+sub cat_file($)
+{
+ my $file_name = shift;
+ if (-s $file_name ) # size of file is greater than zero
+ {
+ open TESTFILE, $file_name or die "Couldn't open file: $!";
+ my @teststring = <TESTFILE>; # read in all of the file
+ print STDERR "\n@teststring\n";
+ close TESTFILE;
+ }
+}
+
+sub redirect_output()
+{
+ open (OLDOUT, ">&", \*STDOUT) or die "Can't dup STDOUT: $!";
+ open (OLDERR, ">&", \*STDERR) or die "Can't dup STDERR: $!";
+ open STDERR, '>', $test_stderr_file;
+ open STDOUT, '>', $test_stdout_file;
+}
+
+sub restore_output()
+{
+ open (STDERR, ">&OLDERR") or die "Can't dup OLDERR: $!";
+ open (STDOUT, ">&OLDOUT") or die "Can't dup OLDOUT: $!";
+}
+
+
my $persistent_file = "test.dat";
$test1->DeleteFile ($persistent_file);
@@ -60,10 +92,16 @@ sub test_backup_recovery($)
copy("data_files/good.dat", $backup_file) or die "Copy failed: $!";
$T = $test1->CreateProcess ("test", "-b");
+ # Redirect output so that expected error messages are not interpreted as
+ # test failure and rely instead of return status.
+ redirect_output();
my $test_status = $T->SpawnWaitKill ($test1->ProcessStartWaitInterval());
+ restore_output();
if ($test_status != 0) {
$status = 1;
print STDERR "ERROR: Backup recovery test using $bad_file failed\n";
+ cat_file($test_stderr_file);
+ cat_file($test_stdout_file);
}
else {
print STDERR "Recovery successful\n";