Mesa (main): util: Consolidate existing gtests in a single binary

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 21 05:16:18 UTC 2021


Module: Mesa
Branch: main
Commit: 2209f5794d23d832924d8870cc1db5c16c3cc094
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2209f5794d23d832924d8870cc1db5c16c3cc094

Author: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Date:   Mon Oct 18 13:16:29 2021 -0700

util: Consolidate existing gtests in a single binary

Acked-by: Emma Anholt <emma at anholt.net>
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
Acked-by: Matt Turner <mattst88 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13425>

---

 src/util/meson.build                          | 82 ++++++++++++---------------
 src/util/tests/fast_idiv_by_const/meson.build | 32 -----------
 src/util/tests/fast_urem_by_const/meson.build | 32 -----------
 src/util/tests/set/meson.build                | 31 ----------
 src/util/tests/string_buffer/meson.build      | 32 -----------
 src/util/tests/timespec/meson.build           | 31 ----------
 src/util/tests/vector/meson.build             | 31 ----------
 7 files changed, 37 insertions(+), 234 deletions(-)

diff --git a/src/util/meson.build b/src/util/meson.build
index e0b5c848d74..8e1ffbaf3a9 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -358,19 +358,44 @@ if with_tests
     )
   endif
 
-  foreach t: ['bitset', 'register_allocate', 'u_debug_stack', 'u_qsort']
-    test(
-      t,
-      executable(
-        t + '_test',
-        files(t + '_test.cpp'),
-        include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
-        dependencies : [idep_mesautil, idep_gtest],
-      ),
-      suite : ['util'],
-      protocol : gtest_test_protocol,
+  files_util_tests = files(
+    'bitset_test.cpp',
+    'register_allocate_test.cpp',
+    'tests/dag_test.cpp',
+    'tests/fast_idiv_by_const/fast_idiv_by_const_test.cpp',
+    'tests/fast_urem_by_const/fast_urem_by_const_test.cpp',
+    'tests/int_min_max.cpp',
+    'tests/set/set_test.cpp',
+    'tests/vector/vector_test.cpp',
+    'u_debug_stack_test.cpp',
+    'u_qsort_test.cpp',
+  )
+
+  if not (host_machine.system() == 'windows' and cc.get_id() == 'gcc')
+    # FIXME: These tests fail with mingw, but not with msvc.
+    files_util_tests += files(
+      'tests/string_buffer/string_buffer_test.cpp',
+    )
+  endif
+
+  if cc.has_header('sys/time.h')  # MinGW has this, but Vanilla windows doesn't
+    files_util_tests += files(
+      'tests/timespec/timespec_test.cpp'
     )
-  endforeach
+  endif
+
+  test(
+    'util_tests',
+    executable(
+      'util_tests',
+      files_util_tests,
+      include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
+      dependencies : [idep_mesautil, idep_gtest],
+    ),
+    suite : ['util'],
+    protocol : gtest_test_protocol,
+    timeout : 180,
+  )
 
   process_test_exe = executable(
     'process_test',
@@ -398,42 +423,9 @@ if with_tests
     env: ['BUILD_FULL_PATH='+process_test_exe_full_path]
   )
 
-  test('int_min_max',
-    executable('int_min_max_test',
-    files('tests/int_min_max.cpp'),
-      include_directories : [inc_include, inc_src],
-      dependencies : [idep_mesautil, idep_gtest],
-    ),
-    suite : ['util'],
-    protocol : gtest_test_protocol,
-  )
-
-  test(
-    'dag',
-    executable(
-      'dag_test',
-      'tests/dag_test.cpp',
-      dependencies : [idep_mesautil, idep_gtest],
-      include_directories : [inc_include, inc_src],
-    ),
-    suite : ['util'],
-    protocol : gtest_test_protocol,
-  )
-
   subdir('tests/cache')
-  subdir('tests/fast_idiv_by_const')
-  subdir('tests/fast_urem_by_const')
   subdir('tests/hash_table')
-  if not (host_machine.system() == 'windows' and cc.get_id() == 'gcc')
-    # FIXME: These tests fail with mingw, but not with msvc.
-    subdir('tests/string_buffer')
-  endif
-  if cc.has_header('sys/time.h')  # MinGW has this, but Vanilla windows doesn't
-    subdir('tests/timespec')
-  endif
   subdir('tests/vma')
-  subdir('tests/set')
   subdir('tests/sparse_array')
   subdir('tests/format')
-  subdir('tests/vector')
 endif
diff --git a/src/util/tests/fast_idiv_by_const/meson.build b/src/util/tests/fast_idiv_by_const/meson.build
deleted file mode 100644
index c4be8067da1..00000000000
--- a/src/util/tests/fast_idiv_by_const/meson.build
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright © 2018 Intel Corporation
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-test(
-  'fast_idiv_by_const',
-  executable(
-    'fast_idiv_by_const_test',
-    'fast_idiv_by_const_test.cpp',
-    dependencies : [idep_gtest, idep_mesautil],
-    include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
-  ),
-  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
deleted file mode 100644
index 62795d2a682..00000000000
--- a/src/util/tests/fast_urem_by_const/meson.build
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright © 2018 Intel Corporation
-# Copyright © 2010 Valve Corporation
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-test(
-  'fast_urem_by_const',
-  executable(
-    'fast_urem_by_const_test',
-    'fast_urem_by_const_test.cpp',
-    dependencies : [idep_gtest, idep_mesautil],
-    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
deleted file mode 100644
index ecedddc98db..00000000000
--- a/src/util/tests/set/meson.build
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright © 2018 Intel Corporation
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-test(
-  'set',
-  executable(
-    'set_test',
-    'set_test.cpp',
-    dependencies : [dep_thread, dep_dl, idep_gtest, idep_mesautil],
-    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
deleted file mode 100644
index c3873ddc64c..00000000000
--- a/src/util/tests/string_buffer/meson.build
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright © 2017 Intel Corporation
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-test(
-  'string_buffer',
-  executable(
-    'string_buffer_test',
-    'string_buffer_test.cpp',
-    cpp_args : [cpp_msvc_compat_args],
-    dependencies : [idep_gtest, idep_mesautil],
-    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
deleted file mode 100644
index 5e4b41d14a9..00000000000
--- a/src/util/tests/timespec/meson.build
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright © 2019 Intel Corporation
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-test(
-  'timespec',
-  executable(
-    'timespec_test',
-    'timespec_test.cpp',
-    dependencies : [dep_thread, dep_dl, idep_gtest, idep_mesautil],
-    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
deleted file mode 100644
index 2624e20ca55..00000000000
--- a/src/util/tests/vector/meson.build
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright © 2020 Google, LLC
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-test(
-  'vector',
-  executable(
-    'vector_test',
-    'vector_test.cpp',
-    dependencies : [idep_gtest, idep_mesautil],
-    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