diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/flushrefresh.c | 19 | ||||
-rwxr-xr-x | test/testflushrefresh.sh.in | 32 |
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` |