summaryrefslogtreecommitdiff
path: root/tests/012-averagerate
blob: 89b77be8e2d08a7281c4e5a94217bf59b277c5af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
#
# Check that the average transfer rate counter changes, but not more than it
# should.

# Transfer 210 bytes as 100 bytes, a 1 second gap, 110 bytes, and another 1
# second gap.
#
(dd if=/dev/zero bs=100 count=1 2>/dev/null;
 sleep 1;
 dd if=/dev/zero bs=110 count=1 2>/dev/null;
 sleep 1;
) | $PROG -f -i 0.5 -a >/dev/null 2>$TMP1

# Count the number of rates output that are below 80.
#
NUM=`tr '\r' '\n' < $TMP1 | tr -dc '0-9.\n' | sed '/^$/d' | awk '$1<80{print}' | wc -l | tr -d ' '`

# Nearly all of the output rates should be above 80 since the average rate
# will always be around 100 bytes per second, except for pauses.
#
test $NUM -lt 2

# EOF