build: add gen-test-data run target

This makes it easier to re-generate the test diffs. The build system
will properly set DI_EDID_DECODE/DI_EDID_PRINT (and will rebuild
these tools if they are out-of-date).

Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Ser 2022-11-17 22:10:08 +01:00
parent ac857e8985
commit e19ee5d1bc
3 changed files with 25 additions and 10 deletions

View file

@ -50,8 +50,8 @@ libdisplay-info is built using [Meson]:
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>`.
up-to-date. A patch should never make the diffs grow larger. To re-generate the
test data, run `ninja -C build/ gen-test-data`.
To run the test suite locally, you need to use [edid-decode] of the git
revision mentioned in `.gitlab-ci.yml`. Otherwise you may experience false

View file

@ -3,7 +3,7 @@ project(
'c',
version: '0.0.0',
license: 'MIT',
meson_version: '>= 0.55.0',
meson_version: '>= 0.57.0',
default_options: [
'c_std=c11',
'warning_level=3',

View file

@ -29,24 +29,39 @@ test_cases = [
'viewsonic-vp2768-dp',
]
test_env = [
'REF_EDID_DECODE=' + ref_edid_decode.full_path(),
'DI_EDID_DECODE=' + di_edid_decode.full_path(),
'DI_EDID_PRINT=' + di_edid_print.full_path(),
]
foreach tc : test_cases
test(
'decode-' + tc,
test_harness,
args: [files('data/' + tc + '.edid')],
env: [
'REF_EDID_DECODE=' + ref_edid_decode.full_path(),
'DI_EDID_DECODE=' + di_edid_decode.full_path(),
],
env: test_env,
depends: [di_edid_decode],
)
test(
'print-' + tc,
print_harness,
args: [files('data/' + tc + '.edid')],
env: [
'DI_EDID_PRINT=' + di_edid_print.full_path(),
],
env: test_env,
depends: [di_edid_print],
)
endforeach
test_gen = find_program('./edid-decode-diff.sh', native: true)
gen_targets = []
foreach tc : test_cases
gen_targets += files('data/' + tc + '.edid')
endforeach
run_target(
'gen-test-data',
command: [test_gen] + gen_targets,
depends: [di_edid_decode, di_edid_print],
env: test_env,
)