File: Integrity_-_Binary_data.test

package info (click to toggle)
pv 1.10.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,076 kB
  • sloc: ansic: 8,421; sh: 6,426; makefile: 131; sed: 16
file content (25 lines) | stat: -rwxr-xr-x 755 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
#
# Transfer a large chunk of data through pv and check data correctness
# afterwards.

# 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'}"

# generate some data
dd if=/dev/urandom of="${workFile1}" bs=1024 count=10240 2>/dev/null

inputChecksum=$(cksum "${workFile1}" | awk '{print $1}')

# read through pv and test afterwards
"${testSubject}" -B 100000 -q "${workFile1}" > "${workFile2}"

outputChecksum=$(cksum "${workFile2}" | awk '{print $1}')

test "${inputChecksum}" = "${outputChecksum}" || exit 1

exit 0