Skip to content

Commit 9569d68

Browse files
smcvmatoro
authored andcommitted
tests: Assert that mips64 kernel is detected as mips64 with no compilers
Reproduces: mesonbuild#12017 Signed-off-by: Simon McVittie <[email protected]>
1 parent b64a093 commit 9569d68

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

unittests/internaltests.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,16 @@ def mock_trial(value: str) -> T.Iterable[None]:
16101610
actual = mesonbuild.environment.detect_cpu_family({'c': cc})
16111611
self.assertEqual(actual, expected)
16121612

1613+
# machine_info_can_run calls detect_cpu_family with no compilers at all
1614+
with mock.patch(
1615+
'mesonbuild.environment.any_compiler_has_define',
1616+
mock.Mock(side_effect=AssertionError('Should not be called')),
1617+
):
1618+
for test, expected in [('mips64', 'mips64')]:
1619+
with self.subTest(test, has_compiler=False), mock_trial(test):
1620+
actual = mesonbuild.environment.detect_cpu_family({})
1621+
self.assertEqual(actual, expected)
1622+
16131623
def test_detect_cpu(self) -> None:
16141624

16151625
@contextlib.contextmanager
@@ -1649,6 +1659,15 @@ def mock_trial(value: str) -> T.Iterable[None]:
16491659
actual = mesonbuild.environment.detect_cpu({'c': cc})
16501660
self.assertEqual(actual, expected)
16511661

1662+
with mock.patch(
1663+
'mesonbuild.environment.any_compiler_has_define',
1664+
mock.Mock(side_effect=AssertionError('Should not be called')),
1665+
):
1666+
for test, expected in [('mips64', 'mips64')]:
1667+
with self.subTest(test, has_compiler=False), mock_trial(test):
1668+
actual = mesonbuild.environment.detect_cpu({})
1669+
self.assertEqual(actual, expected)
1670+
16521671
def test_interpreter_unpicklable(self) -> None:
16531672
build = mock.Mock()
16541673
build.environment = mock.Mock()

0 commit comments

Comments
 (0)