aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorCyan <cyanoxygen@aosc.io>2023-04-13 11:21:55 +0800
committerEli Schwartz <eschwartz93@gmail.com>2023-04-28 00:20:42 -0400
commit6def03c787407fc4ff95595abab15083e757275e (patch)
treed89753502ab8bed7e684e5ea03e9c6bd721556cd /unittests
parentf5fa56fdfaf979b2bd124b5b7f24f51a029675f8 (diff)
downloadmeson-6def03c787407fc4ff95595abab15083e757275e.zip
meson-6def03c787407fc4ff95595abab15083e757275e.tar.gz
meson-6def03c787407fc4ff95595abab15083e757275e.tar.bz2
detect_cpu: Fix mips32 detection on mips64
MIPS64 can run MIPS32 code natively, so there is a chance that a mixture of MIPS64 kernel and MIPS32 userland exists. Before this Meson just treats such mixture as mips64, because uname -m returns mips64. So in this case we have to check compiler builtin defines for actual architecture and CPU in use. - Also fixes mips64 related detection tests in internaltests: Normalize mips64 as mips first, then if __mips64 is defined, return mips64 for mips64* machines. This is a bit confiusing because normally one would detect if a flag of 32-bit target is defined while running on a 64-bit machine. For mips64 it is almost just the other way around - we need to detect if __mips64 is set to make sure it is a mips64 environment. Co-Authored-By: Jue Wang <maliya355@outlook.com>
Diffstat (limited to 'unittests')
-rw-r--r--unittests/internaltests.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/unittests/internaltests.py b/unittests/internaltests.py
index baeaacd..720782e 100644
--- a/unittests/internaltests.py
+++ b/unittests/internaltests.py
@@ -1579,12 +1579,12 @@ class InternalTests(unittest.TestCase):
('ppc', 'ppc'),
('macppc', 'ppc'),
('power macintosh', 'ppc'),
- ('mips64el', 'mips64'),
- ('mips64', 'mips64'),
+ ('mips64el', 'mips'),
+ ('mips64', 'mips'),
('mips', 'mips'),
('mipsel', 'mips'),
- ('ip30', 'mips64'),
- ('ip35', 'mips64'),
+ ('ip30', 'mips'),
+ ('ip35', 'mips'),
('parisc64', 'parisc'),
('sun4u', 'sparc64'),
('sun4v', 'sparc64'),
@@ -1602,7 +1602,7 @@ class InternalTests(unittest.TestCase):
self.assertEqual(actual, expected)
with mock.patch('mesonbuild.environment.any_compiler_has_define', mock.Mock(return_value=True)):
- for test, expected in [('x86_64', 'x86'), ('aarch64', 'arm'), ('ppc', 'ppc64')]:
+ for test, expected in [('x86_64', 'x86'), ('aarch64', 'arm'), ('ppc', 'ppc64'), ('mips64', 'mips64')]:
with self.subTest(test, has_define=True), mock_trial(test):
actual = mesonbuild.environment.detect_cpu_family({})
self.assertEqual(actual, expected)
@@ -1624,8 +1624,8 @@ class InternalTests(unittest.TestCase):
('x64', 'x86_64'),
('i86pc', 'x86_64'),
('earm', 'arm'),
- ('mips64el', 'mips64'),
- ('mips64', 'mips64'),
+ ('mips64el', 'mips'),
+ ('mips64', 'mips'),
('mips', 'mips'),
('mipsel', 'mips'),
('aarch64', 'aarch64'),
@@ -1639,7 +1639,7 @@ class InternalTests(unittest.TestCase):
self.assertEqual(actual, expected)
with mock.patch('mesonbuild.environment.any_compiler_has_define', mock.Mock(return_value=True)):
- for test, expected in [('x86_64', 'i686'), ('aarch64', 'arm'), ('ppc', 'ppc64')]:
+ for test, expected in [('x86_64', 'i686'), ('aarch64', 'arm'), ('ppc', 'ppc64'), ('mips64', 'mips64')]:
with self.subTest(test, has_define=True), mock_trial(test):
actual = mesonbuild.environment.detect_cpu({})
self.assertEqual(actual, expected)