aboutsummaryrefslogtreecommitdiff
path: root/run_tests.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-08-15 17:38:39 -0400
committerXavier Claessens <xclaesse@gmail.com>2023-09-18 13:51:27 -0400
commitdacd11a6247b97be4981ceabaa75b3a25282f3b4 (patch)
tree291ca57371490a514ef7e21fcd3f9857e2e97ec5 /run_tests.py
parentdec85c41a9e5d6f8bb2c4431a78a0a9ade3651fd (diff)
downloadmeson-dacd11a6247b97be4981ceabaa75b3a25282f3b4.zip
meson-dacd11a6247b97be4981ceabaa75b3a25282f3b4.tar.gz
meson-dacd11a6247b97be4981ceabaa75b3a25282f3b4.tar.bz2
pkgconfig: Cache the implementation instance
Diffstat (limited to 'run_tests.py')
-rwxr-xr-xrun_tests.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/run_tests.py b/run_tests.py
index 699e293..a959d6a 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -36,7 +36,7 @@ import typing as T
from mesonbuild.compilers.c import CCompiler
from mesonbuild.compilers.detect import detect_c_compiler
-from mesonbuild.dependencies.pkgconfig import PkgConfigCLI
+from mesonbuild.dependencies.pkgconfig import PkgConfigInterface
from mesonbuild import mesonlib
from mesonbuild import mesonmain
from mesonbuild import mtest
@@ -161,6 +161,8 @@ def get_fake_env(sdir='', bdir=None, prefix='', opts=None):
env = Environment(sdir, bdir, opts)
env.coredata.options[OptionKey('args', lang='c')] = FakeCompilerOptions()
env.machines.host.cpu_family = 'x86_64' # Used on macOS inside find_library
+ # Invalidate cache when using a different Environment object.
+ clear_meson_configure_class_caches()
return env
def get_convincing_fake_env_and_cc(bdir, prefix):
@@ -309,11 +311,10 @@ def run_mtest_inprocess(commandlist: T.List[str]) -> T.Tuple[int, str, str]:
return returncode, out.getvalue()
def clear_meson_configure_class_caches() -> None:
- CCompiler.find_library_cache = {}
- CCompiler.find_framework_cache = {}
- PkgConfigCLI.pkgbin_cache = {}
- PkgConfigCLI.class_pkgbin = mesonlib.PerMachine(None, None)
- mesonlib.project_meson_versions = collections.defaultdict(str)
+ CCompiler.find_library_cache.clear()
+ CCompiler.find_framework_cache.clear()
+ PkgConfigInterface.class_impl.assign(False, False)
+ mesonlib.project_meson_versions.clear()
def run_configure_inprocess(commandlist: T.List[str], env: T.Optional[T.Dict[str, str]] = None, catch_exception: bool = False) -> T.Tuple[int, str, str]:
stderr = StringIO()