-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.sh
More file actions
executable file
·41 lines (36 loc) · 987 Bytes
/
Copy pathrun_tests.sh
File metadata and controls
executable file
·41 lines (36 loc) · 987 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
#!/usr/bin/env bash
#
# run_tests.sh -- Build and run every tests/test_*.cpp under
# bindings/cpp.
#
# Each tests/test_*.cpp is compiled to its own standalone executable
# in tests/build/, then run in turn. Per-process isolation gives every
# test a fresh libitb3 global state without needing an in-process
# serial lock. Binaries link libitb3.so via embedded RPATH, so
# LD_LIBRARY_PATH is unnecessary at runtime.
#
# Usage:
# ./run_tests.sh
#
# Exit code is 0 when every test binary returns 0, 1 otherwise.
set -euo pipefail
cd "$(dirname "$0")"
./build.sh
fail=0
pass=0
for bin in tests/build/test_*; do
[ -x "$bin" ] || continue
name="$(basename "$bin")"
if "$bin" >/dev/null 2>&1; then
printf ' \033[32m✓\033[0m %s\n' "$name"
pass=$((pass + 1))
else
printf ' \033[31m✗\033[0m %s\n' "$name"
"$bin" 2>&1 | sed 's/^/ /'
fail=$((fail + 1))
fi
done
echo
echo " PASS: $pass"
echo " FAIL: $fail"
exit "$fail"