From 92590bb03487eac2624e29c8b040f76773b35c66 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 26 Aug 2025 09:47:36 +0200 Subject: options: do not raise exception for unknown options in -U command Fixes: #14956 Signed-off-by: Paolo Bonzini --- mesonbuild/options.py | 3 +++ unittests/optiontests.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/mesonbuild/options.py b/mesonbuild/options.py index b9f17cf72..346abcc3a 100644 --- a/mesonbuild/options.py +++ b/mesonbuild/options.py @@ -1117,6 +1117,9 @@ class OptionStore: del self.augments[key] dirty = True else: + if key not in self.options: + raise MesonException(f"Unknown option: {key}") + # TODO: For project options, "dropping an augment" means going # back to the superproject's value. However, it's confusing # that -U does not simply remove the option from the stored diff --git a/unittests/optiontests.py b/unittests/optiontests.py index 19ff8b43b..8f49a804e 100644 --- a/unittests/optiontests.py +++ b/unittests/optiontests.py @@ -331,6 +331,11 @@ class OptionTests(unittest.TestCase): optstore = OptionStore(False) optstore.set_from_configure_command({OptionKey('b_ndebug'): True}) + def test_unconfigure_nonexistent(self): + optstore = OptionStore(False) + with self.assertRaises(MesonException): + optstore.set_from_configure_command({OptionKey('nonexistent'): None}) + def test_subproject_proj_opt_with_same_name(self): name = 'tests' subp = 'subp' -- cgit v1.2.3