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/` The low-level EDID library is tested against [edid-decode]. `test/data/`
contains a small collection of EDID blobs and diffs between upstream 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 `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 up-to-date. A patch should never make the diffs grow larger. To re-generate the
blob or update a diff, use `test/edid-decode-diff.sh test/data/<edid>`. test data, run `ninja -C build/ gen-test-data`.
To run the test suite locally, you need to use [edid-decode] of the git 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 revision mentioned in `.gitlab-ci.yml`. Otherwise you may experience false

View file

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

View file

@ -29,24 +29,39 @@ test_cases = [
'viewsonic-vp2768-dp', '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 foreach tc : test_cases
test( test(
'decode-' + tc, 'decode-' + tc,
test_harness, test_harness,
args: [files('data/' + tc + '.edid')], args: [files('data/' + tc + '.edid')],
env: [ env: test_env,
'REF_EDID_DECODE=' + ref_edid_decode.full_path(),
'DI_EDID_DECODE=' + di_edid_decode.full_path(),
],
depends: [di_edid_decode], depends: [di_edid_decode],
) )
test( test(
'print-' + tc, 'print-' + tc,
print_harness, print_harness,
args: [files('data/' + tc + '.edid')], args: [files('data/' + tc + '.edid')],
env: [ env: test_env,
'DI_EDID_PRINT=' + di_edid_print.full_path(),
],
depends: [di_edid_print], depends: [di_edid_print],
) )
endforeach 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,
)