From 377fde5cf1ad8aa31c8731efabad13c1b49dbee2 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 12 Nov 2025 11:10:25 -0800 Subject: linkers: Store a reference to the Environment in the DynamicLinker For the same reason that the StaticLinker needs this, we need it in the DynamicLinker as well. --- unittests/internaltests.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'unittests') diff --git a/unittests/internaltests.py b/unittests/internaltests.py index a1c18efba..8a3e2fd2e 100644 --- a/unittests/internaltests.py +++ b/unittests/internaltests.py @@ -214,9 +214,10 @@ class InternalTests(unittest.TestCase): def test_compiler_args_class_visualstudio(self): - linker = linkers.MSVCDynamicLinker(MachineChoice.HOST, []) + env = get_fake_env() + linker = linkers.MSVCDynamicLinker(env, MachineChoice.HOST, []) # Version just needs to be > 19.0.0 - cc = VisualStudioCPPCompiler([], [], '20.00', MachineChoice.HOST, get_fake_env(), 'x64', linker=linker) + cc = VisualStudioCPPCompiler([], [], '20.00', MachineChoice.HOST, 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']) @@ -236,8 +237,9 @@ class InternalTests(unittest.TestCase): def test_compiler_args_class_gnuld(self): ## Test --start/end-group - linker = linkers.GnuBFDDynamicLinker([], MachineChoice.HOST, '-Wl,', []) - gcc = GnuCCompiler([], [], 'fake', MachineChoice.HOST, get_fake_env(), linker=linker) + env = get_fake_env() + linker = linkers.GnuBFDDynamicLinker([], env, MachineChoice.HOST, '-Wl,', []) + gcc = GnuCCompiler([], [], 'fake', MachineChoice.HOST, 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 @@ -264,8 +266,9 @@ class InternalTests(unittest.TestCase): def test_compiler_args_remove_system(self): ## Test --start/end-group - linker = linkers.GnuBFDDynamicLinker([], MachineChoice.HOST, '-Wl,', []) - gcc = GnuCCompiler([], [], 'fake', MachineChoice.HOST, get_fake_env(), linker=linker) + env = get_fake_env() + linker = linkers.GnuBFDDynamicLinker([], env, MachineChoice.HOST, '-Wl,', []) + gcc = GnuCCompiler([], [], 'fake', MachineChoice.HOST, 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 -- cgit v1.2.3