libdisplay-info/test/edid-decode-diff.sh
Pekka Paalanen 00b446d5db test: make edid-decode-diff.sh easier to run
Having to define just DI_EDID_DECODE was tolerable when REF_EDID_DECODE
does not need setting, but now that there are two built tools, it is
getting inconvenient.

Change the defaults to match the build directory structure and add a new
overridable for the build directory.

Now I only need to set BUILDDIR for this to work. My build dirs are
completely elsewhere, but if someone uses the usual 'meson build'
incantation, the default value for BUILDDIR should be fine.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-11-09 14:18:04 +02:00

26 lines
705 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_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