meson: use gtest protocol for gtest based tests when possible

With the `gtest` protocol meson will add some extra arguments to the
test to generate better junit results, which may be useful. This
protocol is only available in meson 0.55.0+, so keep using the default
`exitcode` protocol for meson older than that.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8484>
This commit is contained in:
Dylan Baker
2021-01-13 13:10:21 -08:00
committed by Marge Bot
parent aac47c4b24
commit e73096bd6d
24 changed files with 54 additions and 6 deletions

View File

@@ -30,6 +30,13 @@ project(
default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c11', 'cpp_std=c++14'] default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c11', 'cpp_std=c++14']
) )
# For meson >= 0.55.0, meson can inject some extra arguments to get richer
# results from gtest based tests.
gtest_test_protocol = 'exitcode'
if meson.version().version_compare('>= 0.55.0')
gtest_test_protocol = 'gtest'
endif
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp') cpp = meson.get_compiler('cpp')

View File

@@ -33,6 +33,7 @@ test(
dependencies : [dep_clock, dep_thread, idep_gtest, idep_mesautil], dependencies : [dep_clock, dep_thread, idep_gtest, idep_mesautil],
), ),
suite : ['compiler', 'glsl'], suite : ['compiler', 'glsl'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -49,6 +50,7 @@ test(
dependencies : [dep_thread, idep_gtest, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_mesautil],
), ),
suite : ['compiler', 'glsl'], suite : ['compiler', 'glsl'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -63,6 +65,7 @@ test(
dependencies : [dep_thread, idep_gtest, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_mesautil],
), ),
suite : ['compiler', 'glsl'], suite : ['compiler', 'glsl'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -77,6 +80,7 @@ test(
dependencies : [dep_thread, idep_gtest], dependencies : [dep_thread, idep_gtest],
), ),
suite : ['compiler', 'glsl'], suite : ['compiler', 'glsl'],
protocol : gtest_test_protocol,
) )
# Meson can't auto-skip these on cross builds because of the python wrapper # Meson can't auto-skip these on cross builds because of the python wrapper

View File

@@ -81,6 +81,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'spirv'], suite : ['compiler', 'spirv'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -94,6 +95,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'spirv'], suite : ['compiler', 'spirv'],
protocol : gtest_test_protocol,
) )
endif endif

View File

@@ -380,6 +380,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -393,6 +394,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -406,6 +408,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -419,6 +422,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -441,6 +445,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -454,6 +459,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -468,6 +474,7 @@ if with_tests
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
should_fail : meson.get_cross_property('xfail', '').contains('load_store_vectorizer'), should_fail : meson.get_cross_property('xfail', '').contains('load_store_vectorizer'),
protocol : gtest_test_protocol,
) )
test( test(
@@ -481,6 +488,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -494,6 +502,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -507,6 +516,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -520,6 +530,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -533,5 +544,6 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil], dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['compiler', 'nir'], suite : ['compiler', 'nir'],
protocol : gtest_test_protocol,
) )
endif endif

View File

@@ -145,5 +145,6 @@ if with_tests
dependencies : [idep_gtest, idep_nir], dependencies : [idep_gtest, idep_nir],
), ),
suite : ['compiler', 'etnaviv'], suite : ['compiler', 'etnaviv'],
protocol : gtest_test_protocol,
) )
endif endif

View File

@@ -28,4 +28,5 @@ test(
link_with : [libvirgl, libgallium], link_with : [libvirgl, libgallium],
), ),
suite : ['virgl'], suite : ['virgl'],
protocol : gtest_test_protocol,
) )

View File

@@ -82,6 +82,7 @@ if with_tests
suite : ['wgl'], suite : ['wgl'],
env : wgl_test_env, env : wgl_test_env,
depends : [libopengl32], depends : [libopengl32],
protocol : gtest_test_protocol,
) )
endif endif
endif endif

View File

@@ -81,6 +81,7 @@ if with_tests
link_with: libosmesa, link_with: libosmesa,
dependencies : [idep_gtest], dependencies : [idep_gtest],
), ),
suite: 'gallium' suite: 'gallium',
protocol : gtest_test_protocol,
) )
endif endif

View File

@@ -50,5 +50,6 @@ if with_shared_glapi
dependencies : [dep_libdrm, dep_glproto, dep_thread, idep_gtest] dependencies : [dep_libdrm, dep_glproto, dep_thread, idep_gtest]
), ),
suite : ['glx'], suite : ['glx'],
protocol : gtest_test_protocol,
) )
endif endif

View File

@@ -183,5 +183,6 @@ if with_tests
dependencies : [idep_gtest, idep_nir, idep_mesautil], dependencies : [idep_gtest, idep_nir, idep_mesautil],
), ),
suite : ['intel'], suite : ['intel'],
protocol : gtest_test_protocol,
) )
endif endif

View File

@@ -168,5 +168,6 @@ if with_tests
cpp_args : '-DIN_UNIT_TEST', cpp_args : '-DIN_UNIT_TEST',
), ),
suite : ['intel'], suite : ['intel'],
protocol : gtest_test_protocol,
) )
endif endif

View File

@@ -98,5 +98,6 @@ if with_any_opengl and not with_shared_glapi and with_tests and not with_platfor
dependencies : [idep_gtest, dep_thread], dependencies : [idep_gtest, dep_thread],
), ),
suite : ['mapi'], suite : ['mapi'],
protocol : gtest_test_protocol,
) )
endif endif

View File

@@ -74,6 +74,7 @@ if with_any_opengl and with_tests
dependencies : [dep_thread, idep_gtest], dependencies : [dep_thread, idep_gtest],
), ),
suite : ['mapi'], suite : ['mapi'],
protocol : gtest_test_protocol,
) )
if with_symbols_check if with_symbols_check
test( test(

View File

@@ -43,4 +43,5 @@ test(
link_with : [libmesa_classic, link_main_test], link_with : [libmesa_classic, link_main_test],
), ),
suite : ['mesa'], suite : ['mesa'],
protocol : gtest_test_protocol,
) )

View File

@@ -51,6 +51,7 @@ test(
dependencies : [idep_mesautil, idep_gtest], dependencies : [idep_mesautil, idep_gtest],
), ),
suite : ['st_mesa'], suite : ['st_mesa'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -65,4 +66,5 @@ test(
dependencies : [idep_mesautil, idep_gtest], dependencies : [idep_mesautil, idep_gtest],
), ),
suite : ['st_mesa'], suite : ['st_mesa'],
protocol : gtest_test_protocol,
) )

View File

@@ -39,7 +39,8 @@ if dep_dxheaders.found()
link_with : [libclc_compiler], link_with : [libclc_compiler],
dependencies : [idep_gtest, idep_mesautil, idep_libdxil_compiler, dep_dxheaders, dependencies : [idep_gtest, idep_mesautil, idep_libdxil_compiler, dep_dxheaders,
dep_spirv_tools], dep_spirv_tools],
include_directories : [inc_include, inc_src, inc_compiler, inc_spirv]) include_directories : [inc_include, inc_src, inc_compiler, inc_spirv],
)
test('clc_compiler_test', clc_compiler_test, timeout: 180) test('clc_compiler_test', clc_compiler_test, timeout: 180, protocol : gtest_test_protocol)
endif endif

View File

@@ -289,8 +289,9 @@ if with_tests
env: ['HOME=' + join_paths(meson.current_source_dir(), env: ['HOME=' + join_paths(meson.current_source_dir(),
'tests', 'drirc_home'), 'tests', 'drirc_home'),
'DRIRC_CONFIGDIR=' + join_paths(meson.current_source_dir(), 'DRIRC_CONFIGDIR=' + join_paths(meson.current_source_dir(),
'tests', 'drirc_configdir')] 'tests', 'drirc_configdir')],
) protocol : gtest_test_protocol,
)
endif endif
test( test(
@@ -367,6 +368,7 @@ if with_tests
dependencies : [idep_mesautil, idep_gtest], dependencies : [idep_mesautil, idep_gtest],
), ),
suite : ['util'], suite : ['util'],
protocol : gtest_test_protocol,
) )
endforeach endforeach
@@ -403,6 +405,7 @@ if with_tests
dependencies : [idep_mesautil, idep_gtest], dependencies : [idep_mesautil, idep_gtest],
), ),
suite : ['util'], suite : ['util'],
protocol : gtest_test_protocol,
) )
test( test(
@@ -414,6 +417,7 @@ if with_tests
include_directories : [inc_include, inc_src], include_directories : [inc_include, inc_src],
), ),
suite : ['util'], suite : ['util'],
protocol : gtest_test_protocol,
) )
subdir('tests/cache') subdir('tests/cache')

View File

@@ -27,7 +27,7 @@ if with_shader_cache
c_args : [c_msvc_compat_args, no_override_init_args], c_args : [c_msvc_compat_args, no_override_init_args],
gnu_symbol_visibility : 'hidden', gnu_symbol_visibility : 'hidden',
include_directories : [inc_include, inc_src], include_directories : [inc_include, inc_src],
dependencies : [dep_clock, dep_thread, idep_gtest, idep_mesautil], dependencies : [dep_clock, dep_thread, idep_mesautil],
), ),
suite : ['util'], suite : ['util'],
) )

View File

@@ -28,4 +28,5 @@ test(
), ),
suite : ['util'], suite : ['util'],
timeout: 60, timeout: 60,
protocol : gtest_test_protocol,
) )

View File

@@ -28,4 +28,5 @@ test(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
), ),
suite : ['util'], suite : ['util'],
protocol : gtest_test_protocol,
) )

View File

@@ -27,4 +27,5 @@ test(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
), ),
suite : ['util'], suite : ['util'],
protocol : gtest_test_protocol,
) )

View File

@@ -28,4 +28,5 @@ test(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
), ),
suite : ['util'], suite : ['util'],
protocol : gtest_test_protocol,
) )

View File

@@ -27,4 +27,5 @@ test(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
), ),
suite : ['util'], suite : ['util'],
protocol : gtest_test_protocol,
) )

View File

@@ -27,4 +27,5 @@ test(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
), ),
suite : ['util'], suite : ['util'],
protocol : gtest_test_protocol,
) )