run.sh (819B)
1 #!/bin/sh 2 # tests/run.sh - run the linkd test suite. 3 # 4 # ./tests/run.sh everything 5 # ./tests/run.sh --unit same (only unit tests exist here) 6 # 7 # linkd's own tests never boot a machine. Anything that needs a running system 8 # -- bridges, VLANs, VRFs, addressing against a real kernel -- is an 9 # integration test and lives in the consuming OS repo, because it needs a 10 # rootfs and a VM that this repo has no business building. 11 set -eu 12 HERE=$(cd "$(dirname "$0")" && pwd) 13 14 fail=0 15 run_one() { 16 echo 17 echo "=== $1 ===" 18 if sh "$1"; then 19 echo "--- PASS $1" 20 else 21 echo "--- FAIL $1" >&2 22 fail=1 23 fi 24 } 25 26 for t in "${HERE}"/unit/*.sh; do 27 [ -e "$t" ] || continue 28 run_one "$t" 29 done 30 31 echo 32 if [ "$fail" = "0" ]; then 33 echo "ALL TESTS PASSED" 34 else 35 echo "SOME TESTS FAILED" >&2 36 fi 37 exit "$fail"