Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dosbox-staging/dosbox-staging.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPatryk Obara <dreamer.tan@gmail.com>2022-02-15 04:17:52 +0300
committerkcgen <1557255+kcgen@users.noreply.github.com>2022-02-15 06:53:42 +0300
commitdf93249f8fbc97ed1d171354838e1a46ad73fbb3 (patch)
tree07797d74d493e7cad95399738ed2e0a66368ea19 /tests
parent5cfcb7c665ba238130cc7d2a79794d90235cb24e (diff)
Assure gtest and gmock in the same version
Prevent situation when one of these dependencies is pulled from OS repository and another one is pulled via Meson wrap. When gtest and gmock are incompatible, it might result in compilation issues, or even worse: false negative test results.
Diffstat (limited to 'tests')
-rw-r--r--tests/meson.build30
1 files changed, 23 insertions, 7 deletions
diff --git a/tests/meson.build b/tests/meson.build
index 287d04257..047db87c0 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -16,19 +16,35 @@ gtest_dep = optional_dep
gmock_dep = optional_dep
if not (get_option('buildtype') == 'release' and get_option('unit_tests').auto())
- gtest_dep = dependency('gtest', main : true,
- required : get_option('unit_tests'),
- fallback : ['gtest', 'gtest_main_dep'])
+ gtest_system_dep = dependency('gtest', main : true,
+ required : get_option('unit_tests'))
+ gmock_system_dep = dependency('gmock', main : true,
+ required : get_option('unit_tests'))
- gmock_dep = dependency('gmock', main : true,
- required : get_option('unit_tests'),
- fallback : ['gtest', 'gmock_dep'])
+ # GTest and GMock are closely coupled together, we must use them in exactly
+ # the same version. We can't allow situation when one of packages is
+ # system-installed and another one is used from meson subproject.
+ #
+ if (gmock_system_dep.found() and gtest_system_dep.found())
+ gtest_dep = gtest_system_dep
+ gmock_dep = gmock_system_dep
+ else
+ message('GTest or GMock is not installed, using fallback for both dependencies')
+ gtest_dep = dependency('', main : true,
+ required : get_option('unit_tests'),
+ fallback : ['gtest', 'gtest_main_dep'])
+ gmock_dep = dependency('', main : true,
+ required : get_option('unit_tests'),
+ fallback : ['gtest', 'gmock_dep'])
+ endif
endif
-if not (gtest_dep.found() or gmock_dep.found())
+if not (gtest_dep.found() and gmock_dep.found())
gtest_dep = disabler()
gmock_dep = disabler()
endif
+summary('Unit tests', gtest_dep.found() and gmock_dep.found())
+
# Disable compiler flags that generate warnings
# from deliberately flawed unit test code.
#