CONFIGURATION!
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Test transitional symbols for config migration with all Kconfig types
|
||||
|
||||
# Enable module support for tristate testing
|
||||
config MODULES
|
||||
bool "Enable loadable module support"
|
||||
modules
|
||||
default y
|
||||
|
||||
# Basic migration tests for all types
|
||||
config NEW_BOOL
|
||||
bool "New bool option"
|
||||
default OLD_BOOL
|
||||
|
||||
config OLD_BOOL
|
||||
bool
|
||||
transitional
|
||||
|
||||
config NEW_TRISTATE
|
||||
tristate "New tristate option"
|
||||
default OLD_TRISTATE
|
||||
|
||||
config OLD_TRISTATE
|
||||
tristate
|
||||
transitional
|
||||
|
||||
config NEW_STRING
|
||||
string "New string option"
|
||||
default OLD_STRING
|
||||
|
||||
config OLD_STRING
|
||||
string
|
||||
transitional
|
||||
|
||||
config NEW_HEX
|
||||
hex "New hex option"
|
||||
default OLD_HEX
|
||||
|
||||
config OLD_HEX
|
||||
hex
|
||||
transitional
|
||||
|
||||
config NEW_INT
|
||||
int "New int option"
|
||||
default OLD_INT
|
||||
|
||||
config OLD_INT
|
||||
int
|
||||
transitional
|
||||
|
||||
# Precedence tests for all types
|
||||
config NEW_BOOL_PRECEDENCE
|
||||
bool "New bool option with precedence"
|
||||
default OLD_BOOL_PRECEDENCE
|
||||
|
||||
config OLD_BOOL_PRECEDENCE
|
||||
bool
|
||||
transitional
|
||||
|
||||
config NEW_STRING_PRECEDENCE
|
||||
string "New string option with precedence"
|
||||
default OLD_STRING_PRECEDENCE
|
||||
|
||||
config OLD_STRING_PRECEDENCE
|
||||
string
|
||||
transitional
|
||||
|
||||
config NEW_TRISTATE_PRECEDENCE
|
||||
tristate "New tristate option with precedence"
|
||||
default OLD_TRISTATE_PRECEDENCE
|
||||
|
||||
config OLD_TRISTATE_PRECEDENCE
|
||||
tristate
|
||||
transitional
|
||||
|
||||
config NEW_HEX_PRECEDENCE
|
||||
hex "New hex option with precedence"
|
||||
default OLD_HEX_PRECEDENCE
|
||||
|
||||
config OLD_HEX_PRECEDENCE
|
||||
hex
|
||||
transitional
|
||||
|
||||
config NEW_INT_PRECEDENCE
|
||||
int "New int option with precedence"
|
||||
default OLD_INT_PRECEDENCE
|
||||
|
||||
config OLD_INT_PRECEDENCE
|
||||
int
|
||||
transitional
|
||||
|
||||
# Test that help sections are allowed for transitional symbols
|
||||
config OLD_WITH_HELP
|
||||
bool
|
||||
transitional
|
||||
help
|
||||
This transitional symbol has a help section to validate that help is allowed.
|
||||
|
||||
# Test that we can set something to =n via transitional symbol
|
||||
config NEW_DISABLED
|
||||
tristate "Check for setting to disabled"
|
||||
default OLD_DISABLED
|
||||
|
||||
config OLD_DISABLED
|
||||
tristate
|
||||
transitional
|
||||
|
||||
# Test that a potential new value disappears if it lacks a prompt
|
||||
config NEW_DISABLED_UNSAVED
|
||||
tristate
|
||||
default OLD_DISABLED
|
||||
|
||||
config OLD_DISABLED_UNSAVED
|
||||
tristate
|
||||
transitional
|
||||
|
||||
# Test conditional default: transitional value should not prevent prompting
|
||||
# when default visibility makes the expression evaluate to 'no'
|
||||
config DEPENDENCY_TEST
|
||||
bool "Dependency for testing"
|
||||
default n
|
||||
|
||||
config NEW_CONDITIONAL_DEFAULT
|
||||
bool "New option with conditional default"
|
||||
default OLD_CONDITIONAL_DEFAULT if DEPENDENCY_TEST
|
||||
|
||||
config OLD_CONDITIONAL_DEFAULT
|
||||
bool
|
||||
transitional
|
||||
|
||||
config REGULAR_OPTION
|
||||
bool "Regular option"
|
||||
@@ -0,0 +1,25 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
"""
|
||||
Test transitional symbol migration functionality for all Kconfig types.
|
||||
|
||||
This tests that:
|
||||
- OLD_* options in existing .config cause NEW_* options to be set
|
||||
- OLD_* options are not written to the new .config file
|
||||
- NEW_* options appear in the new .config file with correct values
|
||||
- NEW_* options with defaults from transitional symbols are not prompted
|
||||
- All Kconfig types work correctly: bool, tristate, string, hex, int
|
||||
- User-set NEW values take precedence over conflicting OLD transitional values
|
||||
"""
|
||||
|
||||
def test(conf):
|
||||
# Run olddefconfig to process the migration with the initial config
|
||||
assert conf.olddefconfig(dot_config='initial_config') == 0
|
||||
|
||||
# Check that the configuration matches expected output
|
||||
assert conf.config_contains('expected_config')
|
||||
|
||||
# Test oldconfig to ensure symbols with transitional defaults are not prompted
|
||||
assert conf.oldconfig(dot_config='initial_config', in_keys='n\n') == 0
|
||||
|
||||
# Except for when conditional default evaluates to 'no'
|
||||
assert conf.stdout_contains('expected_stdout')
|
||||
@@ -0,0 +1,15 @@
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_NEW_BOOL=y
|
||||
CONFIG_NEW_TRISTATE=m
|
||||
CONFIG_NEW_STRING="test string"
|
||||
CONFIG_NEW_HEX=0x1234
|
||||
CONFIG_NEW_INT=42
|
||||
# CONFIG_NEW_BOOL_PRECEDENCE is not set
|
||||
CONFIG_NEW_STRING_PRECEDENCE="user value"
|
||||
CONFIG_NEW_TRISTATE_PRECEDENCE=y
|
||||
CONFIG_NEW_HEX_PRECEDENCE=0xABCD
|
||||
CONFIG_NEW_INT_PRECEDENCE=100
|
||||
# CONFIG_NEW_DISABLED is not set
|
||||
# CONFIG_DEPENDENCY_TEST is not set
|
||||
# CONFIG_NEW_CONDITIONAL_DEFAULT is not set
|
||||
# CONFIG_REGULAR_OPTION is not set
|
||||
@@ -0,0 +1 @@
|
||||
New option with conditional default (NEW_CONDITIONAL_DEFAULT) [N/y/?] (NEW) n
|
||||
@@ -0,0 +1,20 @@
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_OLD_BOOL=y
|
||||
CONFIG_OLD_TRISTATE=m
|
||||
CONFIG_OLD_STRING="test string"
|
||||
CONFIG_OLD_HEX=0x1234
|
||||
CONFIG_OLD_INT=42
|
||||
# CONFIG_NEW_BOOL_PRECEDENCE is not set
|
||||
CONFIG_OLD_BOOL_PRECEDENCE=y
|
||||
CONFIG_NEW_STRING_PRECEDENCE="user value"
|
||||
CONFIG_OLD_STRING_PRECEDENCE="old value"
|
||||
CONFIG_NEW_TRISTATE_PRECEDENCE=y
|
||||
CONFIG_OLD_TRISTATE_PRECEDENCE=m
|
||||
CONFIG_NEW_HEX_PRECEDENCE=0xABCD
|
||||
CONFIG_OLD_HEX_PRECEDENCE=0x5678
|
||||
CONFIG_NEW_INT_PRECEDENCE=100
|
||||
CONFIG_OLD_INT_PRECEDENCE=200
|
||||
# CONFIG_OLD_DISABLED is not set
|
||||
# CONFIG_OLD_DISABLED_UNSAVED is not set
|
||||
# CONFIG_DEPENDENCY_TEST is not set
|
||||
CONFIG_OLD_CONDITIONAL_DEFAULT=y
|
||||
Reference in New Issue
Block a user