summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-05-10 16:42:22 (GMT)
committerGitHub <noreply@github.com>2022-05-10 16:42:22 (GMT)
commitd0ea8a1d8cbc5ec54b179f605f90636ee8a837f0 (patch)
tree81a45d3061ec91e852f5d7eccb8e99906a54e866 /test
parent110f6a1c7ddf65e61387f484e6098bbe69dcc6a8 (diff)
downloadhdf5-d0ea8a1d8cbc5ec54b179f605f90636ee8a837f0.zip
hdf5-d0ea8a1d8cbc5ec54b179f605f90636ee8a837f0.tar.gz
hdf5-d0ea8a1d8cbc5ec54b179f605f90636ee8a837f0.tar.bz2
Revert "Cleanup and shellcheck fixes in the SWMR test script (#1741)" (#1758)
This reverts commit cea0dc4565312f519c26de17b987b75652ab95df.
Diffstat (limited to 'test')
-rw-r--r--test/test_swmr.sh.in109
1 files changed, 56 insertions, 53 deletions
diff --git a/test/test_swmr.sh.in b/test/test_swmr.sh.in
index e517ddc..d61fdbb 100644
--- a/test/test_swmr.sh.in
+++ b/test/test_swmr.sh.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /bin/bash
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
@@ -11,10 +11,12 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-# Acceptance tests for the SWMR feature
+# Tests for the swmr feature.
#
-###############################################################################
+# Created:
+# Albert Cheng, 2009/07/22
+srcdir=@srcdir@
utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@
testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@
@@ -41,7 +43,7 @@ MESSAGE_TIMEOUT=300 # Message timeout length in secs
# This should be the same as the define in "test/h5test.h"
###############################################################################
-## Aliases and function definitions
+## short hands and function definitions
###############################################################################
DPRINT=: # Set to "echo Debug:" for debugging printing,
# else ":" for noop.
@@ -60,16 +62,16 @@ TESTING() {
# This performs similar function as the routine h5_wait_message() in test/h5test.c
WAIT_MESSAGE() {
message=$1 # Get the name of the message file to wait for
- t0=$(date +%s) # Get current time in seconds
+ t0=`date +%s` # Get current time in seconds
difft=0 # Initialize the time difference
mexist=0 # Indicate whether the message file is found
while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out
do
- t1=$(date +%s) # Get current time in seconds
- difft=$(("$t1" - "$t0")) # Calculate the time difference
- if [ -e "$message" ]; then # If message file is found:
+ t1=`date +%s` # Get current time in seconds
+ difft=`expr $t1 - $t0` # Calculate the time difference
+ if [ -e $message ]; then # If message file is found:
mexist=1 # indicate the message file is found
- rm "$message" # remove the message file
+ rm $message # remove the message file
break # get out of the while loop
fi
done;
@@ -128,7 +130,7 @@ for FILE in swmr*; do
*.o) continue ;; ## don't copy the .o files
esac
if test -f "$FILE" ; then
- cp "$FILE" swmr_test
+ cp $FILE swmr_test
fi
done
@@ -143,12 +145,12 @@ if [ -f .libs/swmr ]; then
*.o) continue ;; ## don't copy the .o files
esac
if test -f "$FILE" ; then
- cp "$FILE" swmr_test/.libs
+ cp $FILE swmr_test/.libs
fi
done
fi
-cd swmr_test || exit 1
+cd swmr_test
# Loop over index types
@@ -171,7 +173,7 @@ do
$testdir/swmr_generator -q $compress $index_type
if test $? -ne 0; then
echo generator had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Launch the Generator with SWMR_WRITE
@@ -179,7 +181,7 @@ do
$testdir/swmr_generator -q -s $compress $index_type
if test $? -ne 0; then
echo generator had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Check for error and exit if one occurred
@@ -207,6 +209,7 @@ do
# Wait for message from writer process before starting reader(s)
WAIT_MESSAGE $WRITER_MESSAGE
+ #
# Launch the Readers
#declare -a seeds=(<seed1> <seed2> <seed3> ... )
echo launch $Nreaders swmr_readers
@@ -217,19 +220,19 @@ do
seed=""
$testdir/swmr_reader -q $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n &
pid_readers="$pid_readers $!"
- n=$((n + 1))
+ n=`expr $n + 1`
done
- $DPRINT pid_readers="$pid_readers"
+ $DPRINT pid_readers=$pid_readers
$IFDEBUG ps
- # Collect exit codes of the readers first because they usually finish
+ # Collect exit code of the readers first because they usually finish
# before the writer.
for xpid in $pid_readers; do
- $DPRINT checked reader "$xpid"
- wait "$xpid"
+ $DPRINT checked reader $xpid
+ wait $xpid
if test $? -ne 0; then
echo reader had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
done
@@ -238,7 +241,7 @@ do
wait $pid_writer
if test $? -ne 0; then
echo writer had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Check for error and exit if one occurred
@@ -263,7 +266,7 @@ do
$testdir/swmr_generator -q -s $compress $index_type
if test $? -ne 0; then
echo generator had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Remove any possible writer message file before launching writer
@@ -278,7 +281,7 @@ do
# Wait for message from writer process before starting reader(s)
WAIT_MESSAGE $WRITER_MESSAGE
-
+ #
# Launch the Readers
#declare -a seeds=(<seed1> <seed2> <seed3> ... )
echo launch $Nreaders swmr_readers
@@ -289,19 +292,19 @@ do
seed=""
$testdir/swmr_reader -q $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n &
pid_readers="$pid_readers $!"
- n=$((n + 1))
+ n=`expr $n + 1`
done
- $DPRINT pid_readers="$pid_readers"
+ $DPRINT pid_readers=$pid_readers
$IFDEBUG ps
# Collect exit code of the readers first because they usually finish
# before the writer.
for xpid in $pid_readers; do
- $DPRINT checked reader "$xpid"
- wait "$xpid"
+ $DPRINT checked reader $xpid
+ wait $xpid
if test $? -ne 0; then
echo reader had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
done
@@ -310,7 +313,7 @@ do
wait $pid_writer
if test $? -ne 0; then
echo writer had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Check for error and exit if one occurred
@@ -341,7 +344,7 @@ do
# Wait for message from writer process before starting reader(s)
WAIT_MESSAGE $WRITER_MESSAGE
-
+ #
# Launch the Remove Readers
#declare -a seeds=(<seed1> <seed2> <seed3> ... )
n=0
@@ -352,19 +355,19 @@ do
seed=""
$testdir/swmr_remove_reader -q $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n &
pid_readers="$pid_readers $!"
- n=$((n + 1))
+ n=`expr $n + 1`
done
- $DPRINT pid_readers="$pid_readers"
+ $DPRINT pid_readers=$pid_readers
$IFDEBUG ps
# Collect exit code of the readers first because they usually finish
# before the writer.
for xpid in $pid_readers; do
- $DPRINT checked reader "$xpid"
- wait "$xpid"
+ $DPRINT checked reader $xpid
+ wait $xpid
if test $? -ne 0; then
echo reader had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
done
@@ -373,7 +376,7 @@ do
wait $pid_writer
if test $? -ne 0; then
echo writer had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Check for error and exit if one occurred
@@ -398,7 +401,7 @@ do
$testdir/swmr_generator -q $compress $index_type
if test $? -ne 0; then
echo generator had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Launch the Writer (not in parallel - just to rebuild the datasets)
@@ -407,7 +410,7 @@ do
$testdir/swmr_writer -q $Nrecords $seed
if test $? -ne 0; then
echo writer had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Remove any possible writer message file before launching writer
@@ -433,19 +436,19 @@ do
seed=""
$testdir/swmr_remove_reader -q $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n &
pid_readers="$pid_readers $!"
- n=$((n + 1))
+ n=`expr $n + 1`
done
- $DPRINT pid_readers="$pid_readers"
+ $DPRINT pid_readers=$pid_readers
$IFDEBUG ps
# Collect exit code of the readers first because they usually finish
# before the writer.
for xpid in $pid_readers; do
- $DPRINT checked reader "$xpid"
- wait "$xpid"
+ $DPRINT checked reader $xpid
+ wait $xpid
if test $? -ne 0; then
echo reader had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
done
@@ -454,7 +457,7 @@ do
wait $pid_writer
if test $? -ne 0; then
echo writer had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Check for error and exit if one occurred
@@ -482,7 +485,7 @@ do
$testdir/swmr_generator -q $compress $index_type $seed
if test $? -ne 0; then
echo generator had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Remove any possible writer message file before launching writer
@@ -504,26 +507,26 @@ do
# The sparse reader spits out a LOT of data so it's set to 'quiet'
$testdir/swmr_sparse_reader -q $Nrecs_spa 2>&1 |tee swmr_reader.out.$n &
pid_readers="$pid_readers $!"
- n=$((n + 1))
+ n=`expr $n + 1`
done
- $DPRINT pid_readers="$pid_readers"
+ $DPRINT pid_readers=$pid_readers
$IFDEBUG ps
# Collect exit code of the writer
- $DPRINT checked writer "$pid_writer"
- wait "$pid_writer"
+ $DPRINT checked writer $pid_writer
+ wait $pid_writer
if test $? -ne 0; then
echo writer had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
# Collect exit code of the readers
for xpid in $pid_readers; do
- $DPRINT checked reader "$xpid"
- wait "$xpid"
+ $DPRINT checked reader $xpid
+ wait $xpid
if test $? -ne 0; then
echo reader had error
- nerrors=$((nerrors + 1))
+ nerrors=`expr $nerrors + 1`
fi
done