[Mesa-dev] [PATCH] meson: Add tests to suites

Dylan Baker dylan at pnwbakers.com
Mon Nov 19 21:49:15 UTC 2018


Meson test has a concepts of suites, which allow tests to be grouped
together. This allows for a subtest of tests to be run only (say only
the tests for nir). A test can be added to more than one suite, but for
the most part I've only added a test to a single suite, though I've
added a compiler group that includes nir, glsl, and glcpp tests.

To use this you'll need to invoke meson test directly, instead of ninja
test (which always runs all targets). it can be invoked as:
`meson test -C builddir --suite $suitename` (meson test has addition
options that are pretty useful).
---
 src/broadcom/qpu/meson.build                  |  3 ++-
 src/compiler/glsl/glcpp/meson.build           |  1 +
 src/compiler/glsl/tests/meson.build           | 18 +++++++++++++-----
 src/compiler/nir/meson.build                  |  7 +++++--
 src/egl/meson.build                           |  6 ++++--
 src/gallium/drivers/llvmpipe/meson.build      |  3 ++-
 src/gallium/drivers/r300/meson.build          |  3 ++-
 src/gbm/meson.build                           |  3 ++-
 src/glx/tests/meson.build                     |  3 ++-
 src/intel/compiler/meson.build                |  3 ++-
 src/intel/isl/meson.build                     |  3 ++-
 src/intel/vulkan/meson.build                  |  3 ++-
 src/mapi/es1api/meson.build                   |  3 ++-
 src/mapi/es2api/meson.build                   |  3 ++-
 src/mapi/glapi/meson.build                    |  3 ++-
 src/mapi/shared-glapi/meson.build             |  3 ++-
 src/mesa/main/tests/meson.build               |  3 ++-
 src/mesa/state_tracker/tests/meson.build      |  8 +++++---
 src/util/meson.build                          |  9 ++++++---
 src/util/tests/fast_idiv_by_const/meson.build |  3 ++-
 src/util/tests/hash_table/meson.build         |  3 ++-
 src/util/tests/set/meson.build                |  3 ++-
 src/util/tests/string_buffer/meson.build      |  3 ++-
 src/util/tests/vma/meson.build                |  3 ++-
 24 files changed, 70 insertions(+), 33 deletions(-)

diff --git a/src/broadcom/qpu/meson.build b/src/broadcom/qpu/meson.build
index 8a40016064d..279b09cb95a 100644
--- a/src/broadcom/qpu/meson.build
+++ b/src/broadcom/qpu/meson.build
@@ -41,5 +41,6 @@ test(
     'qpu_disasm', 'tests/qpu_disasm.c',
     link_with: [libbroadcom_qpu, libmesa_util],
     include_directories: inc_common
-  )
+  ),
+  suite : ['broadcom'],
 )
diff --git a/src/compiler/glsl/glcpp/meson.build b/src/compiler/glsl/glcpp/meson.build
index a03d589b370..677baf1df10 100644
--- a/src/compiler/glsl/glcpp/meson.build
+++ b/src/compiler/glsl/glcpp/meson.build
@@ -70,6 +70,7 @@ if with_any_opengl and with_tests
         glcpp, join_paths(meson.current_source_dir(), 'tests'),
         '-- at 0@'.format(m),
       ],
+      suite : ['compiler', 'glcpp'],
     )
   endforeach
 endif
diff --git a/src/compiler/glsl/tests/meson.build b/src/compiler/glsl/tests/meson.build
index 2a41e30a28d..02f3355c43c 100644
--- a/src/compiler/glsl/tests/meson.build
+++ b/src/compiler/glsl/tests/meson.build
@@ -26,7 +26,8 @@ test(
     c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
     include_directories : [inc_common, inc_compiler],
     link_with : [libglsl],
-  )
+  ),
+  suite : ['compiler', 'glsl'],
 )
 
 test(
@@ -38,7 +39,8 @@ test(
     include_directories : [inc_common, inc_glsl],
     link_with : [libglsl],
     dependencies : [dep_clock, dep_thread],
-  )
+  ),
+  suite : ['compiler', 'glsl'],
 )
 
 
@@ -54,7 +56,8 @@ test(
     include_directories : [inc_common, inc_glsl],
     link_with : [libglsl, libglsl_standalone, libglsl_util],
     dependencies : [dep_clock, dep_thread, idep_gtest],
-  )
+  ),
+  suite : ['compiler', 'glsl'],
 )
 
 test(
@@ -68,7 +71,8 @@ test(
     include_directories : [inc_common, inc_glsl],
     link_with : [libglsl, libglsl_util],
     dependencies : [dep_thread, idep_gtest],
-  )
+  ),
+  suite : ['compiler', 'glsl'],
 )
 
 test(
@@ -80,7 +84,8 @@ test(
     include_directories : [inc_common, inc_glsl],
     link_with : [libglsl, libglsl_util],
     dependencies : [dep_thread, idep_gtest],
-  )
+  ),
+  suite : ['compiler', 'glsl'],
 )
 
 test(
@@ -93,7 +98,9 @@ test(
       meson.source_root(), 'src', 'compiler', 'glsl', 'tests', 'warnings'
     ),
   ],
+  suite : ['compiler', 'glsl'],
 )
+
 test(
   'glsl optimization',
   prog_python,
@@ -101,4 +108,5 @@ test(
     join_paths(meson.current_source_dir(), 'optimization_test.py'),
     '--test-runner', glsl_test
   ],
+  suite : ['compiler', 'glsl'],
 )
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index b0c3a7feb31..61f61f0a34b 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -246,8 +246,10 @@ if with_tests
       include_directories : [inc_common],
       dependencies : [dep_thread, idep_gtest, idep_nir],
       link_with : libmesa_util,
-    )
+    ), 
+    suite : ['compiler', 'nir'],
   )
+
   test(
     'nir_vars',
     executable(
@@ -257,6 +259,7 @@ if with_tests
       include_directories : [inc_common],
       dependencies : [dep_thread, idep_gtest, idep_nir],
       link_with : libmesa_util,
-    )
+    ),
+    suite : ['compiler', 'nir'],
   )
 endif
diff --git a/src/egl/meson.build b/src/egl/meson.build
index 372842967d3..89bac2cd633 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -200,11 +200,13 @@ if with_tests
     test('egl-symbols-check',
       find_program('egl-symbols-check'),
       env : env_test,
-      args : libegl
+      args : libegl,
+      suite : ['egl'],
     )
   endif
   test('egl-entrypoint-check',
     find_program('egl-entrypoint-check'),
-    env : [ 'srcdir=' + meson.current_source_dir() ]
+    env : ['srcdir=' + meson.current_source_dir()],
+    suite : ['egl'],
   )
 endif
diff --git a/src/gallium/drivers/llvmpipe/meson.build b/src/gallium/drivers/llvmpipe/meson.build
index 0b0ac2a3a02..51562b10dc7 100644
--- a/src/gallium/drivers/llvmpipe/meson.build
+++ b/src/gallium/drivers/llvmpipe/meson.build
@@ -119,7 +119,8 @@ if with_tests and with_gallium_softpipe and with_llvm
         dependencies : [dep_llvm, dep_dl, dep_thread, dep_clock],
         include_directories : [inc_gallium, inc_gallium_aux, inc_include, inc_src],
         link_with : [libllvmpipe, libgallium, libmesa_util],
-      )
+      ),
+      suite : ['llvmpipe'],
     )
   endforeach
 endif
diff --git a/src/gallium/drivers/r300/meson.build b/src/gallium/drivers/r300/meson.build
index d181048c51d..f46aedffdfe 100644
--- a/src/gallium/drivers/r300/meson.build
+++ b/src/gallium/drivers/r300/meson.build
@@ -158,6 +158,7 @@ if with_tests
       ],
       link_with : [libr300, libgallium, libmesa_util],
       dependencies : [dep_m, dep_clock, dep_dl, dep_thread, dep_unwind],
-    )
+    ),
+    suite : ['r300'],
   )
 endif
diff --git a/src/gbm/meson.build b/src/gbm/meson.build
index 007f50a9ae3..b2ad6673592 100644
--- a/src/gbm/meson.build
+++ b/src/gbm/meson.build
@@ -71,6 +71,7 @@ if with_tests
     'gbm-symbols-check',
     find_program('gbm-symbols-check'),
     env : env_test,
-    args : libgbm
+    args : libgbm,
+    suite : ['gbm'],
   )
 endif
diff --git a/src/glx/tests/meson.build b/src/glx/tests/meson.build
index fd9d4d433b2..fa3ca9db8cd 100644
--- a/src/glx/tests/meson.build
+++ b/src/glx/tests/meson.build
@@ -44,6 +44,7 @@ if with_shared_glapi
         include_directories('..'),
       ],
       dependencies : [dep_libdrm, dep_thread, idep_gtest]
-    )
+    ),
+    suite : ['glx'],
   )
 endif
diff --git a/src/intel/compiler/meson.build b/src/intel/compiler/meson.build
index 953e8dcc971..2124278cc04 100644
--- a/src/intel/compiler/meson.build
+++ b/src/intel/compiler/meson.build
@@ -157,7 +157,8 @@ if with_tests
           libintel_compiler, libintel_common, libintel_dev, libmesa_util, libisl,
         ],
         dependencies : [dep_thread, dep_dl, idep_gtest, idep_nir],
-      )
+      ),
+      suite : ['intel'],
     )
   endforeach
 endif
diff --git a/src/intel/isl/meson.build b/src/intel/isl/meson.build
index 62cde190e6e..a6374f6c4f3 100644
--- a/src/intel/isl/meson.build
+++ b/src/intel/isl/meson.build
@@ -96,6 +96,7 @@ if with_tests
       dependencies : dep_m,
       include_directories : [inc_common, inc_intel],
       link_with : [libisl, libintel_dev, libmesa_util],
-    )
+    ),
+    suite : ['intel'],
   )
 endif
diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build
index b9834867407..e30e9225289 100644
--- a/src/intel/vulkan/meson.build
+++ b/src/intel/vulkan/meson.build
@@ -238,7 +238,8 @@ if with_tests
         include_directories : [
           inc_common, inc_intel, inc_compiler, inc_vulkan_util, inc_vulkan_wsi,
         ],
-      )
+      ),
+      suite : ['intel'],
     )
   endforeach
 endif
diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
index d8a77a41df2..53e894f091c 100644
--- a/src/mapi/es1api/meson.build
+++ b/src/mapi/es1api/meson.build
@@ -56,6 +56,7 @@ if with_tests
     'es1-ABI-check',
     find_program('ABI-check'),
     env : env_test,
-    args : libglesv1_cm
+    args : libglesv1_cm,
+    suite : ['mapi'],
   )
 endif
diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build
index 891e6f7b27b..1f397e2b752 100644
--- a/src/mapi/es2api/meson.build
+++ b/src/mapi/es2api/meson.build
@@ -56,6 +56,7 @@ if with_tests
     'es2-ABI-check',
     find_program('ABI-check'),
     env : env_test,
-    args : libgles2
+    args : libgles2,
+    suite : ['mapi'],
   )
 endif
diff --git a/src/mapi/glapi/meson.build b/src/mapi/glapi/meson.build
index 048bee8a1ad..7e8bc38a817 100644
--- a/src/mapi/glapi/meson.build
+++ b/src/mapi/glapi/meson.build
@@ -87,6 +87,7 @@ if with_any_opengl and not with_shared_glapi and with_tests
       include_directories : [inc_include, inc_src, inc_mesa, inc_mapi],
       link_with : [libglapi_static],
       dependencies : [idep_gtest, dep_thread],
-    )
+    ),
+    suite : ['mapi'],
   )
 endif
diff --git a/src/mapi/shared-glapi/meson.build b/src/mapi/shared-glapi/meson.build
index dcc6079af3d..41da9b1c1c5 100644
--- a/src/mapi/shared-glapi/meson.build
+++ b/src/mapi/shared-glapi/meson.build
@@ -60,6 +60,7 @@ if with_any_opengl and with_tests
       include_directories : [inc_src, inc_include, inc_mapi],
       link_with : [libglapi],
       dependencies : [dep_thread, idep_gtest],
-    )
+    ),
+    suite : ['mapi'],
   )
 endif
diff --git a/src/mesa/main/tests/meson.build b/src/mesa/main/tests/meson.build
index d1bd81a5604..4b39325154e 100644
--- a/src/mesa/main/tests/meson.build
+++ b/src/mesa/main/tests/meson.build
@@ -41,5 +41,6 @@ test(
     include_directories : [inc_include, inc_src, inc_mapi, inc_mesa],
     dependencies : [idep_gtest, dep_clock, dep_dl, dep_thread],
     link_with : [libmesa_classic, link_main_test],
-  )
+  ),
+  suite : ['mesa'],
 )
diff --git a/src/mesa/state_tracker/tests/meson.build b/src/mesa/state_tracker/tests/meson.build
index 5c472104d85..892362b22ff 100644
--- a/src/mesa/state_tracker/tests/meson.build
+++ b/src/mesa/state_tracker/tests/meson.build
@@ -35,8 +35,9 @@ test(
       libmesa_st_test_common, libmesa_gallium, libglapi, libgallium,
       libmesa_util,
     ],
-    dependencies : [idep_gtest, dep_thread]
-  )
+    dependencies : [idep_gtest, dep_thread],
+  ),
+  suite : ['st_mesa'],
 )
 
 test(
@@ -50,5 +51,6 @@ test(
       libmesa_util,
     ],
     dependencies : [idep_gtest, dep_thread]
-  )
+  ),
+  suite : ['st_mesa'],
 )
diff --git a/src/util/meson.build b/src/util/meson.build
index 156621aff65..397c2228129 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -151,7 +151,8 @@ if with_tests
       include_directories : inc_common,
       link_with : libmesa_util,
       c_args : [c_msvc_compat_args],
-    )
+    ),
+    suite : ['util'],
   )
 
   test(
@@ -162,7 +163,8 @@ if with_tests
       include_directories : inc_common,
       c_args : [c_msvc_compat_args],
       dependencies : [dep_m],
-    )
+    ),
+    suite : ['util'],
   )
 
   test(
@@ -173,7 +175,8 @@ if with_tests
       include_directories : inc_common,
       link_with : libmesa_util,
       c_args : [c_msvc_compat_args],
-    )
+    ),
+    suite : ['util'],
   )
 
   subdir('tests/fast_idiv_by_const')
diff --git a/src/util/tests/fast_idiv_by_const/meson.build b/src/util/tests/fast_idiv_by_const/meson.build
index 8c3b79493ff..90ac7d15972 100644
--- a/src/util/tests/fast_idiv_by_const/meson.build
+++ b/src/util/tests/fast_idiv_by_const/meson.build
@@ -26,5 +26,6 @@ test(
     dependencies : [dep_thread, dep_dl, idep_gtest],
     include_directories : inc_common,
     link_with : [libmesa_util],
-  )
+  ),
+  suite : ['util'],
 )
diff --git a/src/util/tests/hash_table/meson.build b/src/util/tests/hash_table/meson.build
index c7b03f19c56..d4de448aea5 100644
--- a/src/util/tests/hash_table/meson.build
+++ b/src/util/tests/hash_table/meson.build
@@ -30,6 +30,7 @@ foreach t : ['clear', 'collision', 'delete_and_lookup', 'delete_management',
       dependencies : [dep_thread, dep_dl],
       include_directories : [inc_include, inc_util],
       link_with : libmesa_util,
-    )
+    ),
+    suite : ['util'],
   )
 endforeach
diff --git a/src/util/tests/set/meson.build b/src/util/tests/set/meson.build
index add3fc56020..5ab180c11eb 100644
--- a/src/util/tests/set/meson.build
+++ b/src/util/tests/set/meson.build
@@ -26,5 +26,6 @@ test(
     dependencies : [dep_thread, dep_dl, idep_gtest],
     include_directories : inc_common,
     link_with : [libmesa_util],
-  )
+  ),
+  suite : ['util'],
 )
diff --git a/src/util/tests/string_buffer/meson.build b/src/util/tests/string_buffer/meson.build
index 9f42e3550ae..f4e1a8e24e6 100644
--- a/src/util/tests/string_buffer/meson.build
+++ b/src/util/tests/string_buffer/meson.build
@@ -26,5 +26,6 @@ test(
     dependencies : [dep_thread, dep_dl, idep_gtest],
     include_directories : inc_common,
     link_with : [libmesa_util],
-  )
+  ),
+  suite : ['util'],
 )
diff --git a/src/util/tests/vma/meson.build b/src/util/tests/vma/meson.build
index 53562db312b..22137eb671e 100644
--- a/src/util/tests/vma/meson.build
+++ b/src/util/tests/vma/meson.build
@@ -25,5 +25,6 @@ test(
     'vma_random_test.cpp',
     include_directories : [inc_include, inc_util],
     link_with : [libmesa_util],
-  )
+  ),
+  suite : ['util'],
 )
-- 
2.19.1



More information about the mesa-dev mailing list