mirror of
https://gitlab.freedesktop.org/emersion/libdisplay-info.git
synced 2024-12-26 21:59:15 +01:00
Add edid-decode testing infrastructure
Add two small shell utilities to generate and compare diffs between edid-decode and di-edid-decode. Store the diffs in-tree and add tests to ensure they don't regress. Run the tests in CI with a pinned installation of edid-decode. One EDID blob is added to the test collection: dell-2408wfp-dp. It's extracted [1] from the edid-decode repository. [1]: https://git.linuxtv.org/edid-decode.git/tree/data/dell-2408wfp-dp Signed-off-by: Simon Ser <contact@emersion.fr> Closes: https://gitlab.freedesktop.org/emersion/libdisplay-info/-/issues/5
This commit is contained in:
parent
1c0f7497f5
commit
a8e78208a5
8 changed files with 131 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
.templates_sha: &templates_sha 3e66ea37e5672bb8f48e3056ba92915b5fc5b888
|
||||
.templates_sha: &templates_sha 3f37cc0e461f5b0c815409bf6f55759f26a74e9c
|
||||
|
||||
include:
|
||||
- project: 'freedesktop/ci-templates'
|
||||
|
@ -8,9 +8,13 @@ include:
|
|||
ref: *templates_sha
|
||||
file: '/templates/alpine.yml'
|
||||
|
||||
# When updating the prepare-container step, make sure to bump
|
||||
# FDO_DISTRIBUTION_TAG, otherwise the container won't get rebuilt.
|
||||
# FDO_FORCE_REBUILD can be used when testing container changes.
|
||||
variables:
|
||||
FDO_UPSTREAM_REPO: 'emersion/libdisplay-info'
|
||||
FDO_DISTRIBUTION_TAG: '2022-03-24.2'
|
||||
FDO_DISTRIBUTION_TAG: '2022-03-28.0'
|
||||
#FDO_FORCE_REBUILD: 1
|
||||
|
||||
stages:
|
||||
- "Contribution checks"
|
||||
|
@ -32,7 +36,15 @@ prepare-container:
|
|||
extends: .fdo.container-build@alpine@x86_64
|
||||
stage: "Prepare container"
|
||||
variables:
|
||||
FDO_DISTRIBUTION_PACKAGES: 'build-base meson'
|
||||
FDO_DISTRIBUTION_PACKAGES: 'build-base meson make git'
|
||||
FDO_DISTRIBUTION_EXEC: |
|
||||
git clone git://linuxtv.org/edid-decode.git
|
||||
cd edid-decode
|
||||
git checkout 8a8d673d738ce010ca32a179032e8f6c0bb5dfb4
|
||||
make
|
||||
make install
|
||||
cd ..
|
||||
rm -rf edid-decode
|
||||
rules:
|
||||
- when: on_success
|
||||
|
||||
|
|
|
@ -18,7 +18,16 @@ particular, each commit must carry a Signed-off-by tag to denote that the
|
|||
submitter adheres to the [Developer Certificate of Origin 1.1]. This project
|
||||
follows the [freedesktop.org Contributor Covenant].
|
||||
|
||||
## Testing
|
||||
|
||||
The low-level EDID library is tested against [edid-decode]. `test/data/`
|
||||
contains a small collection of EDID blobs and diffs between upstream
|
||||
`edid-decode` and our `di-edid-decode` clone. Our CI ensures the diffs are
|
||||
up-to-date. A patch should never make the diffs grow larger. To add a new EDID
|
||||
blob or update a diff, use `test/edid-decode-diff.sh test/data/<edid>`.
|
||||
|
||||
[GitLab project]: https://gitlab.freedesktop.org/emersion/libdisplay-info
|
||||
[Wayland contribution guidelines]: https://gitlab.freedesktop.org/wayland/wayland/-/blob/main/CONTRIBUTING.md
|
||||
[Developer Certificate of Origin 1.1]: https://developercertificate.org/
|
||||
[freedesktop.org Contributor Covenant]: https://www.freedesktop.org/wiki/CodeOfConduct/
|
||||
[edid-decode]: https://git.linuxtv.org/edid-decode.git/
|
||||
|
|
|
@ -3,7 +3,7 @@ project(
|
|||
'c',
|
||||
version: '0.0.0',
|
||||
license: 'MIT',
|
||||
meson_version: '>= 0.52.1',
|
||||
meson_version: '>= 0.55.0',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
'warning_level=3',
|
||||
|
@ -51,9 +51,11 @@ di_dep = declare_dependency(
|
|||
include_directories: include_directories('include'),
|
||||
)
|
||||
|
||||
executable(
|
||||
di_edid_decode = executable(
|
||||
'di-edid-decode',
|
||||
'di-edid-decode.c',
|
||||
dependencies: di_dep,
|
||||
install: true,
|
||||
)
|
||||
|
||||
subdir('test')
|
||||
|
|
BIN
test/data/dell-2408wfp-dp
Normal file
BIN
test/data/dell-2408wfp-dp
Normal file
Binary file not shown.
42
test/data/dell-2408wfp-dp.diff
Normal file
42
test/data/dell-2408wfp-dp.diff
Normal file
|
@ -0,0 +1,42 @@
|
|||
--- ref
|
||||
+++ di
|
||||
@@ -5,39 +5,3 @@
|
||||
Model: 41003
|
||||
Serial Number: 842091859
|
||||
Made in: week 47 of 2008
|
||||
- Basic Display Parameters & Features:
|
||||
- Digital display
|
||||
- Bits per primary color channel: 8
|
||||
- DisplayPort interface
|
||||
- Maximum image size: 52 cm x 32 cm
|
||||
- Gamma: 2.20
|
||||
- DPMS levels: Off
|
||||
- Supported color formats: RGB 4:4:4
|
||||
- First detailed timing includes the native pixel format and preferred refresh rate
|
||||
- Color Characteristics:
|
||||
- Red : 0.6738, 0.3193
|
||||
- Green: 0.1875, 0.7060
|
||||
- Blue : 0.1484, 0.0644
|
||||
- White: 0.3134, 0.3291
|
||||
- Established Timings I & II:
|
||||
- IBM : 720x400 70.081663 Hz 9:5 31.467 kHz 28.320000 MHz
|
||||
- DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175000 MHz
|
||||
- DMT 0x06: 640x480 75.000000 Hz 4:3 37.500 kHz 31.500000 MHz
|
||||
- DMT 0x09: 800x600 60.316541 Hz 4:3 37.879 kHz 40.000000 MHz
|
||||
- DMT 0x0b: 800x600 75.000000 Hz 4:3 46.875 kHz 49.500000 MHz
|
||||
- DMT 0x10: 1024x768 60.003840 Hz 4:3 48.363 kHz 65.000000 MHz
|
||||
- DMT 0x12: 1024x768 75.028582 Hz 4:3 60.023 kHz 78.750000 MHz
|
||||
- DMT 0x24: 1280x1024 75.024675 Hz 5:4 79.976 kHz 135.000000 MHz
|
||||
- Standard Timings:
|
||||
- DMT 0x23: 1280x1024 60.019740 Hz 5:4 63.981 kHz 108.000000 MHz
|
||||
- DMT 0x33: 1600x1200 60.000000 Hz 4:3 75.000 kHz 162.000000 MHz
|
||||
- DMT 0x15: 1152x864 75.000000 Hz 4:3 67.500 kHz 108.000000 MHz
|
||||
- Detailed Timing Descriptors:
|
||||
- DTD 1: 1920x1200 59.950171 Hz 8:5 74.038 kHz 154.000000 MHz (519 mm x 320 mm)
|
||||
- Hfront 48 Hsync 32 Hback 80 Hpol P
|
||||
- Vfront 3 Vsync 6 Vback 26 Vpol N
|
||||
- Display Product Serial Number: 'G283H8BI21MS'
|
||||
- Display Product Name: 'DELL 2408WFP'
|
||||
- Display Range Limits:
|
||||
- Monitor ranges (Bare Limits): 56-76 Hz V, 30-83 kHz H, max dotclock 170 MHz
|
||||
-Checksum: 0x92
|
17
test/edid-decode-check.sh
Executable file
17
test/edid-decode-check.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh -eu
|
||||
|
||||
workdir="$(mktemp -d)"
|
||||
cleanup() {
|
||||
rm -rf "$workdir"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
edid="$1"
|
||||
"$REF_EDID_DECODE" -s <"$edid" >"$workdir/ref"
|
||||
"$DI_EDID_DECODE" <"$edid" >"$workdir/di"
|
||||
|
||||
if [ -f "$edid.diff" ]; then
|
||||
patch "$workdir/ref" "$edid.diff"
|
||||
fi
|
||||
|
||||
diff -u "$workdir/ref" "$workdir/di"
|
20
test/edid-decode-diff.sh
Executable file
20
test/edid-decode-diff.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/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
|
||||
"$REF_EDID_DECODE" -s <"$edid" >"$workdir/ref"
|
||||
"$DI_EDID_DECODE" <"$edid" >"$workdir/di"
|
||||
if ! diff -u --label ref "$workdir/ref" --label di "$workdir/di" >"$workdir/diff"; then
|
||||
cp "$workdir/diff" "$edid.diff"
|
||||
else
|
||||
rm "$edid.diff"
|
||||
fi
|
||||
done
|
24
test/meson.build
Normal file
24
test/meson.build
Normal file
|
@ -0,0 +1,24 @@
|
|||
ref_edid_decode = find_program('edid-decode', native: true, required: false)
|
||||
if not ref_edid_decode.found()
|
||||
test('edid-decode-not-found', find_program('false'))
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
test_harness = find_program('./edid-decode-check.sh', native: true)
|
||||
|
||||
test_cases = [
|
||||
'dell-2408wfp-dp',
|
||||
]
|
||||
|
||||
foreach tc : test_cases
|
||||
test(
|
||||
tc,
|
||||
test_harness,
|
||||
args: [files('data/' + tc)],
|
||||
env: [
|
||||
'REF_EDID_DECODE=' + ref_edid_decode.full_path(),
|
||||
'DI_EDID_DECODE=' + di_edid_decode.full_path(),
|
||||
],
|
||||
depends: [di_edid_decode],
|
||||
)
|
||||
endforeach
|
Loading…
Reference in a new issue