util: Consolidate existing gtests in a single binary

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13425>
This commit is contained in:
Caio Marcelo de Oliveira Filho 2021-10-18 13:16:29 -07:00
parent 60768f4029
commit 2209f5794d
7 changed files with 37 additions and 234 deletions

View file

@ -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',
)
endforeach
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'
)
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

View file

@ -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,
)

View file

@ -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,
)

View file

@ -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,
)

View file

@ -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,
)

View file

@ -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,
)

View file

@ -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,
)