summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-02-24 16:41:59 +0100
committerRichard Braun <rbraun@sceen.net>2018-02-24 16:53:44 +0100
commitda14fecb4d20547b83c9ae65c682c8466fea0149 (patch)
treed8dc33cd74acc2b7e4779e1e233cff5aebc2d962
parentc17860bc3eb78c800a372264dfd4835fc6dd2252 (diff)
tools/build_configs.py: add TODO entry, style fixes
-rwxr-xr-xtools/build_configs.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/tools/build_configs.py b/tools/build_configs.py
index 416ddaa..073fc42 100755
--- a/tools/build_configs.py
+++ b/tools/build_configs.py
@@ -20,26 +20,22 @@ def print_fn(*args):
for arg in args:
print(arg)
-
def quote_if_needed(value):
if not value.isdigit() and value != 'y' and value != 'n':
value = '"%s"' % value
return value
-
def gen_configs_list(options_dict):
'Generate a list of all possible combinations of options.'
names = options_dict.keys()
product = itertools.product(*options_dict.values())
return [dict(zip(names, x)) for x in product]
-
def gen_configs_values_str(options_dict):
'Generate a list of all possible combinations of options as strings.'
return [' '.join(x.values()) for x in gen_configs_list(options_dict)]
-
def gen_cc_options_list(options_dict):
'''
Does the same as gen_configs_values_str() but adds the -Werror option
@@ -47,7 +43,6 @@ def gen_cc_options_list(options_dict):
'''
return ['{} -Werror'.format(x) for x in gen_configs_values_str(options_dict)]
-
def gen_exclusive_boolean_filter(args):
enabled_option, options_list = args
option_filter = dict()
@@ -62,7 +57,6 @@ def gen_exclusive_boolean_filter(args):
return option_filter
-
def gen_exclusive_boolean_filters_list(options_list, all_disabled=False):
'''
Generate a list of passing filters on a list of boolean options.
@@ -79,7 +73,6 @@ def gen_exclusive_boolean_filters_list(options_list, all_disabled=False):
return list(map(gen_exclusive_boolean_filter, option_and_options))
-
# Dictionary of compiler options.
#
# Each entry describes a single compiler option. The key is mostly ignored
@@ -117,6 +110,7 @@ large_options_dict.update({
'CONFIG_THREAD_STACK_GUARD': ['y', 'n'],
})
+# TODO Generate this list from test/test_*.c
test_list = [
'CONFIG_TEST_MODULE_MUTEX',
'CONFIG_TEST_MODULE_MUTEX_PI',
@@ -178,16 +172,13 @@ blocking_filters_list = [
},
]
-
def gen_config_line(config_entry):
name, value = config_entry
return '%s=%s\n' % (name, quote_if_needed(value))
-
def gen_config_content(config_dict):
return map(gen_config_line, config_dict.items())
-
def test_config_run(command, check, buildlog):
buildlog.writelines(['$ %s\n' % command])
buildlog.flush()
@@ -199,7 +190,6 @@ def test_config_run(command, check, buildlog):
return subprocess.call(command.split(), stdout=buildlog,
stderr=subprocess.STDOUT)
-
def test_config(args):
'This function is run in multiprocessing.Pool workers.'
topbuilddir, config_dict = args
@@ -233,7 +223,6 @@ def test_config(args):
return [retval, buildtree]
-
def check_filter(config_dict, filter_dict):
'Return true if a filter completely matches a configuration.'
for name, value in filter_dict.items():
@@ -249,7 +238,6 @@ def check_filter(config_dict, filter_dict):
return True
-
def check_filter_relevant(config_dict, filter_dict):
for name, _ in filter_dict.items():
if name in config_dict:
@@ -257,7 +245,6 @@ def check_filter_relevant(config_dict, filter_dict):
return False
-
def check_filters_list_relevant(config_dict, filters_list):
for filter_dict in filters_list:
if check_filter_relevant(config_dict, filter_dict):
@@ -265,7 +252,6 @@ def check_filters_list_relevant(config_dict, filters_list):
return False
-
def check_passing_filters(args):
'''
If the given filters list is irrelevant, i.e. it applies to none of
@@ -285,7 +271,6 @@ def check_passing_filters(args):
return False
-
def check_blocking_filters(args):
'Return true if a configuration passes all the given filters.'
config_dict, filters_list = args
@@ -296,7 +281,6 @@ def check_blocking_filters(args):
return True
-
def filter_configs_list(configs_list, passing, blocking):
configs_and_filters = [(x, passing) for x in configs_list]
configs_list = [x[0] for x in filter(check_passing_filters,
@@ -378,6 +362,5 @@ def main():
finally:
sys.exit(len(failures) != 0)
-
if __name__ == '__main__':
main()