Mesa (main): meson: use gtest protocol for gtest based tests when possible
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Oct 16 03:46:06 UTC 2021
Module: Mesa
Branch: main
Commit: e73096bd6d4c1b3ad6609f85140d313e56ae8b99
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e73096bd6d4c1b3ad6609f85140d313e56ae8b99
Author: Dylan Baker <dylan.c.baker at intel.com>
Date: Wed Jan 13 13:10:21 2021 -0800
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 at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8484>
---
meson.build | 7 +++++++
src/compiler/glsl/tests/meson.build | 4 ++++
src/compiler/meson.build | 2 ++
src/compiler/nir/meson.build | 12 ++++++++++++
src/gallium/drivers/etnaviv/meson.build | 1 +
src/gallium/drivers/virgl/tests/meson.build | 1 +
src/gallium/targets/libgl-gdi/meson.build | 1 +
src/gallium/targets/osmesa/meson.build | 3 ++-
src/glx/tests/meson.build | 1 +
src/intel/compiler/meson.build | 1 +
src/intel/isl/meson.build | 1 +
src/mapi/glapi/meson.build | 1 +
src/mapi/shared-glapi/meson.build | 1 +
src/mesa/main/tests/meson.build | 1 +
src/mesa/state_tracker/tests/meson.build | 2 ++
src/microsoft/clc/meson.build | 5 +++--
src/util/meson.build | 8 ++++++--
src/util/tests/cache/meson.build | 2 +-
src/util/tests/fast_idiv_by_const/meson.build | 1 +
src/util/tests/fast_urem_by_const/meson.build | 1 +
src/util/tests/set/meson.build | 1 +
src/util/tests/string_buffer/meson.build | 1 +
src/util/tests/timespec/meson.build | 1 +
src/util/tests/vector/meson.build | 1 +
24 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index 01959d6af49..cd58317494e 100644
--- a/meson.build
+++ b/meson.build
@@ -30,6 +30,13 @@ project(
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')
cpp = meson.get_compiler('cpp')
diff --git a/src/compiler/glsl/tests/meson.build b/src/compiler/glsl/tests/meson.build
index c8a84a81801..4a565bb21c8 100644
--- a/src/compiler/glsl/tests/meson.build
+++ b/src/compiler/glsl/tests/meson.build
@@ -33,6 +33,7 @@ test(
dependencies : [dep_clock, dep_thread, idep_gtest, idep_mesautil],
),
suite : ['compiler', 'glsl'],
+ protocol : gtest_test_protocol,
)
test(
@@ -49,6 +50,7 @@ test(
dependencies : [dep_thread, idep_gtest, idep_mesautil],
),
suite : ['compiler', 'glsl'],
+ protocol : gtest_test_protocol,
)
test(
@@ -63,6 +65,7 @@ test(
dependencies : [dep_thread, idep_gtest, idep_mesautil],
),
suite : ['compiler', 'glsl'],
+ protocol : gtest_test_protocol,
)
test(
@@ -77,6 +80,7 @@ test(
dependencies : [dep_thread, idep_gtest],
),
suite : ['compiler', 'glsl'],
+ protocol : gtest_test_protocol,
)
# Meson can't auto-skip these on cross builds because of the python wrapper
diff --git a/src/compiler/meson.build b/src/compiler/meson.build
index 0f3ec6a8b2a..a2e40959aa3 100644
--- a/src/compiler/meson.build
+++ b/src/compiler/meson.build
@@ -81,6 +81,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'spirv'],
+ protocol : gtest_test_protocol,
)
test(
@@ -94,6 +95,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'spirv'],
+ protocol : gtest_test_protocol,
)
endif
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index 414bb3e9054..dc542b098b7 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -380,6 +380,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
test(
@@ -393,6 +394,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
test(
@@ -406,6 +408,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
test(
@@ -419,6 +422,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
test(
@@ -441,6 +445,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
test(
@@ -454,6 +459,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
test(
@@ -468,6 +474,7 @@ if with_tests
),
suite : ['compiler', 'nir'],
should_fail : meson.get_cross_property('xfail', '').contains('load_store_vectorizer'),
+ protocol : gtest_test_protocol,
)
test(
@@ -481,6 +488,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
test(
@@ -494,6 +502,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
test(
@@ -507,6 +516,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
test(
@@ -520,6 +530,7 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
test(
@@ -533,5 +544,6 @@ if with_tests
dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
),
suite : ['compiler', 'nir'],
+ protocol : gtest_test_protocol,
)
endif
diff --git a/src/gallium/drivers/etnaviv/meson.build b/src/gallium/drivers/etnaviv/meson.build
index f8dcba887f0..a1b58701b31 100644
--- a/src/gallium/drivers/etnaviv/meson.build
+++ b/src/gallium/drivers/etnaviv/meson.build
@@ -145,5 +145,6 @@ if with_tests
dependencies : [idep_gtest, idep_nir],
),
suite : ['compiler', 'etnaviv'],
+ protocol : gtest_test_protocol,
)
endif
diff --git a/src/gallium/drivers/virgl/tests/meson.build b/src/gallium/drivers/virgl/tests/meson.build
index 595e63675a5..d047bdc94e6 100644
--- a/src/gallium/drivers/virgl/tests/meson.build
+++ b/src/gallium/drivers/virgl/tests/meson.build
@@ -28,4 +28,5 @@ test(
link_with : [libvirgl, libgallium],
),
suite : ['virgl'],
+ protocol : gtest_test_protocol,
)
diff --git a/src/gallium/targets/libgl-gdi/meson.build b/src/gallium/targets/libgl-gdi/meson.build
index da7430ca241..25300000221 100644
--- a/src/gallium/targets/libgl-gdi/meson.build
+++ b/src/gallium/targets/libgl-gdi/meson.build
@@ -82,6 +82,7 @@ if with_tests
suite : ['wgl'],
env : wgl_test_env,
depends : [libopengl32],
+ protocol : gtest_test_protocol,
)
endif
endif
diff --git a/src/gallium/targets/osmesa/meson.build b/src/gallium/targets/osmesa/meson.build
index 3a421b58526..497f000ee42 100644
--- a/src/gallium/targets/osmesa/meson.build
+++ b/src/gallium/targets/osmesa/meson.build
@@ -81,6 +81,7 @@ if with_tests
link_with: libosmesa,
dependencies : [idep_gtest],
),
- suite: 'gallium'
+ suite: 'gallium',
+ protocol : gtest_test_protocol,
)
endif
diff --git a/src/glx/tests/meson.build b/src/glx/tests/meson.build
index 0f37543b926..e068fe0c58e 100644
--- a/src/glx/tests/meson.build
+++ b/src/glx/tests/meson.build
@@ -50,5 +50,6 @@ if with_shared_glapi
dependencies : [dep_libdrm, dep_glproto, dep_thread, idep_gtest]
),
suite : ['glx'],
+ protocol : gtest_test_protocol,
)
endif
diff --git a/src/intel/compiler/meson.build b/src/intel/compiler/meson.build
index b4152501358..10c9cff703c 100644
--- a/src/intel/compiler/meson.build
+++ b/src/intel/compiler/meson.build
@@ -183,5 +183,6 @@ if with_tests
dependencies : [idep_gtest, idep_nir, idep_mesautil],
),
suite : ['intel'],
+ protocol : gtest_test_protocol,
)
endif
diff --git a/src/intel/isl/meson.build b/src/intel/isl/meson.build
index 726dc1359b9..b91d8fe4ac1 100644
--- a/src/intel/isl/meson.build
+++ b/src/intel/isl/meson.build
@@ -168,5 +168,6 @@ if with_tests
cpp_args : '-DIN_UNIT_TEST',
),
suite : ['intel'],
+ protocol : gtest_test_protocol,
)
endif
diff --git a/src/mapi/glapi/meson.build b/src/mapi/glapi/meson.build
index 3eb4318dedb..270b9870b40 100644
--- a/src/mapi/glapi/meson.build
+++ b/src/mapi/glapi/meson.build
@@ -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],
),
suite : ['mapi'],
+ protocol : gtest_test_protocol,
)
endif
diff --git a/src/mapi/shared-glapi/meson.build b/src/mapi/shared-glapi/meson.build
index 3776f9e30ab..4a13bace6bc 100644
--- a/src/mapi/shared-glapi/meson.build
+++ b/src/mapi/shared-glapi/meson.build
@@ -74,6 +74,7 @@ if with_any_opengl and with_tests
dependencies : [dep_thread, idep_gtest],
),
suite : ['mapi'],
+ protocol : gtest_test_protocol,
)
if with_symbols_check
test(
diff --git a/src/mesa/main/tests/meson.build b/src/mesa/main/tests/meson.build
index 7e9e843cab4..9ebb92b8d2e 100644
--- a/src/mesa/main/tests/meson.build
+++ b/src/mesa/main/tests/meson.build
@@ -43,4 +43,5 @@ test(
link_with : [libmesa_classic, link_main_test],
),
suite : ['mesa'],
+ protocol : gtest_test_protocol,
)
diff --git a/src/mesa/state_tracker/tests/meson.build b/src/mesa/state_tracker/tests/meson.build
index e62383976e4..c308107d64f 100644
--- a/src/mesa/state_tracker/tests/meson.build
+++ b/src/mesa/state_tracker/tests/meson.build
@@ -51,6 +51,7 @@ test(
dependencies : [idep_mesautil, idep_gtest],
),
suite : ['st_mesa'],
+ protocol : gtest_test_protocol,
)
test(
@@ -65,4 +66,5 @@ test(
dependencies : [idep_mesautil, idep_gtest],
),
suite : ['st_mesa'],
+ protocol : gtest_test_protocol,
)
diff --git a/src/microsoft/clc/meson.build b/src/microsoft/clc/meson.build
index e30bf33d5b7..504a7867dbc 100644
--- a/src/microsoft/clc/meson.build
+++ b/src/microsoft/clc/meson.build
@@ -39,7 +39,8 @@ if dep_dxheaders.found()
link_with : [libclc_compiler],
dependencies : [idep_gtest, idep_mesautil, idep_libdxil_compiler, dep_dxheaders,
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
diff --git a/src/util/meson.build b/src/util/meson.build
index f377b34daa1..e0b5c848d74 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -289,8 +289,9 @@ if with_tests
env: ['HOME=' + join_paths(meson.current_source_dir(),
'tests', 'drirc_home'),
'DRIRC_CONFIGDIR=' + join_paths(meson.current_source_dir(),
- 'tests', 'drirc_configdir')]
- )
+ 'tests', 'drirc_configdir')],
+ protocol : gtest_test_protocol,
+ )
endif
test(
@@ -367,6 +368,7 @@ if with_tests
dependencies : [idep_mesautil, idep_gtest],
),
suite : ['util'],
+ protocol : gtest_test_protocol,
)
endforeach
@@ -403,6 +405,7 @@ if with_tests
dependencies : [idep_mesautil, idep_gtest],
),
suite : ['util'],
+ protocol : gtest_test_protocol,
)
test(
@@ -414,6 +417,7 @@ if with_tests
include_directories : [inc_include, inc_src],
),
suite : ['util'],
+ protocol : gtest_test_protocol,
)
subdir('tests/cache')
diff --git a/src/util/tests/cache/meson.build b/src/util/tests/cache/meson.build
index 3a8fd213e41..2d9a6676cad 100644
--- a/src/util/tests/cache/meson.build
+++ b/src/util/tests/cache/meson.build
@@ -27,7 +27,7 @@ if with_shader_cache
c_args : [c_msvc_compat_args, no_override_init_args],
gnu_symbol_visibility : 'hidden',
include_directories : [inc_include, inc_src],
- dependencies : [dep_clock, dep_thread, idep_gtest, idep_mesautil],
+ dependencies : [dep_clock, dep_thread, idep_mesautil],
),
suite : ['util'],
)
diff --git a/src/util/tests/fast_idiv_by_const/meson.build b/src/util/tests/fast_idiv_by_const/meson.build
index 9c8c03d974e..c4be8067da1 100644
--- a/src/util/tests/fast_idiv_by_const/meson.build
+++ b/src/util/tests/fast_idiv_by_const/meson.build
@@ -28,4 +28,5 @@ test(
),
suite : ['util'],
timeout: 60,
+ protocol : gtest_test_protocol,
)
diff --git a/src/util/tests/fast_urem_by_const/meson.build b/src/util/tests/fast_urem_by_const/meson.build
index 07930974551..62795d2a682 100644
--- a/src/util/tests/fast_urem_by_const/meson.build
+++ b/src/util/tests/fast_urem_by_const/meson.build
@@ -28,4 +28,5 @@ test(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
),
suite : ['util'],
+ protocol : gtest_test_protocol,
)
diff --git a/src/util/tests/set/meson.build b/src/util/tests/set/meson.build
index e9b00629b44..ecedddc98db 100644
--- a/src/util/tests/set/meson.build
+++ b/src/util/tests/set/meson.build
@@ -27,4 +27,5 @@ test(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
),
suite : ['util'],
+ protocol : gtest_test_protocol,
)
diff --git a/src/util/tests/string_buffer/meson.build b/src/util/tests/string_buffer/meson.build
index acb6abca475..c3873ddc64c 100644
--- a/src/util/tests/string_buffer/meson.build
+++ b/src/util/tests/string_buffer/meson.build
@@ -28,4 +28,5 @@ test(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
),
suite : ['util'],
+ protocol : gtest_test_protocol,
)
diff --git a/src/util/tests/timespec/meson.build b/src/util/tests/timespec/meson.build
index 2fc737a7db4..5e4b41d14a9 100644
--- a/src/util/tests/timespec/meson.build
+++ b/src/util/tests/timespec/meson.build
@@ -27,4 +27,5 @@ test(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
),
suite : ['util'],
+ protocol : gtest_test_protocol,
)
diff --git a/src/util/tests/vector/meson.build b/src/util/tests/vector/meson.build
index 40ad93995a4..2624e20ca55 100644
--- a/src/util/tests/vector/meson.build
+++ b/src/util/tests/vector/meson.build
@@ -27,4 +27,5 @@ test(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
),
suite : ['util'],
+ protocol : gtest_test_protocol,
)
More information about the mesa-commit
mailing list