summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-04-02 13:03:29 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2025-04-09 16:32:20 +0300
commita4be4cd420cd7000aefb6ff52e85f6f873f1b4a5 (patch)
tree6e60021f090def9786a38382087914dfaae2a62b
parenta3c41c6a896ed49b157ccc830e1bc665581097b4 (diff)
downloadmeson-a4be4cd420cd7000aefb6ff52e85f6f873f1b4a5.tar.gz
tests: add test for deprecated options with project-option syntax
Cover ":foo" syntax in default_options as well. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--test cases/common/247 deprecated option/meson.build13
-rw-r--r--test cases/common/247 deprecated option/meson_options.txt7
-rw-r--r--test cases/common/247 deprecated option/test.json25
3 files changed, 45 insertions, 0 deletions
diff --git a/test cases/common/247 deprecated option/meson.build b/test cases/common/247 deprecated option/meson.build
index 60e6f9650..f31142130 100644
--- a/test cases/common/247 deprecated option/meson.build
+++ b/test cases/common/247 deprecated option/meson.build
@@ -7,20 +7,33 @@ project('deprecated options',
'o5=auto',
'o6=false',
'o8=/foo',
+ ':p1=false',
+ ':p2=a,b',
+ ':p3=a,b',
+ ':p4=true',
+ ':p5=auto',
+ ':p6=false',
+ ':p8=/foo',
]
)
assert(get_option('o1') == false)
+assert(get_option('p1') == false)
assert(get_option('c1') == false)
assert(get_option('o2') == ['a', 'b'])
+assert(get_option('p2') == ['a', 'b'])
assert(get_option('c2') == ['a', 'b'])
assert(get_option('o3') == ['c', 'b'])
+assert(get_option('p3') == ['c', 'b'])
assert(get_option('c3') == ['c', 'b'])
assert(get_option('o4').enabled())
+assert(get_option('p4').enabled())
assert(get_option('c4').enabled())
assert(get_option('o5') == false)
+assert(get_option('p5') == false)
assert(get_option('c5') == false)
assert(get_option('o6') == false)
+assert(get_option('p6') == false)
assert(get_option('c6') == false)
assert(get_option('o7').disabled())
assert(get_option('python.platlibdir') == '/foo')
diff --git a/test cases/common/247 deprecated option/meson_options.txt b/test cases/common/247 deprecated option/meson_options.txt
index 6e8d14cbb..36fcb914c 100644
--- a/test cases/common/247 deprecated option/meson_options.txt
+++ b/test cases/common/247 deprecated option/meson_options.txt
@@ -1,31 +1,38 @@
# Option fully deprecated, it warns when any value is set.
option('o1', type: 'boolean', deprecated: true)
+option('p1', type: 'boolean', deprecated: true)
option('c1', type: 'boolean', deprecated: true)
# One of the choices is deprecated, it warns only when 'a' is in the list of values.
option('o2', type: 'array', choices: ['a', 'b'], deprecated: ['a'])
+option('p2', type: 'array', choices: ['a', 'b'], deprecated: ['a'])
option('c2', type: 'array', choices: ['a', 'b'], deprecated: ['a'])
# One of the choices is deprecated, it warns only when 'a' is in the list of values
# and replace it by 'c'.
option('o3', type: 'array', choices: ['a', 'b', 'c'], deprecated: {'a': 'c'})
+option('p3', type: 'array', choices: ['a', 'b', 'c'], deprecated: {'a': 'c'})
option('c3', type: 'array', choices: ['a', 'b', 'c'], deprecated: {'a': 'c'})
# A boolean option has been replaced by a feature, old true/false values are remapped.
option('o4', type: 'feature', deprecated: {'true': 'enabled', 'false': 'disabled'})
+option('p4', type: 'feature', deprecated: {'true': 'enabled', 'false': 'disabled'})
option('c4', type: 'feature', deprecated: {'true': 'enabled', 'false': 'disabled'})
# A feature option has been replaced by a boolean, enabled/disabled/auto values are remapped.
option('o5', type: 'boolean', deprecated: {'enabled': 'true', 'disabled': 'false', 'auto': 'false'})
+option('p5', type: 'boolean', deprecated: {'enabled': 'true', 'disabled': 'false', 'auto': 'false'})
option('c5', type: 'boolean', deprecated: {'enabled': 'true', 'disabled': 'false', 'auto': 'false'})
# A boolean option has been replaced by a feature with another name, old true/false values
# are accepted by the new option for backward compatibility.
option('o6', type: 'boolean', value: true, deprecated: 'o7')
+option('p6', type: 'boolean', value: true, deprecated: 'o7')
option('c6', type: 'boolean', value: true, deprecated: 'o7')
option('o7', type: 'feature', value: 'enabled', deprecated: {'true': 'enabled', 'false': 'disabled'})
# A project option is replaced by a module option
option('o8', type: 'string', value: '', deprecated: 'python.platlibdir')
+option('p8', type: 'string', value: '', deprecated: 'python.platlibdir')
option('c8', type: 'string', value: '', deprecated: 'python.platlibdir')
diff --git a/test cases/common/247 deprecated option/test.json b/test cases/common/247 deprecated option/test.json
index 99b596669..a644b0405 100644
--- a/test cases/common/247 deprecated option/test.json
+++ b/test cases/common/247 deprecated option/test.json
@@ -51,6 +51,31 @@
"count": 1
},
{
+ "line": ".*DEPRECATION: Option 'p1' is deprecated",
+ "match": "re",
+ "count": 1
+ },
+ {
+ "line": ".*DEPRECATION: Option 'p2' value 'a' is deprecated",
+ "match": "re",
+ "count": 1
+ },
+ {
+ "line": ".*DEPRECATION: Option 'p3' value 'a' is replaced by 'c'",
+ "match": "re",
+ "count": 1
+ },
+ {
+ "line": ".*DEPRECATION: Option 'p4' value 'true' is replaced by 'enabled'",
+ "match": "re",
+ "count": 1
+ },
+ {
+ "line": ".*DEPRECATION: Option 'p5' value 'auto' is replaced by 'false'",
+ "match": "re",
+ "count": 1
+ },
+ {
"line": ".*DEPRECATION: Option 'c1' is deprecated",
"match": "re",
"count": 1