File: Integrity_-_Basic.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 (27 lines) | stat: -rwxr-xr-x 787 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
26
27
#!/bin/sh
#
# Check that data can be just passed straight through.

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

inputString="TESTING"
outputString=$(printf "%s" "${inputString}" | "${testSubject}" 2>/dev/null) || { echo "unexpected failure code"; exit 1; }

if ! test "${inputString}" = "${outputString}"; then
	echo "output did not match input"
	exit 1
fi

# Test again with --force.
inputString="TESTINGAGAIN"
outputString=$(printf "%s" "${inputString}" | "${testSubject}" -f 2>/dev/null) || { echo "unexpected failure code"; exit 1; }

if ! test "${inputString}" = "${outputString}"; then
	echo "output did not match input when using --force"
	exit 1
fi

exit 0