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 <peress@chromium.org>
Change-Id: I8e6fa242921d30dfcdf79172b14c215b00e8d08e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2491431
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
This commit is contained in:
Yuval Peress 2020-10-21 23:01:39 -06:00 committed by Commit Bot
parent a5c40c2ee2
commit 80cf1a6e94
1 changed files with 9 additions and 2 deletions

View File

@ -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: