summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-05-09 11:44:36 +0200
committerEli Schwartz <eschwartz93@gmail.com>2025-05-15 02:05:18 -0400
commit5081536f5764cfa8f6ce9cd7a5e43595b8b0f50d (patch)
tree2587376d6509a68b38e0a116c91fc50f1a0992a5
parent2f6fc30df10583c77dc1318f2fb62111de3e121c (diff)
downloadmeson-5081536f5764cfa8f6ce9cd7a5e43595b8b0f50d.tar.gz
add test case for setting options from reconfigure
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--test cases/common/40 options/meson.build3
-rw-r--r--unittests/platformagnostictests.py10
2 files changed, 11 insertions, 2 deletions
diff --git a/test cases/common/40 options/meson.build b/test cases/common/40 options/meson.build
index 3849d54ea..f41265af7 100644
--- a/test cases/common/40 options/meson.build
+++ b/test cases/common/40 options/meson.build
@@ -40,8 +40,7 @@ if get_option('integer_opt') != 3
endif
negint = get_option('neg_int_opt')
-
-if negint != -3 and negint != -10
+if negint not in [-2, -3, -10]
error('Incorrect value @0@ in negative integer option.'.format(negint))
endif
diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py
index d6c00787c..c1475c51e 100644
--- a/unittests/platformagnostictests.py
+++ b/unittests/platformagnostictests.py
@@ -453,6 +453,16 @@ class PlatformAgnosticTests(BasePlatformTests):
self.setconf('-Dneg_int_opt=0')
self.assertIn('Unknown options: ":neg_int_opt"', e.exception.stdout)
+ def test_reconfigure_option(self) -> None:
+ testdir = self.copy_srcdir(os.path.join(self.common_test_dir, '40 options'))
+ self.init(testdir)
+ self.assertEqual(self.getconf('neg_int_opt'), -3)
+ with self.assertRaises(subprocess.CalledProcessError) as e:
+ self.init(testdir, extra_args=['--reconfigure', '-Dneg_int_opt=0'])
+ self.assertEqual(self.getconf('neg_int_opt'), -3)
+ self.init(testdir, extra_args=['--reconfigure', '-Dneg_int_opt=-2'])
+ self.assertEqual(self.getconf('neg_int_opt'), -2)
+
def test_configure_option_changed_constraints(self) -> None:
"""Changing the constraints of an option without reconfiguring should work."""
testdir = self.copy_srcdir(os.path.join(self.common_test_dir, '40 options'))