From fd0850f1abea08d2ce656f908c58790b351b20b8 Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Sun, 23 Jul 2023 17:16:29 +0100 Subject: [PATCH] Correction to the detection of this bug --- ...splay_length_at_magnitude_boundary_-_Bytes.sh | 13 ++++++++++--- ...isplay_length_at_magnitude_boundary_-_Rate.sh | 16 ++++++++++++---- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/tests/Bug_-_Display_length_at_magnitude_boundary_-_Bytes.sh b/tests/Bug_-_Display_length_at_magnitude_boundary_-_Bytes.sh index 73ddf12..d8884fb 100644 --- a/tests/Bug_-_Display_length_at_magnitude_boundary_-_Bytes.sh +++ b/tests/Bug_-_Display_length_at_magnitude_boundary_-_Bytes.sh @@ -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 diff --git a/tests/Bug_-_Display_length_at_magnitude_boundary_-_Rate.sh b/tests/Bug_-_Display_length_at_magnitude_boundary_-_Rate.sh index e0aaeec..2dda755 100644 --- a/tests/Bug_-_Display_length_at_magnitude_boundary_-_Rate.sh +++ b/tests/Bug_-_Display_length_at_magnitude_boundary_-_Rate.sh @@ -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