diff options
| author | Simon Ser <contact@emersion.fr> | 2024-01-15 14:29:10 +0100 |
|---|---|---|
| committer | Simon Ser <contact@emersion.fr> | 2024-01-15 14:29:10 +0100 |
| commit | 0e139cfbc710156bc4b4b3c254c7b2ff2f10ff34 (patch) | |
| tree | c52d977264d129dc870f7494b3e43b79f750bf80 | |
| parent | protocol: wl_subsurface will never be focused (diff) | |
| download | wayland-0e139cfbc710156bc4b4b3c254c7b2ff2f10ff34.tar wayland-0e139cfbc710156bc4b4b3c254c7b2ff2f10ff34.tar.gz wayland-0e139cfbc710156bc4b4b3c254c7b2ff2f10ff34.tar.bz2 wayland-0e139cfbc710156bc4b4b3c254c7b2ff2f10ff34.tar.lz wayland-0e139cfbc710156bc4b4b3c254c7b2ff2f10ff34.tar.xz wayland-0e139cfbc710156bc4b4b3c254c7b2ff2f10ff34.tar.zst wayland-0e139cfbc710156bc4b4b3c254c7b2ff2f10ff34.zip | |
build: add a gen-scanner-test target
This adds a command to re-generate the test data. This needs to be
done when either an XML source file or the scanner's output is
changed.
Signed-off-by: Simon Ser <contact@emersion.fr>
| -rw-r--r-- | tests/data/README.md | 3 | ||||
| -rw-r--r-- | tests/meson.build | 20 | ||||
| -rwxr-xr-x | tests/scanner-test-gen.sh | 21 |
3 files changed, 38 insertions, 6 deletions
diff --git a/tests/data/README.md b/tests/data/README.md new file mode 100644 index 0000000..1481345 --- /dev/null +++ b/tests/data/README.md @@ -0,0 +1,3 @@ +To re-generate the test data, run: + + ninja -C build/ gen-scanner-test diff --git a/tests/meson.build b/tests/meson.build index 6cdd2b4..236f08c 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -75,15 +75,23 @@ endif sed_path = find_program('sed').full_path() if get_option('scanner') + scanner_test_env = [ + 'TEST_DATA_DIR=@0@/data'.format(meson.current_source_dir()), + 'TEST_OUTPUT_DIR=@0@/output'.format(meson.current_build_dir()), + 'SED=@0@'.format(sed_path), + 'WAYLAND_SCANNER=@0@'.format(wayland_scanner.full_path()), + ] + test( 'scanner-test', find_program('scanner-test.sh'), - env: [ - 'TEST_DATA_DIR=@0@/data'.format(meson.current_source_dir()), - 'TEST_OUTPUT_DIR=@0@/output'.format(meson.current_build_dir()), - 'SED=@0@'.format(sed_path), - 'WAYLAND_SCANNER=@0@'.format(wayland_scanner.full_path()), - ], + env: scanner_test_env, + ) + + run_target( + 'gen-scanner-test', + command: find_program('scanner-test-gen.sh'), + env: scanner_test_env, ) endif diff --git a/tests/scanner-test-gen.sh b/tests/scanner-test-gen.sh new file mode 100755 index 0000000..5af1a72 --- /dev/null +++ b/tests/scanner-test-gen.sh @@ -0,0 +1,21 @@ +#!/bin/sh -eu + +generate() { + "$WAYLAND_SCANNER" $1 < "$TEST_DATA_DIR/$2" > "$TEST_DATA_DIR/$3" + "$SED" -i -e 's/Generated by wayland-scanner [0-9.]*/SCANNER TEST/' \ + "$TEST_DATA_DIR/$3" +} + +generate "code" "example.xml" "example-code.c" +generate "client-header" "example.xml" "example-client.h" +generate "server-header" "example.xml" "example-server.h" + +generate "code" "small.xml" "small-code.c" +generate "client-header" "small.xml" "small-client.h" +generate "server-header" "small.xml" "small-server.h" + +generate "-c code" "small.xml" "small-code-core.c" +generate "-c client-header" "small.xml" "small-client-core.h" +generate "-c server-header" "small.xml" "small-server-core.h" + +generate "private-code" "small.xml" "small-private-code.c" |
