summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorharrisb <harrisb@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2013-02-01 22:01:23 +0000
committerharrisb <harrisb@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2013-02-01 22:01:23 +0000
commitb530f39b37d1aed6b4fa56dadf74365ead09f3a5 (patch)
treedc137dea2ceb1bf27f1d760a922e7d12d34584b7
parente5f22f8ff3dda27cf0a7406affff3b41c3001dd6 (diff)
downloadATCD-b530f39b37d1aed6b4fa56dadf74365ead09f3a5.tar.gz
Fri Feb 1 21:55:33 UTC 2013 Byron Harris <harrisb@ociweb.com>
-rw-r--r--TAO/OCI_RE_ChangeLog12
-rwxr-xr-xTAO/tests/Storable/run_test.pl27
-rw-r--r--TAO/tests/Storable/test.cpp22
3 files changed, 50 insertions, 11 deletions
diff --git a/TAO/OCI_RE_ChangeLog b/TAO/OCI_RE_ChangeLog
index 23ef42bc7c1..d3f9b3336aa 100644
--- a/TAO/OCI_RE_ChangeLog
+++ b/TAO/OCI_RE_ChangeLog
@@ -1,3 +1,15 @@
+Fri Feb 1 21:55:33 UTC 2013 Byron Harris <harrisb@ociweb.com>
+
+ * tests/Storable/run_test.pl:
+
+ Allow number of loops and loop delay to be specified
+ from the command line to manually determine values
+ that could cause test failure.
+
+ * tests/Storable/test.cpp:
+
+ Code clean up.
+
Fri Feb 1 21:44:54 UTC 2013 Marc Neeley <neeley_m@ociweb.com>
* orbsvcs/tests/ImplRepo/run_test.pl:
diff --git a/TAO/tests/Storable/run_test.pl b/TAO/tests/Storable/run_test.pl
index 82f73de38a6..10d340d34e6 100755
--- a/TAO/tests/Storable/run_test.pl
+++ b/TAO/tests/Storable/run_test.pl
@@ -48,13 +48,33 @@ sub restore_output()
my $persistent_file = "test.dat";
$test1->DeleteFile ($persistent_file);
-my $num_loops = 10;
+my $num_loops = 5;
+my $loop_sleep_msec = 200;
+
+if ($#ARGV >= 0) {
+ for (my $i = 0; $i <= $#ARGV; $i++) {
+ if ($ARGV[$i] eq '-num_loops') {
+ $i++;
+ $num_loops = $ARGV[$i];
+ }
+ elsif ($ARGV[$i] eq "-loop_sleep") {
+ $i++;
+ $loop_sleep_msec = $ARGV[$i];
+ }
+ else {
+ print "Usage: run_test.pl ".
+ "[-num_loops <num=$num_loops>] ".
+ "[-loop_sleep <msec=$loop_sleep_msec>]\n";
+ exit 1;
+ }
+ }
+}
$T1 = $test1->CreateProcess ("test", "-i 0 -n $num_loops");
my $test2 = PerlACE::TestTarget::create_target (2) || die "Create target 1 failed\n";
-$T2 = $test2->CreateProcess ("test", "-i 1 -n $num_loops");
+$T2 = $test2->CreateProcess ("test", "-i 1 -n $num_loops -s $loop_sleep_msec");
$test1_status = $T1->Spawn ();
@@ -115,7 +135,8 @@ sub test_backup_recovery($)
print STDERR "ERROR: Backup file was not created\n";
}
$test1->DeleteFile ($persistent_file);
-
+ $test1->DeleteFile ($stdout_file);
+ $test1->DeleteFile ($stderr_file);
return $status;
}
diff --git a/TAO/tests/Storable/test.cpp b/TAO/tests/Storable/test.cpp
index 9ca675a754a..d9f74cb7763 100644
--- a/TAO/tests/Storable/test.cpp
+++ b/TAO/tests/Storable/test.cpp
@@ -6,6 +6,10 @@
// and reads from the group written by the
// other process. After reading a check is
// made that expected values are read.
+// A sleep is done at the end of the loop
+// to account for limitation in resolution
+// of timestamp on file used to determine
+// if the file is stale.
#include "Savable.h"
@@ -104,6 +108,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
bytes_write_value[i] = i;
}
+ ACE_Time_Value sleep_time (0, 1000*sleep_msecs);
+
try
{
for (int j = 0; j < num_loops; ++j)
@@ -120,8 +126,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
int int_read = savable.int_get(read_index);
// If value read is not 0 then the other
- // process have written to persistent store.
- // If not, it's too soon test.
+ // process has written to persistent store.
+ // If not, it's too soon to test.
if (int_read != 0)
{
ACE_ASSERT (int_read == int_write_value);
@@ -129,10 +135,12 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
const ACE_CString & str_read = savable.string_get(read_index);
ACE_ASSERT (str_read == str_write_value);
- unsigned int unsigned_int_read = savable.unsigned_int_get (read_index);
+ unsigned int unsigned_int_read =
+ savable.unsigned_int_get (read_index);
ACE_ASSERT (unsigned_int_read == unsigned_int_write_value);
- int bytes_read_size = savable.bytes_get (read_index, bytes_read);
+ int bytes_read_size =
+ savable.bytes_get (read_index, bytes_read);
ACE_ASSERT (bytes_read_size == bytes_size);
for (int k = 0; k < bytes_size; ++k)
{
@@ -141,21 +149,19 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
}
- ACE_Time_Value sleep_time (0, 1000*sleep_msecs);
-
// Write out state
savable.string_set(write_index, str_write_value);
savable.int_set(write_index, int_write_value);
savable.unsigned_int_set(write_index, unsigned_int_write_value);
savable.bytes_set(write_index, bytes_size, bytes_write_value);
- ACE_OS::sleep (sleep_time);
int bytes_size = savable.bytes_get (write_index, bytes_read);
for (int k = 0; k < bytes_size; ++k)
{
ACE_ASSERT (bytes_read[k] == bytes_write_value[k]);
}
- }
+ ACE_OS::sleep (sleep_time);
+ }
}
catch (Savable_Exception &)