diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-10-07 16:29:16 +0200 |
|---|---|---|
| committer | Jussi Pakkanen <jussi.pakkanen@mailbox.org> | 2025-10-29 18:59:30 +0200 |
| commit | 1614401329f11d3763a56ed5ce207aba511a6a9d (patch) | |
| tree | aa01f773236c8d9da30c40d0d946708f14834af3 /unittests | |
| parent | 1ae428cbb3200375d572e1b684241d760d1577a7 (diff) | |
| download | meson-1614401329f11d3763a56ed5ce207aba511a6a9d.tar.gz | |
environment: move detection functions to envconfig.py
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'unittests')
| -rw-r--r-- | unittests/allplatformstests.py | 16 | ||||
| -rw-r--r-- | unittests/datatests.py | 2 | ||||
| -rw-r--r-- | unittests/internaltests.py | 36 | ||||
| -rw-r--r-- | unittests/machinefiletests.py | 2 |
4 files changed, 28 insertions, 28 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index 5e4739ce3..21cdaa8be 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -1054,7 +1054,7 @@ class AllPlatformTests(BasePlatformTests): def test_internal_include_order(self): - if mesonbuild.environment.detect_msys2_arch() and ('MESON_RSP_THRESHOLD' in os.environ): + if mesonbuild.envconfig.detect_msys2_arch() and ('MESON_RSP_THRESHOLD' in os.environ): raise SkipTest('Test does not yet support gcc rsp files on msys2') testdir = os.path.join(self.common_test_dir, '130 include order') @@ -4075,7 +4075,7 @@ class AllPlatformTests(BasePlatformTests): return basename def get_shared_lib_name(basename: str) -> str: - if mesonbuild.environment.detect_msys2_arch(): + if mesonbuild.envconfig.detect_msys2_arch(): return f'lib{basename}.dll' elif is_windows(): return f'{basename}.dll' @@ -4288,7 +4288,7 @@ class AllPlatformTests(BasePlatformTests): self.assertTrue((covdir / f).is_file(), msg=f'{f} is not a file') def test_coverage(self): - if mesonbuild.environment.detect_msys2_arch(): + if mesonbuild.envconfig.detect_msys2_arch(): raise SkipTest('Skipped due to problems with coverage on MSYS2') gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() if not gcovr_exe: @@ -4308,7 +4308,7 @@ class AllPlatformTests(BasePlatformTests): self._check_coverage_files() def test_coverage_complex(self): - if mesonbuild.environment.detect_msys2_arch(): + if mesonbuild.envconfig.detect_msys2_arch(): raise SkipTest('Skipped due to problems with coverage on MSYS2') gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() if not gcovr_exe: @@ -4328,7 +4328,7 @@ class AllPlatformTests(BasePlatformTests): self._check_coverage_files() def test_coverage_html(self): - if mesonbuild.environment.detect_msys2_arch(): + if mesonbuild.envconfig.detect_msys2_arch(): raise SkipTest('Skipped due to problems with coverage on MSYS2') gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() if not gcovr_exe: @@ -4348,7 +4348,7 @@ class AllPlatformTests(BasePlatformTests): self._check_coverage_files(['html']) def test_coverage_text(self): - if mesonbuild.environment.detect_msys2_arch(): + if mesonbuild.envconfig.detect_msys2_arch(): raise SkipTest('Skipped due to problems with coverage on MSYS2') gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() if not gcovr_exe: @@ -4368,7 +4368,7 @@ class AllPlatformTests(BasePlatformTests): self._check_coverage_files(['text']) def test_coverage_xml(self): - if mesonbuild.environment.detect_msys2_arch(): + if mesonbuild.envconfig.detect_msys2_arch(): raise SkipTest('Skipped due to problems with coverage on MSYS2') gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() if not gcovr_exe: @@ -4388,7 +4388,7 @@ class AllPlatformTests(BasePlatformTests): self._check_coverage_files(['xml']) def test_coverage_escaping(self): - if mesonbuild.environment.detect_msys2_arch(): + if mesonbuild.envconfig.detect_msys2_arch(): raise SkipTest('Skipped due to problems with coverage on MSYS2') gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() if not gcovr_exe: diff --git a/unittests/datatests.py b/unittests/datatests.py index 58b74188e..e529e4e5b 100644 --- a/unittests/datatests.py +++ b/unittests/datatests.py @@ -183,7 +183,7 @@ class DataTests(unittest.TestCase): arches = [m.group(1) for m in re.finditer(r"^\| (\w+) +\|", content, re.MULTILINE)] # Drop the header arches = set(arches[1:]) - self.assertEqual(arches, set(mesonbuild.environment.known_cpu_families)) + self.assertEqual(arches, set(mesonbuild.envconfig.known_cpu_families)) def test_markdown_files_in_sitemap(self): ''' diff --git a/unittests/internaltests.py b/unittests/internaltests.py index dfa797dc7..71e32ba3f 100644 --- a/unittests/internaltests.py +++ b/unittests/internaltests.py @@ -1594,9 +1594,9 @@ class InternalTests(unittest.TestCase): """Mock all of the ways we could get the trial at once.""" mocked = mock.Mock(return_value=value) - with mock.patch('mesonbuild.environment.detect_windows_arch', mocked), \ - mock.patch('mesonbuild.environment.platform.processor', mocked), \ - mock.patch('mesonbuild.environment.platform.machine', mocked): + with mock.patch('mesonbuild.envconfig.detect_windows_arch', mocked), \ + mock.patch('mesonbuild.envconfig.platform.processor', mocked), \ + mock.patch('mesonbuild.envconfig.platform.machine', mocked): yield cases = [ @@ -1629,26 +1629,26 @@ class InternalTests(unittest.TestCase): cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, mock.Mock()) - with mock.patch('mesonbuild.environment.any_compiler_has_define', mock.Mock(return_value=False)): + with mock.patch('mesonbuild.envconfig.any_compiler_has_define', mock.Mock(return_value=False)): for test, expected in cases: with self.subTest(test, has_define=False), mock_trial(test): - actual = mesonbuild.environment.detect_cpu_family({'c': cc}) + actual = mesonbuild.envconfig.detect_cpu_family({'c': cc}) self.assertEqual(actual, expected) - with mock.patch('mesonbuild.environment.any_compiler_has_define', mock.Mock(return_value=True)): + with mock.patch('mesonbuild.envconfig.any_compiler_has_define', mock.Mock(return_value=True)): 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({'c': cc}) + actual = mesonbuild.envconfig.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', + 'mesonbuild.envconfig.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({}) + actual = mesonbuild.envconfig.detect_cpu_family({}) self.assertEqual(actual, expected) def test_detect_cpu(self) -> None: @@ -1658,9 +1658,9 @@ class InternalTests(unittest.TestCase): """Mock all of the ways we could get the trial at once.""" mocked = mock.Mock(return_value=value) - with mock.patch('mesonbuild.environment.detect_windows_arch', mocked), \ - mock.patch('mesonbuild.environment.platform.processor', mocked), \ - mock.patch('mesonbuild.environment.platform.machine', mocked): + with mock.patch('mesonbuild.envconfig.detect_windows_arch', mocked), \ + mock.patch('mesonbuild.envconfig.platform.processor', mocked), \ + mock.patch('mesonbuild.envconfig.platform.machine', mocked): yield cases = [ @@ -1678,25 +1678,25 @@ class InternalTests(unittest.TestCase): cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, mock.Mock()) - with mock.patch('mesonbuild.environment.any_compiler_has_define', mock.Mock(return_value=False)): + with mock.patch('mesonbuild.envconfig.any_compiler_has_define', mock.Mock(return_value=False)): for test, expected in cases: with self.subTest(test, has_define=False), mock_trial(test): - actual = mesonbuild.environment.detect_cpu({'c': cc}) + actual = mesonbuild.envconfig.detect_cpu({'c': cc}) self.assertEqual(actual, expected) - with mock.patch('mesonbuild.environment.any_compiler_has_define', mock.Mock(return_value=True)): + with mock.patch('mesonbuild.envconfig.any_compiler_has_define', mock.Mock(return_value=True)): 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({'c': cc}) + actual = mesonbuild.envconfig.detect_cpu({'c': cc}) self.assertEqual(actual, expected) with mock.patch( - 'mesonbuild.environment.any_compiler_has_define', + 'mesonbuild.envconfig.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({}) + actual = mesonbuild.envconfig.detect_cpu({}) self.assertEqual(actual, expected) @mock.patch('mesonbuild.interpreter.Interpreter.load_root_meson_file', mock.Mock(return_value=None)) diff --git a/unittests/machinefiletests.py b/unittests/machinefiletests.py index 15c0e5728..7f583de2e 100644 --- a/unittests/machinefiletests.py +++ b/unittests/machinefiletests.py @@ -204,7 +204,7 @@ class NativeFileTests(BasePlatformTests): def test_config_tool_dep(self): # Do the skip at this level to avoid screwing up the cache - if mesonbuild.environment.detect_msys2_arch(): + if mesonbuild.envconfig.detect_msys2_arch(): raise SkipTest('Skipped due to problems with LLVM on MSYS2') if not shutil.which('llvm-config'): raise SkipTest('No llvm-installed, cannot test') |
