Add more verbose output and apply fixes suggested by shellcheck.
This commit is contained in:
@@ -2,11 +2,20 @@
|
||||
#
|
||||
# Check that the update interval can be set.
|
||||
|
||||
# Dummy assignments for "shellcheck".
|
||||
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.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' < "${workFile1}" | wc -l | tr -d ' ')
|
||||
test $NUM -gt 6
|
||||
lineCount=$(tr '\r' '\n' < "${workFile1}" | wc -l | tr -dc '0-9')
|
||||
if ! test "${lineCount}" -gt 6; then
|
||||
echo "fewer than 7 lines of output"
|
||||
tr '\r' '\n' < "${workFile1}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -2,12 +2,20 @@
|
||||
#
|
||||
# A simple test of rate limiting.
|
||||
|
||||
# Dummy assignments for "shellcheck".
|
||||
testSubject="${testSubject:-false}"
|
||||
|
||||
# Transfer 102 bytes at 100 bytes/sec. It should take at least 1 second.
|
||||
#
|
||||
START=$(date +%S)
|
||||
startTime=$(date +%S)
|
||||
dd if=/dev/zero bs=102 count=1 2>/dev/null | "${testSubject}" -L 100 2>/dev/null | cat >/dev/null
|
||||
END=$(date +%S)
|
||||
endTime=$(date +%S)
|
||||
|
||||
test $START -ne $END
|
||||
if test "${startTime}" = "${endTime}"; then
|
||||
echo "transfer took zero seconds"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -2,28 +2,35 @@
|
||||
#
|
||||
# Try changing the format of a transfer remotely.
|
||||
|
||||
# Dummy assignments for "shellcheck".
|
||||
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"; workFile2="${workFile2:-.tmp2}"; workFile3="${workFile3:-.tmp3}"; workFile4="${workFile4:-.tmp4}"
|
||||
|
||||
# Do nothing if IPC is not supported.
|
||||
if ! "${testSubject}" -h 2>/dev/null | grep -Eq "^ -R,"; then
|
||||
echo "IPC is not supported on this platform"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
rm -f "${workFile1}" "${workFile2}" "${workFile3}" "${workFile4}" 2>/dev/null
|
||||
|
||||
# Generate an empty test file.
|
||||
dd if=/dev/zero of="${workFile1}" bs=1024 count=10240 2>/dev/null
|
||||
|
||||
(
|
||||
sleep 1
|
||||
"${testSubject}" -R $(cat "${workFile4}") -a
|
||||
"${testSubject}" -R "$(cat "${workFile4}")" -a
|
||||
sleep 2
|
||||
"${testSubject}" -R $(cat "${workFile4}") -L 10M
|
||||
"${testSubject}" -R "$(cat "${workFile4}")" -L 10M
|
||||
) &
|
||||
|
||||
"${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' < "${workFile3}" | awk '{print length($0)}' | grep -Fvx 0 | sort -n | uniq | wc -l)
|
||||
test "${line_lengths}" -gt 1
|
||||
line_lengths=$(tr '\r' '\n' < "${workFile3}" | awk '{print length($0)}' | grep -Fvx 0 | sort -n | uniq | wc -l | tr -dc '0-9')
|
||||
|
||||
if ! test "${line_lengths}" -gt 1; then
|
||||
echo "only one line length seen - format change failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# EOF
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#
|
||||
# Make sure -S stops at the given size.
|
||||
|
||||
# exit on non-zero return codes
|
||||
set -e
|
||||
# Dummy assignments for "shellcheck".
|
||||
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"; workFile2="${workFile2:-.tmp2}"
|
||||
|
||||
# generate some data
|
||||
dd if=/dev/urandom of="${workFile1}" bs=1024 count=10 2>/dev/null
|
||||
@@ -17,6 +17,11 @@ outputChecksum=$(cksum "${workFile2}" | awk '{print $1}')
|
||||
dd if="${workFile1}" of="${workFile2}" bs=1024 count=5 2>/dev/null
|
||||
inputChecksum=$(cksum "${workFile2}" | awk '{print $1}')
|
||||
|
||||
test "x${inputChecksum}" = "x${outputChecksum}"
|
||||
if ! test "${inputChecksum}" = "${outputChecksum}"; then
|
||||
echo "input and output checksums differ"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# EOF
|
||||
|
||||
Reference in New Issue
Block a user