summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2020-10-21 23:01:39 -0600
committerCommit Bot <commit-bot@chromium.org>2020-10-22 22:47:10 +0000
commit80cf1a6e9453a3eb00bb316e6b519df238db0f9f (patch)
tree1e630df0ba377a2fa5b58a2788463f14464cd4e8
parenta5c40c2ee2096ed2e17abd23fb60df564397a6f9 (diff)
downloadchrome-ec-80cf1a6e9453a3eb00bb316e6b519df238db0f9f.tar.gz
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>
-rwxr-xr-xutil/config_option_check.py11
1 files 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: