Files
pv/tests/Transfer_-_--rate-limit.test
T

22 lines
527 B
Bash
Executable File

#!/bin/sh
#
# A simple test of rate limiting.
# 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'}"
# Transfer 102 bytes at 100 bytes/sec. It should take at least 1 second.
#
startTime=$(date +%S)
dd if=/dev/zero bs=102 count=1 2>/dev/null | "${testSubject}" -L 100 2>/dev/null | cat >/dev/null
endTime=$(date +%S)
if test "${startTime}" = "${endTime}"; then
echo "transfer took zero seconds"
exit 1
fi
exit 0