#!/bin/sh
#
# Transfer a large chunk of data through pv and check data correctness
# afterwards.

rm -f chunk chunk2 2>/dev/null

# exit on non-zero return codes
set -e

# generate some data
dd if=/dev/urandom of=./chunk bs=1024 count=10240 2>/dev/null

CKSUM1=`cksum ./chunk | awk '{print $1}'`

# read through pv and test afterwards
$PROG -B 100000 -q ./chunk > ./chunk2

CKSUM2=`cksum ./chunk2 | awk '{print $1}'`

test "x$CKSUM1" = "x$CKSUM2"

# clean up
rm chunk chunk2 2>/dev/null

# EOF
