libdisplay-info/test/edid-decode-diff.sh
Simon Ser 85d6a3a1db test: fix default path for di-edid-decode
Since a001cab480 ("build: split off di-edid-decode into separate
file"), di-edid-decode is located in a subdirectory.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-11-23 11:12:24 +01:00

26 lines
720 B
Bash
Executable file

#!/bin/sh -eu
REF_EDID_DECODE="${REF_EDID_DECODE:-edid-decode}"
BUILDDIR="${BUILDDIR:-./build}"
DI_EDID_DECODE="${DI_EDID_DECODE:-${BUILDDIR}/di-edid-decode/di-edid-decode}"
DI_EDID_PRINT="${DI_EDID_PRINT:-${BUILDDIR}/test/di-edid-print}"
workdir="$(mktemp -d)"
cleanup() {
rm -rf "$workdir"
}
trap cleanup EXIT
for edid in "$@"; do
diff="${edid%.edid}.diff"
"$REF_EDID_DECODE" --skip-hex-dump --check --skip-sha <"$edid" >"$workdir/ref" || [ $? = 254 ]
"$DI_EDID_DECODE" <"$edid" >"$workdir/di" || [ $? = 254 ]
if ! diff -u --label ref "$workdir/ref" --label di "$workdir/di" >"$workdir/diff"; then
cp "$workdir/diff" "$diff"
else
rm -f "$diff"
fi
"$DI_EDID_PRINT" <"$edid" >"${edid%.edid}.print"
done