-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·42 lines (33 loc) · 906 Bytes
/
test.sh
File metadata and controls
executable file
·42 lines (33 loc) · 906 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# If explicit build directories exist (from --debug), test each.
# Otherwise test the default build/ directory.
run_tests() {
local build_dir="$1"
local label="$2"
if [[ ! -d "$build_dir" ]]; then
echo "SKIP: ${label} — ${build_dir} not found"
return 0
fi
echo ""
echo "=== Testing: ${label} (${build_dir}) ==="
echo ""
cd "$build_dir" && ctest --output-on-failure "$@"
}
TESTED=0
for dir_label in \
"build/debug_asan:Debug+ASAN" \
"build:Default"; do
dir="${dir_label%%:*}"
label="${dir_label##*:}"
full_path="${SCRIPT_DIR}/${dir}"
if [[ -f "$full_path/CTestTestfile.cmake" ]]; then
run_tests "$full_path" "$label"
TESTED=$((TESTED + 1))
fi
done
if [[ $TESTED -eq 0 ]]; then
echo "ERROR: no build directory found. Run ./build.sh first."
exit 1
fi