summaryrefslogtreecommitdiff
path: root/unittests/optiontests.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-04-19 14:39:14 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2025-04-24 17:49:05 +0300
commit8fe6edfa4f8b6e64a19bbae471f37a2750023af6 (patch)
treecaf3e1f4651156c81f8f88d961141ea6252367e3 /unittests/optiontests.py
parent705a63fc3a95c3a6fdb9506e07b1fd5e5c0522e4 (diff)
downloadmeson-8fe6edfa4f8b6e64a19bbae471f37a2750023af6.tar.gz
options: subproject system options require the global ones
Because system options apply to all subprojects, they need to be present globally whenever a subproject needs them. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'unittests/optiontests.py')
-rw-r--r--unittests/optiontests.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/unittests/optiontests.py b/unittests/optiontests.py
index 3b3ffc98e..5ed601fed 100644
--- a/unittests/optiontests.py
+++ b/unittests/optiontests.py
@@ -35,6 +35,20 @@ class OptionTests(unittest.TestCase):
optstore.initialize_from_top_level_project_call({OptionKey('someoption'): new_value}, {}, {})
self.assertEqual(optstore.get_value_for(k), new_value)
+ def test_subproject_system_option(self):
+ """Test that subproject system options get their default value from the global
+ option (e.g. "sub:b_lto" can be initialized from "b_lto")."""
+ optstore = OptionStore(False)
+ name = 'someoption'
+ default_value = 'somevalue'
+ new_value = 'new_value'
+ k = OptionKey(name)
+ subk = k.evolve(subproject='sub')
+ optstore.initialize_from_top_level_project_call({}, {}, {OptionKey(name): new_value})
+ vo = UserStringOption(k.name, 'An option of some sort', default_value)
+ optstore.add_system_option(subk, vo)
+ self.assertEqual(optstore.get_value_for(subk), new_value)
+
def test_parsing(self):
with self.subTest('subproject'):
s1 = OptionKey.from_string('sub:optname')