40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Check that numeric output shows line counts instead of percentages, when
|
|
# used in line mode together with bytes mode.
|
|
|
|
# Allow all tests to be skipped, e.g. during a release build
|
|
test "${SKIP_ALL_TESTS}" = "1" && exit 77
|
|
|
|
true "${testSubject:?not set - call this from 'make check'}"
|
|
true "${workFile1:?not set - call this from 'make check'}"
|
|
true "${workFile2:?not set - call this from 'make check'}"
|
|
|
|
# Pass through 100 lines.
|
|
#
|
|
seq -w 3 1 100 \
|
|
| "${testSubject}" -bnl -i 0.2 -f -L 100 2>"${workFile1}" > "${workFile2}"
|
|
|
|
lineCount=$(wc -l < "${workFile1}" | tr -dc '0-9')
|
|
finalStdoutLine=$(sed -n '$p' < "${workFile2}")
|
|
|
|
# The number of output lines should be >3 and <10, and the final line of
|
|
# transferred data on stdout should be 100.
|
|
#
|
|
if ! test "${lineCount}" -gt 3; then
|
|
echo "fewer than 4 output lines (${lineCount})"
|
|
cat "${workFile1}"
|
|
exit 1
|
|
fi
|
|
if ! test "${lineCount}" -lt 10; then
|
|
echo "more than 9 output lines (${lineCount})"
|
|
cat "${workFile1}"
|
|
exit 1
|
|
fi
|
|
if ! test "${finalStdoutLine}" = "100"; then
|
|
echo "final transferred line was not 100 (${finalStdoutLine})"
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|