From 80cf1a6e9453a3eb00bb316e6b519df238db0f9f Mon Sep 17 00:00:00 2001 From: Yuval Peress Date: Wed, 21 Oct 2020 23:01:39 -0600 Subject: Allow zephyr/ CONFIG_ options not found in include/config.h This is needed because Zephyr defines a lot of configs using Kconfig. As such, shims defined under the zephyr/ directory will reference these config values which are not defined under platform/ec BRANCH=none BUG=none TEST=manually tested different config values Signed-off-by: Yuval Peress Change-Id: I8e6fa242921d30dfcdf79172b14c215b00e8d08e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2491431 Reviewed-by: Paul Fagerburg Reviewed-by: Jett Rink --- util/config_option_check.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/util/config_option_check.py b/util/config_option_check.py index f4262430aa..6b6d3c0bc9 100755 --- a/util/config_option_check.py +++ b/util/config_option_check.py @@ -52,6 +52,12 @@ CONFIG_FILE = 'include/config.h' # Specific files which the checker should ignore. ALLOWLIST = [CONFIG_FILE, 'util/config_option_check.py'] +# Specific directories which the checker should ignore. +ALLOW_PATTERN = re.compile('zephyr/.*') + +# Specific CONFIG_* flags which the checker should ignore. +ALLOWLIST_CONFIGS = ['CONFIG_ZTEST'] + def obtain_current_config_options(): """Obtains current config options from include/config.h. @@ -158,7 +164,8 @@ def print_missing_config_options(hunks, config_options): for h in hunks: for l in h.lines: # Check for the existence of a CONFIG_* in the line. - match = config_option_re.findall(l.string) + match = filter(lambda opt: opt in ALLOWLIST_CONFIGS, + config_option_re.findall(l.string)) if not match: continue @@ -304,7 +311,7 @@ def get_hunks(): match = filename_re.search(line) if match: filename = match.groups(1)[0] - if filename in ALLOWLIST: + if filename in ALLOWLIST or ALLOW_PATTERN.match(filename): # Skip the file if it's allowlisted. current_state = state.NEW_FILE else: -- cgit v1.2.1