From e19ee5d1bc28d97007ec1d454c96b72e10f5c1bf Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 17 Nov 2022 22:10:08 +0100 Subject: [PATCH] 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 --- README.md | 4 ++-- meson.build | 2 +- test/meson.build | 29 ++++++++++++++++++++++------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 70f3803..c9503ed 100644 --- a/README.md +++ b/README.md @@ -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/`. +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 diff --git a/meson.build b/meson.build index ebc3a13..d5ccdb8 100644 --- a/meson.build +++ b/meson.build @@ -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', diff --git a/test/meson.build b/test/meson.build index 1fe6d10..ae5861e 100644 --- a/test/meson.build +++ b/test/meson.build @@ -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, +)