eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

check-tests (904B)


      1 #!/bin/sh
      2 # ELL can report failed TAP cases while returning exit status zero.
      3 set -u
      4 log=$(mktemp "${TMPDIR:-/tmp}/eiwd-tests.XXXXXXXX") || exit 1
      5 trap 'rm -f "$log"' 0
      6 trap 'exit 1' HUP INT TERM
      7 failed=0
      8 
      9 for test in "$@"; do
     10 	printf '\nRunning %s\n' "$test"
     11 	case $test in /*|./*) executable=$test ;; *) executable=./$test ;; esac
     12 	status=0
     13 	"$executable" > "$log" 2>&1 || status=$?
     14 	cat "$log"
     15 	if [ "$status" -eq 77 ]; then
     16 		printf 'SKIP %s\n' "$test"
     17 		continue
     18 	fi
     19 	if [ "$status" -ne 0 ] || ! awk '
     20 		/^Bail out!/ { failed = 1 }
     21 		/^not ok([ \t]|$)/ {
     22 			count++
     23 			if ($0 !~ /#[ \t]*TODO/)
     24 				failed = 1
     25 		}
     26 		/^ok([ \t]|$)/ { count++ }
     27 		/^1\.\.[0-9]+/ {
     28 			if (seen++)
     29 				failed = 1
     30 			plan = $0
     31 			sub(/^1\.\./, "", plan)
     32 			plan += 0
     33 		}
     34 		END { exit (failed || !seen || count != plan) }
     35 	' "$log"; then
     36 		printf 'FAIL %s (exit %s)\n' "$test" "$status"
     37 		failed=1
     38 	fi
     39 done
     40 
     41 exit "$failed"