test-matrix.sh (799B)
1 #!/bin/sh 2 # 3 # Build and test every supported backend tag combination, and confirm that 4 # disabling all backends fails the build rather than producing a binary that 5 # only errors at run time. 6 7 set -eu 8 9 cd "$(dirname "$0")/.." 10 11 fail=0 12 13 for tags in "" "transpiled" "nowasm" "nodynamic" "nodynamic,transpiled"; do 14 label=${tags:-"(default)"} 15 printf '\n=== tags: %s ===\n' "$label" 16 if go test -count=1 -tags "$tags" ./webp/ ./lib/...; then 17 : 18 else 19 echo "FAILED: tags=$label" 20 fail=1 21 fi 22 done 23 24 printf '\n=== tags: nodynamic,nowasm (must not build) ===\n' 25 if go build -tags nodynamic,nowasm ./webp/ 2>/dev/null; then 26 echo "FAILED: expected a build error when every backend is disabled" 27 fail=1 28 else 29 echo "ok — build rejected as intended" 30 fi 31 32 exit $fail