libdisplay-info/test/edid-decode-diff.sh
Simon Ser 4e5df43659 test: rename EDID files with .edid filename extension
This makes it easier to perform an operation on all EDID files at
once, e.g. "test/edid-decode-diff.sh test/data/*.edid" to update all
diffs at once.

Signed-off-by: Simon Ser <contact@emersion.fr>
2022-08-29 15:23:41 +02:00

21 lines
544 B
Bash
Executable file

#!/bin/sh -eu
REF_EDID_DECODE="${REF_EDID_DECODE:-edid-decode}"
DI_EDID_DECODE="${DI_EDID_DECODE:-di-edid-decode}"
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
done