From f5115174fe80d1fc5c4cccc62bb7f6649a6f3584 Mon Sep 17 00:00:00 2001 From: glasseyes Date: Mon, 19 Nov 2018 10:39:03 +0700 Subject: [PATCH 1/3] kmx to find tests in current dir, meson on bionic to allow debugging it meson 0.45 on Ubuntu bionic doesn't have configure_files:copy or test:depends --- common/engine/keyboardprocessor/tests/unit/kmx/kmx.cpp | 7 +++++++ common/engine/keyboardprocessor/tests/unit/kmx/meson.build | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/common/engine/keyboardprocessor/tests/unit/kmx/kmx.cpp b/common/engine/keyboardprocessor/tests/unit/kmx/kmx.cpp index a2bc36e5bf..be1bf114a8 100644 --- a/common/engine/keyboardprocessor/tests/unit/kmx/kmx.cpp +++ b/common/engine/keyboardprocessor/tests/unit/kmx/kmx.cpp @@ -285,6 +285,13 @@ int load_source(const std::string & file, std::string & keys, std::u16string & e // Parse out the header statements in file.kmn that tell us (a) environment, (b) key sequence, (c) start context, (d) expected result std::ifstream kmn(base + file + ".kmn"); + // Find the test file if running kmx directly + if (!kmn.good()) { + kmn.open(file + ".kmn"); + } + if (!kmn.good()) { + return __LINE__; + } std::string line; while (std::getline(kmn, line)) { trim(line); diff --git a/common/engine/keyboardprocessor/tests/unit/kmx/meson.build b/common/engine/keyboardprocessor/tests/unit/kmx/meson.build index 27ed5decc9..b139debdf2 100644 --- a/common/engine/keyboardprocessor/tests/unit/kmx/meson.build +++ b/common/engine/keyboardprocessor/tests/unit/kmx/meson.build @@ -47,8 +47,8 @@ foreach kmn : kmns kmn_sources += configure_file( input: 'kmn/' + kmn + '.kmn', output: kmn + '.kmn', - copy: true + configuration: configuration_data() ) endforeach -test('kmx', kmx, depends: kmn_tests, args: [kmns]) +test('kmx', kmx, args: [kmns]) From d62f2034c6155cd0104a80cccdd274c026383ffb Mon Sep 17 00:00:00 2001 From: glasseyes Date: Mon, 19 Nov 2018 11:10:36 +0700 Subject: [PATCH 2/3] compile kmn in configure step --- common/engine/keyboardprocessor/tests/unit/kmx/meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/engine/keyboardprocessor/tests/unit/kmx/meson.build b/common/engine/keyboardprocessor/tests/unit/kmx/meson.build index b139debdf2..f1c1a4c9d8 100644 --- a/common/engine/keyboardprocessor/tests/unit/kmx/meson.build +++ b/common/engine/keyboardprocessor/tests/unit/kmx/meson.build @@ -37,8 +37,7 @@ kmn_sources = [] prog_kmcomp = find_program('kmcomp') foreach kmn : kmns - kmn_tests += custom_target( - kmn + '.kmn', + kmn_tests += configure_file( output: kmn + '.kmx', input: 'kmn/' + kmn + '.kmn', command : [prog_kmcomp, '-s', '@INPUT@', '@OUTPUT@'] From 16dd44047eccdc5a08daae798a88950d19aef1b5 Mon Sep 17 00:00:00 2001 From: glasseyes Date: Tue, 20 Nov 2018 13:00:09 +0700 Subject: [PATCH 3/3] make kmx test optional Debian and other automated buildds won't have kmcomp.exe so don't let that fail the build --- .../tests/unit/kmx/meson.build | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/common/engine/keyboardprocessor/tests/unit/kmx/meson.build b/common/engine/keyboardprocessor/tests/unit/kmx/meson.build index 262943cb4c..c77e7b3874 100644 --- a/common/engine/keyboardprocessor/tests/unit/kmx/meson.build +++ b/common/engine/keyboardprocessor/tests/unit/kmx/meson.build @@ -40,20 +40,24 @@ kmns = [ kmn_tests = [] kmn_sources = [] -prog_kmcomp = find_program('kmcomp') +prog_kmcomp = find_program('kmcomp', required: false) -foreach kmn : kmns - kmn_tests += configure_file( - output: kmn + '.kmx', - input: 'kmn/' + kmn + '.kmn', - command : [prog_kmcomp, '-s', '@INPUT@', '@OUTPUT@'] - ) +if prog_kmcomp.found() + + foreach kmn : kmns + kmn_tests += configure_file( + output: kmn + '.kmx', + input: 'kmn/' + kmn + '.kmn', + command : [prog_kmcomp, '-s', '@INPUT@', '@OUTPUT@'] + ) - kmn_sources += configure_file( - input: 'kmn/' + kmn + '.kmn', - output: kmn + '.kmn', - configuration: configuration_data() - ) -endforeach + kmn_sources += configure_file( + input: 'kmn/' + kmn + '.kmn', + output: kmn + '.kmn', + configuration: configuration_data() + ) + endforeach -test('kmx', kmx, args: [kmns]) + test('kmx', kmx, args: [kmns]) + +endif