File: pipe-wrapper.sh

package info (click to toggle)
stoken 0.93-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 688 kB
  • sloc: ansic: 4,707; perl: 191; sh: 184; java: 123; makefile: 104; xml: 33
file content (44 lines) | stat: -rwxr-xr-x 990 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh

# Each .pipe file contains a "pipeline" of commands.  Compare the output
# of the FINAL command to <foo>.ref
#
# Variables available to the .pipe test cases:
#   $STOKEN - path to stoken executable
#   $out - the last command's output
#   $TESTDIR - path to test directory
#   $tok0 - sample v2 ctf token (no devid/pass)
#
# To regenerate all output files, use "make check TESTGEN=1"

set -ex

base="$1"
if [ "${base%.pipe}" = "${base}" ]; then
	echo "Invalid test file: $base"
	exit 1
fi
base="${base%.pipe}"

TESTDIR="${TESTDIR:-.}"
STOKEN="${STOKEN:-../stoken}"
LIBTOOL="${LIBTOOL:-../libtool}"
if ! test -z "${VALGRIND}"; then
	STOKEN="${LIBTOOL} --mode=execute ${VALGRIND} ${STOKEN}"
fi

tok0="--token=258491750817210752367175001073261277346642631755724762324173166222072472716737543"

out=""
while read x; do
	out=`eval $x`
done < ${base}.pipe

if [ "$TESTGEN" = "1" ]; then
	echo "$out" > ${base}.ref
else
	ref=`cat ${base}.ref`
	[ "$out" != "$ref" ] && exit 1
fi

exit 0