Similar to cc features, we declare the same for gdb. With both available, we can now declare all tests inconditionally.
Signed-off-by: Pierrick Bouvier <[email protected]> --- tests/tcg/meson.build | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build index 91e71ac40f2..3b1c72a0f8d 100644 --- a/tests/tcg/meson.build +++ b/tests/tcg/meson.build @@ -27,6 +27,10 @@ tcg_tests = {} # }, # 'folder': 'folder_for_test_src_files', # 'gdb_arch': 'gdb architecture requirement', +# 'gdb_feat_version': { +# 'name': ['minimal gdb version supporting feature'], +# ... +# }, # 'qemu': emulators['qemu-...'], # 'tests': [ # { @@ -38,6 +42,7 @@ tcg_tests = {} # 'qemu_args': ['qemu command line flags', ...], # 'expected_output': 'file_to_compare_output', # 'gdb_test': ['gdb test args'], +# 'gdb_feat': ['feature name, must be present in gdb_feat_version'], # 'env_var': ['VAR=value', ...], # 'wrapper': [program_to_launch_test, 'args'...], # 'plugin_test': { @@ -84,7 +89,8 @@ foreach target, plan: tcg_tests # return a clear error if user misspell a target entry foreach key, _ : plan - allowed = ['cc', 'cc_feat_cflags', 'folder', 'gdb_arch', 'qemu', 'tests'] + allowed = ['cc', 'cc_feat_cflags', 'folder', 'gdb_arch', 'gdb_feat_version', + 'qemu', 'tests'] if key not in allowed error('unknown tcg test plan entry \'' + key + '\' for target ' + target + ' (possible: [' + ', '.join(allowed) + '])') @@ -99,6 +105,11 @@ foreach target, plan: tcg_tests if 'cc_feat_cflags' in plan cc_feat_cflags = plan['cc_feat_cflags'] endif + gdb_feat_version = {} + if 'gdb_feat_version' in plan + gdb_feat_version = plan['gdb_feat_version'] + endif + tests = plan['tests'] foreach t : tests @@ -106,8 +117,8 @@ foreach target, plan: tcg_tests # return a clear error if user misspell a setup entry foreach key, _ : setup allowed = ['exe_name', 'env_var', 'expected_output', 'cc_feat', 'cflags', - 'gdb_test', 'plugin_test', 'qemu_args', 'test_name', - 'wrapper'] + 'gdb_feat', 'gdb_test', 'plugin_test', 'qemu_args', + 'test_name', 'wrapper'] if key not in allowed error('unknown tcg setup entry \'' + key + '\' for test ' + src + ' (possible: [' + ', '.join(allowed) + '])') @@ -262,6 +273,18 @@ foreach target, plan: tcg_tests cmd = [setup['env_var'], cmd] endif + if 'gdb_feat' in setup + if 'gdb_test' not in setup + error('test ' + test_name + ' is not a gdb test, but it requires ' + + 'a gdb feature') + endif + gdb_feat = setup['gdb_feat'] + + if not gdb_version.version_compare('>=' + gdb_feat_version[gdb_feat]) + skip_test = 'gdb feature ' + gdb_feat + ' not supported' + endif + endif + if skip_test != '' # still declare test, but skip it and print reason cmd = ['sh', '-c', 'echo "' + skip_test + '" && exit 77'] -- 2.47.3
