Correction to the detection of this bug

This commit is contained in:
Andrew Wood
2023-07-23 17:16:29 +01:00
parent cecc8649c2
commit fd0850f1ab
2 changed files with 22 additions and 7 deletions
@@ -4,6 +4,9 @@
# 1MiB, described here:
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586763
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp}"
# Transfer 1500kB of data in a bursty fashion.
#
(dd if=/dev/zero bs=1k count=999;
@@ -12,14 +15,18 @@
sleep 1;
dd if=/dev/zero bs=1k count=500;
sleep 1;
) 2>/dev/null | ("${testSubject}" -btef -s 1500k >/dev/null) 2>"${workFile1}"
) 2>/dev/null | ("${testSubject}" -btIf -s 1500k >/dev/null) 2>"${workFile1}"
# Count how many different line lengths we've seen.
#
NUM=$(tr '\r' '\n' < "${workFile1}" | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l)
lineLengthCount=$(tr '\r' '\n' < "${workFile1}" | sed 's/ *$//' | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l | tr -dc '0-9')
# There should only be one length (not counting 0).
#
test $NUM -eq 1 || { echo; tr '\r' '\n' < "${workFile1}"; exit 1; }
test "${lineLengthCount}" = "1" && exit 0
echo "variable line lengths detected"
tr '\r' '\n' < "${workFile1}"
exit 1
# EOF
@@ -1,6 +1,10 @@
#!/bin/sh
#
# Same as test (1m_boundary_1) but for rate, not bytes transferred.
# This is the same as the other display length at magnitude boundary check,
# but for rate, not bytes transferred.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp}"
# Transfer 1500kB of data in a bursty fashion.
#
@@ -12,14 +16,18 @@
sleep 1;
dd if=/dev/zero bs=1k count=500;
sleep 1;
) 2>/dev/null | ("${testSubject}" -rtef -s 1500k >/dev/null) 2>"${workFile1}"
) 2>/dev/null | ("${testSubject}" -rtIf -s 1500k >/dev/null) 2>"${workFile1}"
# Count how many different line lengths we've seen.
#
NUM=$(tr '\r' '\n' < "${workFile1}" | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l)
lineLengthCount=$(tr '\r' '\n' < "${workFile1}" | sed 's/ *$//' | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l | tr -dc '0-9')
# There should only be one length (not counting 0).
#
test $NUM -eq 1 || { echo; tr '\r' '\n' < "${workFile1}"; exit 1; }
test "${lineLengthCount}" = "1" && exit 0
echo "variable line lengths detected"
tr '\r' '\n' < "${workFile1}"
exit 1
# EOF