summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMike McGreevy <mamcgree@hdfgroup.org>2010-12-08 20:56:28 (GMT)
committerMike McGreevy <mamcgree@hdfgroup.org>2010-12-08 20:56:28 (GMT)
commit25486d50895fa4a30809d289b9aff4de583a9b84 (patch)
treee671da73eed839a04261cb17a6604ef21da6a5ee /test
parentfc38cc4d36abdf26d48ba6bb778702d30bee45b0 (diff)
downloadhdf5-25486d50895fa4a30809d289b9aff4de583a9b84.zip
hdf5-25486d50895fa4a30809d289b9aff4de583a9b84.tar.gz
hdf5-25486d50895fa4a30809d289b9aff4de583a9b84.tar.bz2
[svn-r19879] Purpose:
Improve portability of flushrefresh test. Description: The flush/refresh API test was hanging on linew because Solaris's 'date' tool does not recognize the "+%s" option, which returns time since the epoch on other UNIXes. There doesn't seem to be a good way to unify the tools, however, Perl can be easily used for this function. I've modified configure to always check for the existence of Perl (previously it only did so if GNU compilers were being used), and the flush/refresh test script now uses perl to perform this timestamping functionality rather than date, by default. (if Perl is not detected by configure, the script will use date as it did prior to this modification). Fixed a few other compatibility issues w/ Solaris in passing: - fixed 'head' and 'tail' parameters to be more portable - avoid passing NULL to an fprintf call in flushrefresh.c Tested: - Tested testflushrefresh.sh on jam, linew, heiwa, liberty, duty, ember, and abe.
Diffstat (limited to 'test')
-rwxr-xr-xtest/flushrefresh.c19
-rwxr-xr-xtest/testflushrefresh.sh.in32
2 files changed, 43 insertions, 8 deletions
diff --git a/test/flushrefresh.c b/test/flushrefresh.c
index c79b445..223cf8d 100755
--- a/test/flushrefresh.c
+++ b/test/flushrefresh.c
@@ -1174,11 +1174,26 @@ error:
*/
void send_signal(const char * send, const char * arg1, const char * arg2)
{
- FILE *signalfile;
+
+ FILE *signalfile = NULL;
/* Create signal file (which will send signal to some other process) */
signalfile = fopen(send, "w+");
- HDfprintf(signalfile, "%s\n%s\n", arg1, arg2);
+
+ /* Write messages to signal file, if provided */
+ if (arg2 != NULL) {
+ HDassert(arg1);
+ HDfprintf(signalfile, "%s\n%s\n", arg1, arg2);
+ } /* end if */
+ else if (arg1 != NULL) {
+ HDassert(arg2 == NULL);
+ HDfprintf(signalfile, "%s\n", arg1);
+ } /* end if */
+ else {
+ HDassert(arg1 == NULL);
+ HDassert(arg2 == NULL);
+ }/* end else */
+
HDfflush(signalfile);
HDfclose(signalfile);
diff --git a/test/testflushrefresh.sh.in b/test/testflushrefresh.sh.in
index 2d8da8c..732f32b 100755
--- a/test/testflushrefresh.sh.in
+++ b/test/testflushrefresh.sh.in
@@ -33,8 +33,28 @@
## test variables
###############################################################################
+# Number of errors encountered during test run.
nerrors=0
+# Set up a function to check the current time since the epoch - ideally, we'd
+# like to use Perl. If it wasn't detected by configure, then use date, though
+# this is less portable and might cause problems on machines that don't
+# recognize the +%s option (like Solaris).
+PERL=@PERL@
+if test -n "$PERL"; then
+ TimeStamp()
+ {
+ time=`${PERL} -e 'print int(time)'`
+ echo "$time"
+ }
+else
+ TimeStamp()
+ {
+ time=`date +%s`
+ echo "$time"
+ }
+fi
+
###############################################################################
## Main
###############################################################################
@@ -65,9 +85,9 @@ verification_done=0
until [ $verification_done -eq 1 ]; do
# Wait for signal from test program that verification routine can run.
- before=`date +%s`
+ before=`TimeStamp`
until [ -s $startsignal ]; do
- after=`date +%s`
+ after=`TimeStamp`
timediff=`expr $after - $before`
if [ $timediff -gt $timeout_length ]; then
nerrors=`expr $nerrors + 1`
@@ -83,8 +103,8 @@ until [ $verification_done -eq 1 ]; do
fi
# Read in test routine parameters from signal file, then delete signal file.
- param1=`head -n 1 $startsignal`
- param2=`tail -n 1 $startsignal`
+ param1=`head -1 $startsignal`
+ param2=`tail -1 $startsignal`
rm $startsignal
# Check if we're done with verifications, otherwise run the specified verification.
@@ -105,9 +125,9 @@ if [ $timedout -eq 0 ]; then
until [ $verification_done -eq 2 ]; do
# Wait for signal from test program that verification routine can run.
- before=`date +%s`
+ before=`TimeStamp`
until [ -s $startsignal ]; do
- after=`date +%s`
+ after=`TimeStamp`
timediff=`expr $after - $before`
if [ $timediff -gt $timeout_length ]; then
nerrors=`expr $nerrors + 1`