diff options
| author | Marvin Scholz <epirat07@gmail.com> | 2025-04-02 00:13:44 +0200 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2025-04-09 16:32:20 +0300 |
| commit | b578f7035e8123be5ba0fc2afdbcacd34b67049f (patch) | |
| tree | e68b110de176a1ac00a64b86bcef644cdc1fba9e /test cases/common | |
| parent | 677c98bb60c1e3d2289fd37a1c43efc09b1d50eb (diff) | |
| download | meson-b578f7035e8123be5ba0fc2afdbcacd34b67049f.tar.gz | |
tests: enhance deprecated options test
This actually tests the handling of deprecated options
when passed to meson instead of just as default_options.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'test cases/common')
| -rw-r--r-- | test cases/common/247 deprecated option/meson.build | 6 | ||||
| -rw-r--r-- | test cases/common/247 deprecated option/meson_options.txt | 8 | ||||
| -rw-r--r-- | test cases/common/247 deprecated option/test.json | 50 |
3 files changed, 64 insertions, 0 deletions
diff --git a/test cases/common/247 deprecated option/meson.build b/test cases/common/247 deprecated option/meson.build index 4c734eefb..60e6f9650 100644 --- a/test cases/common/247 deprecated option/meson.build +++ b/test cases/common/247 deprecated option/meson.build @@ -11,10 +11,16 @@ project('deprecated options', ) assert(get_option('o1') == false) +assert(get_option('c1') == false) assert(get_option('o2') == ['a', 'b']) +assert(get_option('c2') == ['a', 'b']) assert(get_option('o3') == ['c', 'b']) +assert(get_option('c3') == ['c', 'b']) assert(get_option('o4').enabled()) +assert(get_option('c4').enabled()) assert(get_option('o5') == false) +assert(get_option('c5') == false) assert(get_option('o6') == 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 88cd8aa51..6e8d14cbb 100644 --- a/test cases/common/247 deprecated option/meson_options.txt +++ b/test cases/common/247 deprecated option/meson_options.txt @@ -1,23 +1,31 @@ # Option fully deprecated, it warns when any value is set. option('o1', 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('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('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('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('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('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('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 c2f2ca325..99b596669 100644 --- a/test cases/common/247 deprecated option/test.json +++ b/test cases/common/247 deprecated option/test.json @@ -1,4 +1,29 @@ { + "matrix": { + "options": { + "c1": [ + { "val": "false" } + ], + "c2": [ + { "val": "a,b" } + ], + "c3": [ + { "val": "a,b" } + ], + "c4": [ + { "val": "true" } + ], + "c5": [ + { "val": "auto" } + ], + "c6": [ + { "val": "false" } + ], + "c8": [ + { "val": "/foo" } + ] + } + }, "stdout": [ { "line": ".*DEPRECATION: Option 'o1' is deprecated", @@ -24,6 +49,31 @@ "line": ".*DEPRECATION: Option 'o5' value 'auto' is replaced by 'false'", "match": "re", "count": 1 + }, + { + "line": ".*DEPRECATION: Option 'c1' is deprecated", + "match": "re", + "count": 1 + }, + { + "line": ".*DEPRECATION: Option 'c2' value 'a' is deprecated", + "match": "re", + "count": 1 + }, + { + "line": ".*DEPRECATION: Option 'c3' value 'a' is replaced by 'c'", + "match": "re", + "count": 1 + }, + { + "line": ".*DEPRECATION: Option 'c4' value 'true' is replaced by 'enabled'", + "match": "re", + "count": 1 + }, + { + "line": ".*DEPRECATION: Option 'c5' value 'auto' is replaced by 'false'", + "match": "re", + "count": 1 } ] } |
