summaryrefslogtreecommitdiffstats
path: root/test/urls/run-url-test.in
blob: c98fe8b660684894014db046f1819de2fa1a7b76 (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
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

valgrind=''
if [ "$1" = "--valgrind" ]
then
	shift
	valgrind='valgrind --leak-check=full --error-exitcode=1'
fi

parser="@abs_builddir@/parse-url"
testfile=$1

url=$(head -n1 $testfile)

tmp=$(mktemp)
trap "rm $tmp" EXIT

$valgrind $parser $url > $tmp
if test $? -ne 0
then
	echo "Error running $parser on $testfile"
	exit 2
fi

cmp --silent $testfile $tmp
result=$?

if test $result -ne 0
then
	echo "FAIL: URL parse results differ:"
	diff -u $testfile $tmp
fi

exit $result
OpenPOWER on IntegriCloud