summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2023-08-05 11:40:04 +0100
committerEli Schwartz <eschwartz93@gmail.com>2023-08-06 02:32:25 -0400
commit61554ad37b32001f352739382e79f8639dea3c31 (patch)
tree30dc711a9c7485e9ece898b5c1abb24829eae563
parentb95ebf80b85fc8ed3ba2cf828d7b96f95894a29b (diff)
downloadmeson-61554ad37b32001f352739382e79f8639dea3c31.tar.gz
tests: Assert that mips64 kernel is detected as mips64 with no compilers
Reproduces: https://github.com/mesonbuild/meson/issues/12017 Signed-off-by: Simon McVittie <smcv@debian.org>
-rw-r--r--unittests/internaltests.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/unittests/internaltests.py b/unittests/internaltests.py
index 89979cd94..56d36117a 100644
--- a/unittests/internaltests.py
+++ b/unittests/internaltests.py
@@ -1600,6 +1600,16 @@ class InternalTests(unittest.TestCase):
actual = mesonbuild.environment.detect_cpu_family({'c': cc})
self.assertEqual(actual, expected)
+ # machine_info_can_run calls detect_cpu_family with no compilers at all
+ with mock.patch(
+ 'mesonbuild.environment.any_compiler_has_define',
+ mock.Mock(side_effect=AssertionError('Should not be called')),
+ ):
+ for test, expected in [('mips64', 'mips64')]:
+ with self.subTest(test, has_compiler=False), mock_trial(test):
+ actual = mesonbuild.environment.detect_cpu_family({})
+ self.assertEqual(actual, expected)
+
def test_detect_cpu(self) -> None:
@contextlib.contextmanager
@@ -1639,6 +1649,15 @@ class InternalTests(unittest.TestCase):
actual = mesonbuild.environment.detect_cpu({'c': cc})
self.assertEqual(actual, expected)
+ with mock.patch(
+ 'mesonbuild.environment.any_compiler_has_define',
+ mock.Mock(side_effect=AssertionError('Should not be called')),
+ ):
+ for test, expected in [('mips64', 'mips64')]:
+ with self.subTest(test, has_compiler=False), mock_trial(test):
+ actual = mesonbuild.environment.detect_cpu({})
+ self.assertEqual(actual, expected)
+
def test_interpreter_unpicklable(self) -> None:
build = mock.Mock()
build.environment = mock.Mock()