Now we moved back flags to tests/tcg/meson.build, we don't need to expose cc anymore in target files. This will allow us to easily introduce cross containers. Also, we can reuse the skip_test logic to gracefully report why tests don't run.
Reviewed-by: Manos Pitsidianakis <[email protected]> Signed-off-by: Pierrick Bouvier <[email protected]> --- tests/tcg/meson.build | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build index c227bb52381..9c00d21f059 100644 --- a/tests/tcg/meson.build +++ b/tests/tcg/meson.build @@ -19,7 +19,7 @@ tcg_tests = {} # # { # 'name_of_target': { -# 'cc': cross_compiler, +# 'cc': 'cross_compiler', # 'cc_feat_cflags': { # 'name': ['feature cflags'], # ... @@ -96,7 +96,7 @@ foreach target, plan: tcg_tests endif endforeach - cc = plan['cc'] + cc = find_program(plan['cc'], required : false) folder = plan['folder'] gdb_arch = plan['gdb_arch'] qemu = plan['qemu'] @@ -189,9 +189,13 @@ foreach target, plan: tcg_tests if 'cc_feat' in setup cc_feat = setup['cc_feat'] if cc_feat not in cc_has_feat - cmd = run_command([cc, cc_check_args, cc_feat_cflags[cc_feat]], - check: false) - avail = cmd.returncode() == 0 + avail = false + if cc.found() + cmd = run_command([cc, '-xc', '/dev/null', '-o', '/dev/null', '-c', + cc_feat_cflags[cc_feat]], + check: false) + avail = cmd.returncode() == 0 + endif cc_has_feat += {cc_feat: avail} endif @@ -202,6 +206,11 @@ foreach target, plan: tcg_tests cflags += cc_feat_cflags[cc_feat] endif + if not cc.found() + skip_test = 'compiler ' + plan['cc'] + ' not available' + built_tests += {exe_name: exe_name} + endif + # build executable if needed if exe_name not in built_tests exe = custom_target(exe_name, -- 2.47.3
