aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2022-03-31 16:26:22 +0300
committerGitHub <noreply@github.com>2022-03-31 16:26:22 +0300
commitefc7604ca268666cf40b1efc69b62ebfca986344 (patch)
tree08a718955e5777491cccb15189cc990054a8d2f7 /unittests
parent4b97c6065043e4268425bebec35f5c3722f73c2e (diff)
parent34ea8fdf981b5e10c702e9adfcab7f9e316a129b (diff)
downloadmeson-efc7604ca268666cf40b1efc69b62ebfca986344.zip
meson-efc7604ca268666cf40b1efc69b62ebfca986344.tar.gz
meson-efc7604ca268666cf40b1efc69b62ebfca986344.tar.bz2
Merge pull request #9989 from ePirat/epirat-fix-uscore-prefix-detection
Fix underscore detection
Diffstat (limited to 'unittests')
-rw-r--r--unittests/allplatformstests.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 8a7fcd7..67c50e7 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -60,7 +60,7 @@ from mesonbuild.scripts import destdir_join
from mesonbuild.wrap.wrap import PackageDefinition, WrapException
from run_tests import (
- Backend, exe_suffix, get_fake_env
+ Backend, exe_suffix, get_fake_env, get_convincing_fake_env_and_cc
)
from .baseplatformtests import BasePlatformTests
@@ -1546,6 +1546,32 @@ class AllPlatformTests(BasePlatformTests):
self.build()
self.run_tests()
+ def test_underscore_prefix_detection_list(self) -> None:
+ '''
+ Test the underscore detection hardcoded lookup list
+ against what was detected in the binary.
+ '''
+ env, cc = get_convincing_fake_env_and_cc(self.builddir, self.prefix)
+ expected_uscore = cc._symbols_have_underscore_prefix_searchbin(env)
+ list_uscore = cc._symbols_have_underscore_prefix_list(env)
+ if list_uscore is not None:
+ self.assertEqual(list_uscore, expected_uscore)
+ else:
+ raise SkipTest('No match in underscore prefix list for this platform.')
+
+ def test_underscore_prefix_detection_define(self) -> None:
+ '''
+ Test the underscore detection based on compiler-defined preprocessor macro
+ against what was detected in the binary.
+ '''
+ env, cc = get_convincing_fake_env_and_cc(self.builddir, self.prefix)
+ expected_uscore = cc._symbols_have_underscore_prefix_searchbin(env)
+ define_uscore = cc._symbols_have_underscore_prefix_define(env)
+ if define_uscore is not None:
+ self.assertEqual(define_uscore, expected_uscore)
+ else:
+ raise SkipTest('Did not find the underscore prefix define __USER_LABEL_PREFIX__')
+
@skipIfNoPkgconfig
def test_pkgconfig_static(self):
'''