mirror of
https://gitlab.freedesktop.org/emersion/libdisplay-info.git
synced 2024-12-25 21:59:08 +01:00
4e5df43659
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>
21 lines
544 B
Bash
Executable file
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
|