]> git.ozlabs.org Git - petitboot/blob - test/urls/run-url-test.in
discover/network: In static config mode, only configure defined interfaces
[petitboot] / test / urls / run-url-test.in
1 #!/bin/bash
2
3 valgrind=''
4 if [ "$1" = "--valgrind" ]
5 then
6         shift
7         valgrind='valgrind --leak-check=full --error-exitcode=1'
8 fi
9
10 parser="@abs_builddir@/parse-url"
11 testfile=$1
12
13 url=$(head -n1 $testfile)
14
15 tmp=$(mktemp)
16 trap "rm $tmp" EXIT
17
18 $valgrind $parser $url > $tmp
19 if test $? -ne 0
20 then
21         echo "Error running $parser on $testfile"
22         exit 2
23 fi
24
25 cmp --silent $testfile $tmp
26 result=$?
27
28 if test $result -ne 0
29 then
30         echo "FAIL: URL parse results differ:"
31         diff -u $testfile $tmp
32 fi
33
34 exit $result