xref: /linux/scripts/kconfig/tests/transitional/__init__.py (revision 8a7c601e14576a22c2bbf7f67455ccf3f3d2737f)
1# SPDX-License-Identifier: GPL-2.0
2"""
3Test transitional symbol migration functionality for all Kconfig types.
4
5This tests that:
6- OLD_* options in existing .config cause NEW_* options to be set
7- OLD_* options are not written to the new .config file
8- NEW_* options appear in the new .config file with correct values
9- NEW_* options with defaults from transitional symbols are not prompted
10- All Kconfig types work correctly: bool, tristate, string, hex, int
11- User-set NEW values take precedence over conflicting OLD transitional values
12"""
13
14def test(conf):
15    # Run olddefconfig to process the migration with the initial config
16    assert conf.olddefconfig(dot_config='initial_config') == 0
17
18    # Check that the configuration matches expected output
19    assert conf.config_contains('expected_config')
20
21    # Test oldconfig to ensure symbols with transitional defaults are not prompted
22    assert conf.oldconfig(dot_config='initial_config', in_keys='n\n') == 0
23
24    # Except for when conditional default evaluates to 'no'
25    assert conf.stdout_contains('expected_stdout')
26