summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-11-19 19:50:28 +0100
committerDylan Baker <dylan@pnwbakers.com>2025-11-21 11:21:21 -0800
commit03a09266b59dabe437b1b8a3927adf266ce65890 (patch)
treefcea1d963ff026d1149f62f75e48f3f1e41e1490 /unittests
parente38b2e83e64391790397dc71f6e27d57385fe767 (diff)
downloadmeson-03a09266b59dabe437b1b8a3927adf266ce65890.tar.gz
rewrite: fix duplicate objects for predefined globals
Global objects are treated as UnknownValue(), but unlike other variables their object is created on every call to get_cur_value_if_defined() instead of coming from a dictionary. This causes the dataflow DAG to have multiple objects from the same object. Fix this by building the UnknownValues at interpreter construction time. Fixes: #15261 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'unittests')
-rw-r--r--unittests/rewritetests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/unittests/rewritetests.py b/unittests/rewritetests.py
index 84a6baf56..f2af8f64a 100644
--- a/unittests/rewritetests.py
+++ b/unittests/rewritetests.py
@@ -445,6 +445,16 @@ class RewriterTests(BasePlatformTests):
out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
self.assertEqualIgnoreOrder(out, expected)
+ def test_duplicate_globals(self):
+ self.prime('10 duplicate globals')
+ out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
+ expected = {
+ 'kwargs': {
+ 'project#/': {'license': 'MIT'}
+ }
+ }
+ self.assertEqualIgnoreOrder(out, expected)
+
def test_tricky_dataflow(self):
self.prime('8 tricky dataflow')
out = self.rewrite(self.builddir, os.path.join(self.builddir, 'addSrc.json'))