commit d163123589e9e2ed6dde377b66d7668b80616ac5
parent edcd2eab9a587add7df9a97628e7cf7f7420f411
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date: Sun, 20 Sep 2026 09:08:29 -0300
tools: add a backend tag matrix test
Builds and tests every supported tag combination, and asserts that disabling
all backends fails the build rather than producing a binary that only errors
at run time.
Tag-guarded files rot silently: the wasm backend was excluded from every
build by an implicit GOARCH constraint and the suite still passed, because
the dynamic backend covered for it.
Diffstat:
1 file changed, 32 insertions(+), 0 deletions(-)
diff --git a/tools/test-matrix.sh b/tools/test-matrix.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Build and test every supported backend tag combination, and confirm that
+# disabling all backends fails the build rather than producing a binary that
+# only errors at run time.
+
+set -eu
+
+cd "$(dirname "$0")/.."
+
+fail=0
+
+for tags in "" "transpiled" "nowasm" "nodynamic" "nodynamic,transpiled"; do
+ label=${tags:-"(default)"}
+ printf '\n=== tags: %s ===\n' "$label"
+ if go test -count=1 -tags "$tags" ./webp/ ./lib/...; then
+ :
+ else
+ echo "FAILED: tags=$label"
+ fail=1
+ fi
+done
+
+printf '\n=== tags: nodynamic,nowasm (must not build) ===\n'
+if go build -tags nodynamic,nowasm ./webp/ 2>/dev/null; then
+ echo "FAILED: expected a build error when every backend is disabled"
+ fail=1
+else
+ echo "ok — build rejected as intended"
+fi
+
+exit $fail