summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2025-10-31 10:24:23 -0700
committerDylan Baker <dylan@pnwbakers.com>2025-11-19 10:48:48 -0800
commita6c4a4d7e867db4f98db1127d1246c43c5c7a863 (patch)
treebd70a8701333f1238fa2b8c99e3a818dd82ab949 /unittests
parent12b1e3c6a72b715bf20e4c304da065e16c510830 (diff)
downloadmeson-a6c4a4d7e867db4f98db1127d1246c43c5c7a863.tar.gz
compilers: Pass Environment instead of MachineInfo
We end up needing it everywhere, so just store it. This patch is huge already, so it's just the conversion to passing Environment, more cleanups to come.
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 8bc9c00c5..b5dad878b 100644
--- a/unittests/internaltests.py
+++ b/unittests/internaltests.py
@@ -109,7 +109,7 @@ class InternalTests(unittest.TestCase):
stat.S_IRGRP | stat.S_IXGRP)
def test_compiler_args_class_none_flush(self):
- cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, mock.Mock())
+ cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, get_fake_env())
a = cc.compiler_args(['-I.'])
#first we are checking if the tree construction deduplicates the correct -I argument
a += ['-I..']
@@ -126,14 +126,14 @@ class InternalTests(unittest.TestCase):
self.assertEqual(a, ['-I.', '-I./tests2/', '-I./tests/', '-I..'])
def test_compiler_args_class_d(self):
- d = DmdDCompiler([], 'fake', MachineChoice.HOST, 'info', 'arch')
+ d = DmdDCompiler([], 'fake', MachineChoice.HOST, get_fake_env(), 'arch')
# check include order is kept when deduplicating
a = d.compiler_args(['-Ifirst', '-Isecond', '-Ithird'])
a += ['-Ifirst']
self.assertEqual(a, ['-Ifirst', '-Isecond', '-Ithird'])
def test_compiler_args_class_clike(self):
- cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, mock.Mock())
+ cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, get_fake_env())
# Test that empty initialization works
a = cc.compiler_args()
self.assertEqual(a, [])
@@ -216,7 +216,7 @@ class InternalTests(unittest.TestCase):
def test_compiler_args_class_visualstudio(self):
linker = linkers.MSVCDynamicLinker(MachineChoice.HOST, [])
# Version just needs to be > 19.0.0
- cc = VisualStudioCPPCompiler([], [], '20.00', MachineChoice.HOST, False, mock.Mock(), 'x64', linker=linker)
+ cc = VisualStudioCPPCompiler([], [], '20.00', MachineChoice.HOST, False, get_fake_env(), 'x64', linker=linker)
a = cc.compiler_args(cc.get_always_args())
self.assertEqual(a.to_native(copy=True), ['/nologo', '/showIncludes', '/utf-8', '/Zc:__cplusplus'])
@@ -237,7 +237,7 @@ class InternalTests(unittest.TestCase):
def test_compiler_args_class_gnuld(self):
## Test --start/end-group
linker = linkers.GnuBFDDynamicLinker([], MachineChoice.HOST, '-Wl,', [])
- gcc = GnuCCompiler([], [], 'fake', False, MachineChoice.HOST, mock.Mock(), linker=linker)
+ gcc = GnuCCompiler([], [], 'fake', MachineChoice.HOST, False, get_fake_env(), linker=linker)
## Ensure that the fake compiler is never called by overriding the relevant function
gcc.get_default_include_dirs = lambda: ['/usr/include', '/usr/share/include', '/usr/local/include']
## Test that 'direct' append and extend works
@@ -265,7 +265,7 @@ class InternalTests(unittest.TestCase):
def test_compiler_args_remove_system(self):
## Test --start/end-group
linker = linkers.GnuBFDDynamicLinker([], MachineChoice.HOST, '-Wl,', [])
- gcc = GnuCCompiler([], [], 'fake', False, MachineChoice.HOST, mock.Mock(), linker=linker)
+ gcc = GnuCCompiler([], [], 'fake', MachineChoice.HOST, False, get_fake_env(), linker=linker)
## Ensure that the fake compiler is never called by overriding the relevant function
gcc.get_default_include_dirs = lambda: ['/usr/include', '/usr/share/include', '/usr/local/include']
## Test that 'direct' append and extend works
@@ -1636,7 +1636,7 @@ class InternalTests(unittest.TestCase):
('aarch64_be', 'aarch64'),
]
- cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, mock.Mock())
+ cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, get_fake_env())
with mock.patch('mesonbuild.envconfig.any_compiler_has_define', mock.Mock(return_value=False)):
for test, expected in cases:
@@ -1685,7 +1685,7 @@ class InternalTests(unittest.TestCase):
('aarch64_be', 'aarch64'),
]
- cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, mock.Mock())
+ cc = ClangCCompiler([], [], 'fake', MachineChoice.HOST, False, get_fake_env())
with mock.patch('mesonbuild.envconfig.any_compiler_has_define', mock.Mock(return_value=False)):
for test, expected in cases: