Files
pv/tests/Display_-_--timer_-_displayed_value_changes.test
T

24 lines
666 B
Bash
Executable File

#!/bin/sh
#
# Check that the elapsed time counter does count up.
# 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'}"
# Transfer a zero amount of data, but take 3 seconds to do it.
#
(sleep 3 | "${testSubject}" -f -t >/dev/null) 2>&1 | tr '\r' '\n' > "${workFile1}"
# Count the number of different timer values; it should be >1.
#
valueCount=$(sort < "${workFile1}" | uniq -u | wc -l | tr -dc '0-9')
if ! test "${valueCount}" -gt 1; then
echo "timer value did not change"
exit 1
fi
exit 0