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
#!/usr/bin/env bash
set -euo pipefail
# ckpool/test holds two kinds of test. Upstream's are wired into automake and
# need the src headers and libckpool.a, so they are built and run by "make
# check". Ours are standalone single file programs compiled straight with gcc.
# Tell them apart by whether they include any local header.
failed=0
for file in ./ckpool/test/*.c; do
if grep -q '#include "' "$file"; then
continue
fi
base="${file%.c}"
echo "Testing $file"
if gcc -Wall -o "$base" "$file" && "$base"; then
echo "OK"
else
echo "ERROR: $file failed"
failed=1
fi
rm -f "$base"
done
# Upstream's suite. Only run it if the tree has been configured, so that a
# bare "just test" does not fail purely for lack of a build.
if [ -f ./ckpool/Makefile ]; then
echo "Running ckpool make check"
if ! make -C ckpool check; then
echo "ERROR: ckpool make check failed"
failed=1
fi
else
echo "ckpool not configured, skipping make check (run 'just build-ckpool' first)"
fi
exit "$failed"