Rewrote most of run-test, and gave variables clearer names
This commit is contained in:
+9
-2
@@ -2,7 +2,14 @@
|
||||
#
|
||||
# Check that data can be just passed straight through.
|
||||
|
||||
VALUE=$(echo TESTING | $PROG 2>/dev/null) || exit 1
|
||||
test "$VALUE" = "TESTING"
|
||||
# Dummy assignment for "shellcheck".
|
||||
testSubject="${testSubject:-false}"
|
||||
|
||||
inputString="TESTING"
|
||||
outputString=$(printf "${inputString}" | "${testSubject}" 2>/dev/null) || { echo "unexpected failure code"; exit 1; }
|
||||
|
||||
test "${inputString}" = "${outputString}" && exit 0
|
||||
echo "output did not match input"
|
||||
exit 1
|
||||
|
||||
# EOF
|
||||
|
||||
+2
-2
@@ -2,11 +2,11 @@
|
||||
#
|
||||
# Check that the update interval can be set.
|
||||
|
||||
sleep 1 | $PROG -f -i 0.1 >/dev/null 2>$TMP1
|
||||
sleep 1 | "${testSubject}" -f -i 0.1 >/dev/null 2>"${workFile1}"
|
||||
|
||||
# There should be more than 6 lines of output.
|
||||
#
|
||||
NUM=$(tr '\r' '\n' < $TMP1 | wc -l | tr -d ' ')
|
||||
NUM=$(tr '\r' '\n' < "${workFile1}" | wc -l | tr -d ' ')
|
||||
test $NUM -gt 6
|
||||
|
||||
# EOF
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
# Transfer 102 bytes at 100 bytes/sec. It should take at least 1 second.
|
||||
#
|
||||
START=$(date +%S)
|
||||
dd if=/dev/zero bs=102 count=1 2>/dev/null | $PROG -L 100 2>/dev/null | cat >/dev/null
|
||||
dd if=/dev/zero bs=102 count=1 2>/dev/null | "${testSubject}" -L 100 2>/dev/null | cat >/dev/null
|
||||
END=$(date +%S)
|
||||
|
||||
test $START -ne $END
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@
|
||||
# Check that the progress bar moves when data is coming in.
|
||||
|
||||
dd if=/dev/zero bs=100 count=1 2>/dev/null \
|
||||
| $PROG -f -p -i 0.1 -L 500 >/dev/null 2>$TMP1
|
||||
| "${testSubject}" -f -p -i 0.1 -L 500 >/dev/null 2>"${workFile1}"
|
||||
|
||||
# There should be more than 2 different lines of output.
|
||||
#
|
||||
NUM=$(tr '\r' '\n' < $TMP1 | sort | uniq -u | wc -l | tr -d ' ')
|
||||
NUM=$(tr '\r' '\n' < "${workFile1}" | sort | uniq -u | wc -l | tr -d ' ')
|
||||
test $NUM -gt 2
|
||||
|
||||
# EOF
|
||||
|
||||
+2
-2
@@ -4,11 +4,11 @@
|
||||
|
||||
# Transfer a zero amount of data, but take 3 seconds to do it.
|
||||
#
|
||||
(sleep 3 | $PROG -f -t >/dev/null) 2>&1 | tr '\r' '\n' > $TMP1
|
||||
(sleep 3 | "${testSubject}" -f -t >/dev/null) 2>&1 | tr '\r' '\n' > "${workFile1}"
|
||||
|
||||
# Count the number of different timer values; it should be >1.
|
||||
#
|
||||
NUM=$(sort < $TMP1 | uniq -u | wc -l | tr -d ' ')
|
||||
NUM=$(sort < "${workFile1}" | uniq -u | wc -l | tr -d ' ')
|
||||
test $NUM -gt 1
|
||||
|
||||
# EOF
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@
|
||||
# Check that the estimated time counter counts.
|
||||
|
||||
dd if=/dev/zero bs=100 count=1 2>/dev/null \
|
||||
| $PROG -f -e -s 100 -i 0.1 -L 25 >/dev/null 2>$TMP1
|
||||
| "${testSubject}" -f -e -s 100 -i 0.1 -L 25 >/dev/null 2>"${workFile1}"
|
||||
|
||||
# Count the number of different ETA values there have been.
|
||||
#
|
||||
NUM=$(tr '\r' '\n' < $TMP1 | tr -d ' ' | sed '/^$/d' | sort | uniq | wc -l | tr -d ' ')
|
||||
NUM=$(tr '\r' '\n' < "${workFile1}" | tr -d ' ' | sed '/^$/d' | sort | uniq | wc -l | tr -d ' ')
|
||||
|
||||
# 3 or less - not OK, since it should have taken 4 seconds.
|
||||
#
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@
|
||||
# Check that the estimated time counter can show the end time of day.
|
||||
|
||||
dd if=/dev/zero bs=100 count=1 2>/dev/null \
|
||||
| $PROG -f -I -s 100 -i 0.1 -L 25 >/dev/null 2>$TMP1
|
||||
| "${testSubject}" -f -I -s 100 -i 0.1 -L 25 >/dev/null 2>"${workFile1}"
|
||||
|
||||
# Count the number of different ETA values there have been.
|
||||
#
|
||||
NUM=$(tr '\r' '\n' < $TMP1 | tr -d ' ' | sed '/^$/d' | sort | uniq | wc -l | tr -d ' ')
|
||||
NUM=$(tr '\r' '\n' < "${workFile1}" | tr -d ' ' | sed '/^$/d' | sort | uniq | wc -l | tr -d ' ')
|
||||
|
||||
# There should be at least 1 line of output.
|
||||
#
|
||||
|
||||
+2
-2
@@ -7,11 +7,11 @@
|
||||
(dd if=/dev/zero bs=100 count=1 2>/dev/null;
|
||||
sleep 2;
|
||||
dd if=/dev/zero bs=100 count=1 2>/dev/null;
|
||||
) | $PROG -f -i 0.5 -r >/dev/null 2>$TMP1
|
||||
) | "${testSubject}" -f -i 0.5 -r >/dev/null 2>"${workFile1}"
|
||||
|
||||
# Count the number of different rates output.
|
||||
#
|
||||
NUM=$(tr '\r' '\n' < $TMP1 | sort | uniq -u | wc -l | tr -d ' ')
|
||||
NUM=$(tr '\r' '\n' < "${workFile1}" | sort | uniq -u | wc -l | tr -d ' ')
|
||||
|
||||
# There should be more than 2 different rates counted (around 100 bytes/sec
|
||||
# for the each block, 0 bytes/sec for the gap in the middle, and around 50
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
# Check that the byte counter counts.
|
||||
|
||||
dd if=/dev/zero bs=100 count=1 2>/dev/null \
|
||||
| LANG=C $PROG -f -b >/dev/null 2>$TMP1
|
||||
NUM=$(tr '\r' '\n' < $TMP1 | tr -d ' ')
|
||||
| LANG=C "${testSubject}" -f -b >/dev/null 2>"${workFile1}"
|
||||
NUM=$(tr '\r' '\n' < "${workFile1}" | tr -d ' ')
|
||||
test "$NUM" = "100B"
|
||||
|
||||
# EOF
|
||||
|
||||
+4
-4
@@ -6,13 +6,13 @@
|
||||
# around 10 output lines.
|
||||
#
|
||||
dd if=/dev/zero bs=100 count=1 2>/dev/null \
|
||||
| $PROG -s 100 -n -i 0.1 -L 100 >/dev/null 2>$TMP1
|
||||
| "${testSubject}" -s 100 -n -i 0.1 -L 100 >/dev/null 2>"${workFile1}"
|
||||
|
||||
# The number of output lines should be >8 and <13, and the final percentage
|
||||
# should be 100.
|
||||
#
|
||||
test $(wc -l < $TMP1) -gt 8
|
||||
test $(wc -l < $TMP1) -lt 13
|
||||
test $(sed -n '$p' < $TMP1) -eq 100
|
||||
test $(wc -l < "${workFile1}") -gt 8
|
||||
test $(wc -l < "${workFile1}") -lt 13
|
||||
test $(sed -n '$p' < "${workFile1}") -eq 100
|
||||
|
||||
# EOF
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
# Check that the -q option shuts everything up.
|
||||
|
||||
dd if=/dev/zero bs=1000 count=5 2>/dev/null \
|
||||
| $PROG -f -q -i 0.1 -L 5000 >/dev/null 2>$TMP1
|
||||
test ! -s $TMP1
|
||||
| "${testSubject}" -f -q -i 0.1 -L 5000 >/dev/null 2>"${workFile1}"
|
||||
test ! -s "${workFile1}"
|
||||
|
||||
# EOF
|
||||
|
||||
+8
-8
@@ -3,30 +3,30 @@
|
||||
# Check that there is no SIGPIPE or dropped data on bigger data transfers.
|
||||
|
||||
# We nead GNU head. On some platforms it is named ghead instead of head.
|
||||
HEAD=head
|
||||
for p in $(echo $PATH | tr ':' '\n')
|
||||
HEAD="head"
|
||||
for checkPath in $(echo "${PATH}" | tr ':' '\n')
|
||||
do
|
||||
if test -x $p/ghead
|
||||
if test -x "${checkPath}/ghead"
|
||||
then
|
||||
HEAD=$p/ghead
|
||||
HEAD="${checkPath}/ghead"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Check that it really is GNU head, and skip the test if not.
|
||||
if ! echo | $HEAD -c 10 >/dev/null 2>&1; then
|
||||
if ! echo | "${HEAD}" -c 10 >/dev/null 2>&1; then
|
||||
echo "GNU \`head' is required"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Don't use dd. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=324308
|
||||
COUNT1=100000000
|
||||
#COUNT2=`$PROG -B 100000 -q /dev/zero | $HEAD -c $COUNT1 | wc -c | tr -d ' '`
|
||||
#COUNT2=`"${testSubject}" -B 100000 -q /dev/zero | $HEAD -c $COUNT1 | wc -c | tr -d ' '`
|
||||
# Remove \n to fix the test on AIX
|
||||
COUNT2=$($PROG -B 100000 -q /dev/zero | $HEAD -c $COUNT1 | tr -d '\n' | wc -c | tr -d ' ')
|
||||
COUNT2=$("${testSubject}" -B 100000 -q /dev/zero | "${HEAD}" -c $COUNT1 | tr -d '\n' | wc -c | tr -d ' ')
|
||||
|
||||
#echo "[$COUNT1] [$COUNT2]"
|
||||
|
||||
test "x$COUNT1" = "x$COUNT2"
|
||||
test "x${COUNT1}" = "x${COUNT2}"
|
||||
|
||||
# EOF
|
||||
|
||||
+6
-6
@@ -3,24 +3,24 @@
|
||||
# Transfer a large chunk of data through pv and check data correctness
|
||||
# afterwards.
|
||||
|
||||
rm -f $TMP1 $TMP2 2>/dev/null
|
||||
rm -f "${workFile1}" "${workFile2}" 2>/dev/null
|
||||
|
||||
# exit on non-zero return codes
|
||||
set -e
|
||||
|
||||
# generate some data
|
||||
dd if=/dev/urandom of=$TMP1 bs=1024 count=10240 2>/dev/null
|
||||
dd if=/dev/urandom of="${workFile1}" bs=1024 count=10240 2>/dev/null
|
||||
|
||||
CKSUM1=$(cksum $TMP1 | awk '{print $1}')
|
||||
CKSUM1=$(cksum "${workFile1}" | awk '{print $1}')
|
||||
|
||||
# read through pv and test afterwards
|
||||
$PROG -B 100000 -q $TMP1 > $TMP2
|
||||
"${testSubject}" -B 100000 -q "${workFile1}" > "${workFile2}"
|
||||
|
||||
CKSUM2=$(cksum $TMP2 | awk '{print $1}')
|
||||
CKSUM2=$(cksum "${workFile2}" | awk '{print $1}')
|
||||
|
||||
test "x$CKSUM1" = "x$CKSUM2"
|
||||
|
||||
# clean up
|
||||
rm -f $TMP1 $TMP2 2>/dev/null
|
||||
rm -f "${workFile1}" "${workFile2}" 2>/dev/null
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
sleep 1;
|
||||
dd if=/dev/zero bs=110 count=1 2>/dev/null;
|
||||
sleep 1;
|
||||
) | $PROG -f -i 0.5 -a >/dev/null 2>$TMP1
|
||||
) | "${testSubject}" -f -i 0.5 -a >/dev/null 2>"${workFile1}"
|
||||
|
||||
# Count the number of rates output that are below 80.
|
||||
#
|
||||
NUM=$(tr '\r' '\n' < $TMP1 | tr -dc '0-9.\n' | sed '/^$/d' | awk '$1<80{print}' | wc -l | tr -d ' ')
|
||||
NUM=$(tr '\r' '\n' < "${workFile1}" | tr -dc '0-9.\n' | sed '/^$/d' | awk '$1<80{print}' | wc -l | tr -d ' ')
|
||||
|
||||
# Nearly all of the output rates should be above 80 since the average rate
|
||||
# will always be around 100 bytes per second, except for pauses.
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
sleep 1;
|
||||
dd if=/dev/zero bs=1k count=500;
|
||||
sleep 1;
|
||||
) 2>/dev/null | ($PROG -btef -s 1500k >/dev/null) 2>$TMP1
|
||||
) 2>/dev/null | ("${testSubject}" -btef -s 1500k >/dev/null) 2>"${workFile1}"
|
||||
|
||||
# Count how many different line lengths we've seen.
|
||||
#
|
||||
NUM=$(tr '\r' '\n' < $TMP1 | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l)
|
||||
NUM=$(tr '\r' '\n' < "${workFile1}" | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l)
|
||||
|
||||
# There should only be one length (not counting 0).
|
||||
#
|
||||
test $NUM -eq 1 || { echo; tr '\r' '\n' < $TMP1; exit 1; }
|
||||
test $NUM -eq 1 || { echo; tr '\r' '\n' < "${workFile1}"; exit 1; }
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Same as test 13 (1mboundary) but for rate, not bytes transferred.
|
||||
# Same as test (1m_boundary_1) but for rate, not bytes transferred.
|
||||
|
||||
# Transfer 1500kB of data in a bursty fashion.
|
||||
#
|
||||
@@ -12,14 +12,14 @@
|
||||
sleep 1;
|
||||
dd if=/dev/zero bs=1k count=500;
|
||||
sleep 1;
|
||||
) 2>/dev/null | ($PROG -rtef -s 1500k >/dev/null) 2>$TMP1
|
||||
) 2>/dev/null | ("${testSubject}" -rtef -s 1500k >/dev/null) 2>"${workFile1}"
|
||||
|
||||
# Count how many different line lengths we've seen.
|
||||
#
|
||||
NUM=$(tr '\r' '\n' < $TMP1 | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l)
|
||||
NUM=$(tr '\r' '\n' < "${workFile1}" | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l)
|
||||
|
||||
# There should only be one length (not counting 0).
|
||||
#
|
||||
test $NUM -eq 1 || { echo; tr '\r' '\n' < $TMP1; exit 1; }
|
||||
test $NUM -eq 1 || { echo; tr '\r' '\n' < "${workFile1}"; exit 1; }
|
||||
|
||||
# EOF
|
||||
|
||||
+18
-18
@@ -3,51 +3,51 @@
|
||||
# Transfer a large chunk of data through pv using pipes, sending it in a
|
||||
# bursty fashion, and check data correctness afterwards.
|
||||
|
||||
rm -f $TMP1 $TMP2 2>/dev/null
|
||||
rm -f "${workFile1}" "${workFile2}" 2>/dev/null
|
||||
|
||||
# exit on non-zero return codes
|
||||
set -e
|
||||
|
||||
# generate some data
|
||||
dd if=/dev/urandom of=$TMP1 bs=1024 count=10240 2>/dev/null
|
||||
dd if=/dev/urandom of="${workFile1}" bs=1024 count=10240 2>/dev/null
|
||||
|
||||
CKSUM1=$(cksum $TMP1 | awk '{print $1}')
|
||||
CKSUM1=$(cksum "${workFile1}" | awk '{print $1}')
|
||||
|
||||
# read through pv and test afterwards
|
||||
(
|
||||
dd if=$TMP1 bs=1 count=9000
|
||||
dd if="${workFile1}" bs=1 count=9000
|
||||
sleep 1
|
||||
dd if=$TMP1 bs=1 skip=9000 count=1240
|
||||
dd if="${workFile1}" bs=1 skip=9000 count=1240
|
||||
sleep 1
|
||||
dd if=$TMP1 bs=1024 skip=10 count=1014
|
||||
dd if="${workFile1}" bs=1024 skip=10 count=1014
|
||||
sleep 1
|
||||
dd if=$TMP1 bs=1024 skip=1024 count=1024
|
||||
dd if="${workFile1}" bs=1024 skip=1024 count=1024
|
||||
sleep 1
|
||||
dd if=$TMP1 bs=1024 skip=2048
|
||||
) 2>/dev/null | $PROG -q -L 2M | cat > $TMP2
|
||||
dd if="${workFile1}" bs=1024 skip=2048
|
||||
) 2>/dev/null | "${testSubject}" -q -L 2M | cat > "${workFile2}"
|
||||
|
||||
CKSUM2=$(cksum $TMP2 | awk '{print $1}')
|
||||
CKSUM2=$(cksum "${workFile2}" | awk '{print $1}')
|
||||
|
||||
test "x$CKSUM1" = "x$CKSUM2"
|
||||
|
||||
# same again but with one less pipe
|
||||
(
|
||||
dd if=$TMP1 bs=1 count=9000
|
||||
dd if="${workFile1}" bs=1 count=9000
|
||||
sleep 1
|
||||
dd if=$TMP1 bs=1 skip=9000 count=1240
|
||||
dd if="${workFile1}" bs=1 skip=9000 count=1240
|
||||
sleep 1
|
||||
dd if=$TMP1 bs=1024 skip=10 count=1014
|
||||
dd if="${workFile1}" bs=1024 skip=10 count=1014
|
||||
sleep 1
|
||||
dd if=$TMP1 bs=1024 skip=1024 count=1024
|
||||
dd if="${workFile1}" bs=1024 skip=1024 count=1024
|
||||
sleep 1
|
||||
dd if=$TMP1 bs=1024 skip=2048
|
||||
) 2>/dev/null | $PROG -q -L 2M > $TMP2
|
||||
dd if="${workFile1}" bs=1024 skip=2048
|
||||
) 2>/dev/null | "${testSubject}" -q -L 2M > "${workFile2}"
|
||||
|
||||
CKSUM2=$(cksum $TMP2 | awk '{print $1}')
|
||||
CKSUM2=$(cksum "${workFile2}" | awk '{print $1}')
|
||||
|
||||
test "x$CKSUM1" = "x$CKSUM2"
|
||||
|
||||
# clean up
|
||||
rm -f $TMP1 $TMP2 2>/dev/null
|
||||
rm -f "${workFile1}" "${workFile2}" 2>/dev/null
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
# around 10 output lines.
|
||||
#
|
||||
dd if=/dev/zero bs=100 count=1 2>/dev/null \
|
||||
| $PROG -s 100 -n -t -i 0.1 -L 100 >/dev/null 2>$TMP1
|
||||
| "${testSubject}" -s 100 -n -t -i 0.1 -L 100 >/dev/null 2>"${workFile1}"
|
||||
|
||||
# The number of output lines should be >8 and <13, and the number of
|
||||
# different elapsed times should be at least 7. The last percentage should
|
||||
# be 100.
|
||||
#
|
||||
test $(wc -l < $TMP1) -gt 8
|
||||
test $(wc -l < $TMP1) -lt 13
|
||||
test $(tr , . < "$TMP1" | awk '{print int(10*$1)}' | sort -n | uniq | wc -l) -gt 7
|
||||
test $(sed -n '$p' < $TMP1 | awk '{print $2}') -eq 100
|
||||
test $(wc -l < "${workFile1}") -gt 8
|
||||
test $(wc -l < "${workFile1}") -lt 13
|
||||
test $(tr , . < ""${workFile1}"" | awk '{print int(10*$1)}' | sort -n | uniq | wc -l) -gt 7
|
||||
test $(sed -n '$p' < "${workFile1}" | awk '{print $2}') -eq 100
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
# around 10 output lines.
|
||||
#
|
||||
dd if=/dev/zero bs=500 count=1 2>/dev/null \
|
||||
| $PROG -s 500 -n -b -i 0.1 -L 500 >/dev/null 2>$TMP1
|
||||
| "${testSubject}" -s 500 -n -b -i 0.1 -L 500 >/dev/null 2>"${workFile1}"
|
||||
|
||||
# The number of output lines should be >8 and <13, and the final byte count
|
||||
# should be 500.
|
||||
#
|
||||
test $(wc -l < $TMP1) -gt 8
|
||||
test $(wc -l < $TMP1) -lt 13
|
||||
test $(sed -n '$p' < $TMP1) -eq 500
|
||||
test $(wc -l < "${workFile1}") -gt 8
|
||||
test $(wc -l < "${workFile1}") -lt 13
|
||||
test $(sed -n '$p' < "${workFile1}") -eq 500
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -3,30 +3,30 @@
|
||||
# Try changing the format of a transfer remotely.
|
||||
|
||||
# Do nothing if IPC is not supported.
|
||||
if ! $PROG -h | grep -Eq "^ -R,"; then
|
||||
echo "SKIPPED" | tr "\n" ' '
|
||||
exit 0
|
||||
if ! "${testSubject}" -h 2>/dev/null | grep -Eq "^ -R,"; then
|
||||
echo "IPC is not supported on this platform"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
rm -f $TMP1 $TMP2 $TMP3 $TMP4 2>/dev/null
|
||||
rm -f "${workFile1}" "${workFile2}" "${workFile3}" "${workFile4}" 2>/dev/null
|
||||
|
||||
# Exit on non-zero return codes.
|
||||
set -e
|
||||
|
||||
# Generate an empty test file.
|
||||
dd if=/dev/zero of=$TMP1 bs=1024 count=10240 2>/dev/null
|
||||
dd if=/dev/zero of="${workFile1}" bs=1024 count=10240 2>/dev/null
|
||||
|
||||
(
|
||||
sleep 1
|
||||
$PROG -R $(cat $TMP4) -a
|
||||
"${testSubject}" -R $(cat "${workFile4}") -a
|
||||
sleep 2
|
||||
$PROG -R $(cat $TMP4) -L 10M
|
||||
"${testSubject}" -R $(cat "${workFile4}") -L 10M
|
||||
) &
|
||||
|
||||
$PROG -L 2M -f -P $TMP4 $TMP1 > $TMP2 2>$TMP3
|
||||
"${testSubject}" -L 2M -f -P "${workFile4}" "${workFile1}" > "${workFile2}" 2>"${workFile3}"
|
||||
|
||||
# Make sure there is more than one length of line (excluding blank lines).
|
||||
line_lengths=$(tr '\r' '\n' < "$TMP3" | awk '{print length($0)}' | grep -Fvx 0 | sort -n | uniq | wc -l)
|
||||
line_lengths=$(tr '\r' '\n' < "${workFile3}" | awk '{print length($0)}' | grep -Fvx 0 | sort -n | uniq | wc -l)
|
||||
test $line_lengths -gt 1
|
||||
|
||||
# EOF
|
||||
|
||||
+17
-17
@@ -4,51 +4,51 @@
|
||||
# intact.
|
||||
|
||||
# Do nothing if IPC is not supported.
|
||||
if ! $PROG -h | grep -Eq "^ -R,"; then
|
||||
echo "SKIPPED" | tr "\n" ' '
|
||||
exit 0
|
||||
if ! "${testSubject}" -h 2>/dev/null | grep -Eq "^ -R,"; then
|
||||
echo "IPC is not supported on this platform"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
rm -f $TMP1 $TMP2 $TMP3 $TMP4 2>/dev/null
|
||||
rm -f "${workFile1}" "${workFile2}" "${workFile3}" "${workFile4}" 2>/dev/null
|
||||
|
||||
# Exit on non-zero return codes.
|
||||
set -e
|
||||
|
||||
# Generate some data.
|
||||
dd if=/dev/urandom of=$TMP1 bs=1024 count=10240 2>/dev/null
|
||||
dd if=/dev/urandom of="${workFile1}" bs=1024 count=10240 2>/dev/null
|
||||
|
||||
# Run a few remote control commands in the background.
|
||||
#
|
||||
echo FAIL > $TMP3
|
||||
echo FAIL > "${workFile3}"
|
||||
(
|
||||
set +e
|
||||
sleep 2
|
||||
for x in 1 2 3; do
|
||||
$PROG -R $(cat $TMP4) -apterb || exit 1
|
||||
"${testSubject}" -R $(cat "${workFile4}") -apterb || exit 1
|
||||
(usleep 200000 || sleep 1) 2>/dev/null
|
||||
$PROG -R $(cat $TMP4) -p || exit 1
|
||||
"${testSubject}" -R $(cat "${workFile4}") -p || exit 1
|
||||
(usleep 200000 || sleep 1) 2>/dev/null
|
||||
$PROG -R $(cat $TMP4) -N "test" || exit 1
|
||||
"${testSubject}" -R $(cat "${workFile4}") -N "test" || exit 1
|
||||
(usleep 200000 || sleep 1) 2>/dev/null
|
||||
$PROG -R $(cat $TMP4) -F "%e" || exit 1
|
||||
"${testSubject}" -R $(cat "${workFile4}") -F "%e" || exit 1
|
||||
(usleep 200000 || sleep 1) 2>/dev/null
|
||||
$PROG -R $(cat $TMP4) -N "." || exit 1
|
||||
"${testSubject}" -R $(cat "${workFile4}") -N "." || exit 1
|
||||
(usleep 200000 || sleep 1) 2>/dev/null
|
||||
done
|
||||
$PROG -R $(cat $TMP4) -L 10M
|
||||
echo OK > $TMP3
|
||||
"${testSubject}" -R $(cat "${workFile4}") -L 10M
|
||||
echo OK > "${workFile3}"
|
||||
) &
|
||||
|
||||
# Run our data transfer.
|
||||
$PROG -L 100k -i 0.1 -f -P $TMP4 $TMP1 > $TMP2 2>/dev/null
|
||||
"${testSubject}" -L 100k -i 0.1 -f -P "${workFile4}" "${workFile1}" > "${workFile2}" 2>/dev/null
|
||||
|
||||
# Check our remote control calls ran OK.
|
||||
BGSTATUS=$(cat $TMP3)
|
||||
BGSTATUS=$(cat "${workFile3}")
|
||||
test "x$BGSTATUS" = "xOK"
|
||||
|
||||
# Check data integrity.
|
||||
CKSUM1=$(cksum $TMP1 | awk '{print $1}')
|
||||
CKSUM2=$(cksum $TMP2 | awk '{print $1}')
|
||||
CKSUM1=$(cksum "${workFile1}" | awk '{print $1}')
|
||||
CKSUM2=$(cksum "${workFile2}" | awk '{print $1}')
|
||||
test "x$CKSUM1" = "x$CKSUM2"
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -2,27 +2,27 @@
|
||||
#
|
||||
# Make sure -S stops at the given size.
|
||||
|
||||
rm -f $TMP1 $TMP2 2>/dev/null
|
||||
rm -f "${workFile1}" "${workFile2}" 2>/dev/null
|
||||
|
||||
# exit on non-zero return codes
|
||||
set -e
|
||||
|
||||
# generate some data
|
||||
dd if=/dev/urandom of=$TMP1 bs=1024 count=10 2>/dev/null
|
||||
dd if=/dev/urandom of="${workFile1}" bs=1024 count=10 2>/dev/null
|
||||
|
||||
# read through pv and test afterwards
|
||||
$PROG -S -s 5120 -q $TMP1 > $TMP2
|
||||
"${testSubject}" -S -s 5120 -q "${workFile1}" > "${workFile2}"
|
||||
|
||||
CKSUM2=$(cksum $TMP2 | awk '{print $1}')
|
||||
CKSUM2=$(cksum "${workFile2}" | awk '{print $1}')
|
||||
|
||||
# take the first 5120 bytes of TMP1 and cksum them
|
||||
rm -f $TMP2
|
||||
dd if=$TMP1 of=$TMP2 bs=1024 count=5 2>/dev/null
|
||||
CKSUM1=$(cksum $TMP2 | awk '{print $1}')
|
||||
# take the first 5120 bytes of workFile1 and cksum them
|
||||
rm -f "${workFile2}"
|
||||
dd if="${workFile1}" of="${workFile2}" bs=1024 count=5 2>/dev/null
|
||||
CKSUM1=$(cksum "${workFile2}" | awk '{print $1}')
|
||||
|
||||
test "x$CKSUM1" = "x$CKSUM2"
|
||||
|
||||
# clean up
|
||||
rm -f $TMP1 $TMP2 2>/dev/null
|
||||
rm -f "${workFile1}" "${workFile2}" 2>/dev/null
|
||||
|
||||
# EOF
|
||||
|
||||
+16
-16
@@ -3,25 +3,25 @@
|
||||
# Make sure that files larger than 2GB are supported.
|
||||
|
||||
# Check there is enough free space for this test.
|
||||
TMP1DIR="${TMP1%/*}"
|
||||
TMP1SPACEKB=$(df -kP "${TMP1DIR}" | sed -n '$p' | awk '{print $(NF-2)}')
|
||||
test -n "${TMP1SPACEKB}" || TMP1SPACEKB=0
|
||||
if ! test "${TMP1SPACEKB}" -gt 3300000 2>/dev/null; then
|
||||
echo "need >3GB free on ${TMP1DIR}"
|
||||
workFile1DIR="${workFile1%/*}"
|
||||
workFile1SPACEKB=$(df -kP "${workFile1DIR}" | sed -n '$p' | awk '{print $(NF-2)}')
|
||||
test -n "${workFile1SPACEKB}" || workFile1SPACEKB=0
|
||||
if ! test "${workFile1SPACEKB}" -gt 3300000 2>/dev/null; then
|
||||
echo "need >3GB free on ${workFile1DIR}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Generate a 3GB sparse file - we don't really need 3GB of free space unless
|
||||
# sparse files are not supported.
|
||||
echo -n > "${TMP1}"
|
||||
if ! dd if="/dev/zero" of="${TMP1}" count=1 bs=1048576 seek=3072 2>/dev/null; then
|
||||
echo -n > "${workFile1}"
|
||||
if ! dd if="/dev/zero" of="${workFile1}" count=1 bs=1048576 seek=3072 2>/dev/null; then
|
||||
echo "failed to create 3GB specimen file"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# NB the "stat" command is not portable - BSD stat(1) has a different syntax
|
||||
# to GNU stat(1) - so we have to parse the output of ls(1).
|
||||
FILESIZE=$(ls -nl "${TMP1}" 2>/dev/null | awk '{print $5}')
|
||||
FILESIZE=$(ls -nl "${workFile1}" 2>/dev/null | awk '{print $5}')
|
||||
test -n "${FILESIZE}" || FILESIZE=0
|
||||
if ! test "${FILESIZE}" -gt 3000000; then
|
||||
echo "failed to validate specimen file size"
|
||||
@@ -29,9 +29,9 @@ if ! test "${FILESIZE}" -gt 3000000; then
|
||||
fi
|
||||
|
||||
# Transfer the file, and count how many bytes came through.
|
||||
TRANSFERRED=$("${PROG}" -n -b "${TMP1}" 2>"${TMP2}" | wc -c 2>/dev/null | tr -dc '0-9')
|
||||
TRANSFERRED=$("${testSubject}" -n -b "${workFile1}" 2>"${workFile2}" | wc -c 2>/dev/null | tr -dc '0-9')
|
||||
test -n "${TRANSFERRED}" || TRANSFERRED=0
|
||||
COUNTED=$(sed -n '$p' "${TMP2}" | tr -dc '0-9')
|
||||
COUNTED=$(sed -n '$p' "${workFile2}" | tr -dc '0-9')
|
||||
test -n "${COUNTED}" || COUNTED=0
|
||||
if ! test "${TRANSFERRED}" -eq "${FILESIZE}"; then
|
||||
echo "transferred ${TRANSFERRED} of ${FILESIZE} bytes"
|
||||
@@ -43,9 +43,9 @@ if ! test "${COUNTED}" -eq "${FILESIZE}"; then
|
||||
fi
|
||||
|
||||
# Transfer the file from stdin, and count how many bytes came through.
|
||||
TRANSFERRED=$("${PROG}" -n -b < "${TMP1}" 2>"${TMP2}" | wc -c 2>/dev/null | tr -dc '0-9')
|
||||
TRANSFERRED=$("${testSubject}" -n -b < "${workFile1}" 2>"${workFile2}" | wc -c 2>/dev/null | tr -dc '0-9')
|
||||
test -n "${TRANSFERRED}" || TRANSFERRED=0
|
||||
COUNTED=$(sed -n '$p' "${TMP2}" | tr -dc '0-9')
|
||||
COUNTED=$(sed -n '$p' "${workFile2}" | tr -dc '0-9')
|
||||
test -n "${COUNTED}" || COUNTED=0
|
||||
if ! test "${TRANSFERRED}" -eq "${FILESIZE}"; then
|
||||
echo "stdin - transferred ${TRANSFERRED} of ${FILESIZE} bytes"
|
||||
@@ -58,9 +58,9 @@ fi
|
||||
|
||||
# Use the file as a size value and transfer its size of bytes from dev/zero,
|
||||
# and count how many bytes came through.
|
||||
TRANSFERRED=$("${PROG}" -n -b -S -s "@${TMP1}" /dev/zero 2>"${TMP2}" | wc -c 2>/dev/null | tr -dc '0-9')
|
||||
TRANSFERRED=$("${testSubject}" -n -b -S -s "@${workFile1}" /dev/zero 2>"${workFile2}" | wc -c 2>/dev/null | tr -dc '0-9')
|
||||
test -n "${TRANSFERRED}" || TRANSFERRED=0
|
||||
COUNTED=$(sed -n '$p' "${TMP2}" | tr -dc '0-9')
|
||||
COUNTED=$(sed -n '$p' "${workFile2}" | tr -dc '0-9')
|
||||
test -n "${COUNTED}" || COUNTED=0
|
||||
if ! test "${TRANSFERRED}" -eq "${FILESIZE}"; then
|
||||
echo "size read - transferred ${TRANSFERRED} of ${FILESIZE} bytes"
|
||||
@@ -71,8 +71,8 @@ if ! test "${COUNTED}" -eq "${FILESIZE}"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n > "${TMP1}"
|
||||
echo -n > "${TMP2}"
|
||||
echo -n > "${workFile1}"
|
||||
echo -n > "${workFile2}"
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user