BadVPN – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #!/bin/bash |
2 | |||
3 | NCD=$1 |
||
4 | USE_VALGRIND=$2 |
||
5 | |||
6 | if [[ -z $NCD ]] || [[ -n $USE_VALGRIND && $USE_VALGRIND != use_valgrind ]]; then |
||
7 | echo "Usage: $0 <ncd_command> [use_valgrind]" |
||
8 | exit 1 |
||
9 | fi |
||
10 | |||
11 | if [[ ! -e ./run_tests ]]; then |
||
12 | echo "Must run from the tests directory" |
||
13 | exit 1 |
||
14 | fi |
||
15 | |||
16 | failed=0 |
||
17 | |||
18 | for file in ./*.ncd; do |
||
19 | echo "Running: $file" |
||
20 | if [[ $USE_VALGRIND = use_valgrind ]]; then |
||
21 | valgrind --error-exitcode=1 --leak-check=full "$NCD" --loglevel none --config-file "$file" |
||
22 | else |
||
23 | "$NCD" --loglevel none --config-file "$file" |
||
24 | fi |
||
25 | res=$? |
||
26 | if [[ ! $res -eq 0 ]]; then |
||
27 | echo "FAILED" |
||
28 | let failed+=1 |
||
29 | fi |
||
30 | done |
||
31 | |||
32 | if [[ $failed -gt 0 ]]; then |
||
33 | echo "$failed tests FAILED" |
||
34 | exit 1 |
||
35 | fi |
||
36 | |||
37 | echo "all tests passed" |
||
38 | exit 0 |