-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path2-test.sh
More file actions
executable file
·96 lines (82 loc) · 1.98 KB
/
2-test.sh
File metadata and controls
executable file
·96 lines (82 loc) · 1.98 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
# $1: Category of the test(s) you want to run.
# Send nothing to run all categories.
# $2: Name of the test you want to run.
# Send nothing to run all tests in $1.
#set -x # Decomment to print all commands
case "$RP" in
fort*)
export RP_BIN="$FORT"
;;
"routinator")
export RP_BIN="$ROUTINATOR"
;;
"rpki-client")
export RP_BIN="$RPKI_CLIENT"
;;
"rpki-prover")
export RP_BIN="$RPKI_PROVER"
;;
*)
echo "Unknown RP: $RP"
echo '(Look up "$RP" in the README.)'
return 1
;;
esac
. rp/$RP.sh
. tools/vars.sh || exit 1
tools/cleanup-sandbox.sh
NSUCCESSES=0
NFAILS=0
NSKIPS=0
NUNKNOWNS=0
tools/apache2-start.sh
tools/rsyncd-start.sh
run_test() {
test -d "$1" || return 0
export SRCDIR="$1" # tests/cat/simple
export SANDBOX="sandbox/$SRCDIR" # sandbox/tests/cat/simple
export TESTID="${SRCDIR#tests/}" # cat/simple
export CATEGORY="${TESTID%/*}" # cat
export TEST="${TESTID#*/}" # simple
echo "Test: $TESTID"
rm -rf sandbox/apache2/content/*
rm -rf sandbox/rsyncd/content/*
:> "$APACHE_REQLOG"
:> "$RSYNC_REQLOG"
mkdir -p "$SANDBOX/workdir"
"$SRCDIR"/run.sh
case "$?" in
0) NSUCCESSES=$((NSUCCESSES+1)) ;;
1) NFAILS=$((NFAILS+1)) ;;
3) NSKIPS=$((NSKIPS+1)) ;;
*) NUNKNOWNS=$((NUNKNOWNS+1)) ;;
esac
}
if [ -z "$1" ]; then
for CATEGORY in tests/*; do
for T in "$CATEGORY"/*; do
run_test "$T"
done
done
elif [ -z "$2" ]; then
for T in "tests/$1"/*; do
run_test "$T"
done
else
run_test "tests/$1/$2"
fi
tools/rsyncd-stop.sh
tools/apache2-stop.sh
echo ""
echo "Successes: $NSUCCESSES"
echo "Failures : $NFAILS"
echo "Skipped : $NSKIPS"
echo "Unknown : $NUNKNOWNS"
echo ""
echo "Total checks: $(cat sandbox/checks/total.txt | wc -c)"
echo "Warnings : $(cat sandbox/checks/warns.txt | wc -c)"
echo ""
echo "Please remember that the test suite might be at fault for issues."
echo "Also, the tests are presently built around Fort."
echo "(Other RPs might disagree on what the correct results should be.)"