summaryrefslogtreecommitdiff
path: root/unittests/failuretests.py
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2024-12-29 11:08:37 +0100
committerEli Schwartz <eschwartz93@gmail.com>2024-12-31 10:36:11 -0500
commit631cce71db8dbae9f2330d48cb429a7ccec77135 (patch)
tree7e22a150eac47abe2a471038c5e669cd1daf277e /unittests/failuretests.py
parent3b36cb2c2c5e2978cc38283e4aa5d71ab5da4335 (diff)
downloadmeson-631cce71db8dbae9f2330d48cb429a7ccec77135.tar.gz
Fail gracefully when compiler cache is specified without compiler
With CC=ccache meson ... meson crashes with [...] File "/usr/lib/python3.10/site-packages/mesonbuild/compilers/detect.py", line 364, in _detect_c_or_cpp_compiler compiler_name = os.path.basename(compiler[0]) IndexError: list index out of range Improve this by throwing an EnvironmentException to fail gracefully when no compiler is specified. Fixes #9933 Fixes #13589
Diffstat (limited to 'unittests/failuretests.py')
-rw-r--r--unittests/failuretests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/unittests/failuretests.py b/unittests/failuretests.py
index 8a802120b..e5a3b35ea 100644
--- a/unittests/failuretests.py
+++ b/unittests/failuretests.py
@@ -381,3 +381,8 @@ class FailureTests(BasePlatformTests):
def test_error_func(self):
self.assertMesonRaises("error('a', 'b', ['c', ['d', {'e': 'f'}]], 'g')",
r"Problem encountered: a b \['c', \['d', {'e' : 'f'}\]\] g")
+
+ def test_compiler_cache_without_compiler(self):
+ self.assertMesonRaises('',
+ 'Compiler cache specified without compiler: ccache',
+ override_envvars={'CC': 'ccache'})