Consolidate tests for set with/without values

We currently test setting a symbol with a value even if it didn't
originally had one and vice versa. So there's no need to have separate
lists of symbols to test with. Just test everything we want to test
with each symbol.
This commit is contained in:
Gilles Peskine 2019-09-19 12:18:23 +02:00
parent 61695e70f8
commit fd7ad33ee9

View file

@ -125,20 +125,17 @@ def run_one(options, args):
with open(status_filename, 'w') as status_file: with open(status_filename, 'w') as status_file:
status_file.write('{}\n'.format(status)) status_file.write('{}\n'.format(status))
### A list of symbols to test with set and unset. ### A list of symbols to test with.
### This script currently tests what happens when you change a symbol from
### having a value to not having a value or vice versa. This is not
### necessarily useful behavior, and we may not consider it a bug if
### config.py stops handling that case correctly.
TEST_SYMBOLS = [ TEST_SYMBOLS = [
'CUSTOM_OPTION', 'CUSTOM_SYMBOL', # does not exist
'MBEDTLS_AES_C', 'MBEDTLS_AES_C', # set, no value
'MBEDTLS_MPI_MAX_SIZE', 'MBEDTLS_MPI_MAX_SIZE', # unset, has a value
'MBEDTLS_NO_UDBL_DIVISION', 'MBEDTLS_NO_UDBL_DIVISION', # unset, in "System support"
'MBEDTLS_PLATFORM_ZEROIZE_ALT', 'MBEDTLS_PLATFORM_ZEROIZE_ALT', # unset, in "Customisation configuration options"
]
### A list of symbols to test with set with a value.
TEST_SYMBOLS_WITH_VALUE = [
'CUSTOM_VALUE',
'MBEDTLS_AES_C',
'MBEDTLS_MPI_MAX_SIZE',
] ]
def run_all(options): def run_all(options):
@ -150,9 +147,6 @@ def run_all(options):
run_one(options, ['get', symbol]) run_one(options, ['get', symbol])
run_one(options, ['set', symbol]) run_one(options, ['set', symbol])
run_one(options, ['--force', 'set', symbol]) run_one(options, ['--force', 'set', symbol])
run_one(options, ['unset', symbol])
for symbol in TEST_SYMBOLS_WITH_VALUE:
run_one(options, ['get', symbol])
run_one(options, ['set', symbol, 'value']) run_one(options, ['set', symbol, 'value'])
run_one(options, ['--force', 'set', symbol, 'value']) run_one(options, ['--force', 'set', symbol, 'value'])
run_one(options, ['unset', symbol]) run_one(options, ['unset', symbol])