forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify_examples.sh
executable file
·80 lines (69 loc) · 1.94 KB
/
verify_examples.sh
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
#!/bin/bash -E
TESTFILTER="${1:-*}"
TESTEXCLUDES="${2}"
FAILED=()
SRCDIR="${SRCDIR:-$(pwd)}"
WARNINGS=()
# Sandboxes listed here should be regarded as broken(/untested) until whatever
# is causing them to flake is resolved!!!
FLAKY_SANDBOXES=(
# https://github.com/envoyproxy/envoy/issues/28542
double-proxy
# https://github.com/envoyproxy/envoy/issues/31347
local_ratelimit
# https://github.com/envoyproxy/envoy/issues/31333
locality-load-balancing
# https://github.com/envoyproxy/envoy/issues/28541
wasm-cc
# https://github.com/envoyproxy/envoy/issues/28546
websocket)
trap_errors () {
local frame=0 command line sub file
for flake in "${FLAKY_SANDBOXES[@]}"; do
if [[ "$example" == "./${flake}" ]]; then
WARNINGS+=("FAILED (${flake})")
return
fi
done
if [[ -n "$example" ]]; then
command=" (${example})"
fi
set +v
while read -r line sub file < <(caller "$frame"); do
if [[ "$frame" -ne "0" ]]; then
FAILED+=(" > ${sub}@ ${file} :${line}")
else
FAILED+=("${sub}@ ${file} :${line}${command}")
fi
((frame++))
done
set -v
}
trap trap_errors ERR
trap exit 1 INT
run_examples () {
local examples example
cd "${SRCDIR}/examples" || exit 1
examples=$(find . -mindepth 1 -maxdepth 1 -type d -name "$TESTFILTER" ! -iname "_*" | sort)
if [[ -n "$TESTEXCLUDES" ]]; then
examples=$(echo "$examples" | grep -Ev "$TESTEXCLUDES")
fi
for example in $examples; do
pushd "$example" > /dev/null || return 1
./verify.sh
popd > /dev/null || return 1
done
}
run_examples
if [[ "${#WARNINGS[@]}" -ne "0" ]]; then
for warning in "${WARNINGS[@]}"; do
echo "WARNING: $warning" >&2
done
fi
if [[ "${#FAILED[@]}" -ne "0" ]]; then
echo "TESTS FAILED:"
for failed in "${FAILED[@]}"; do
echo "$failed" >&2
done
exit 1
fi