diff options
-rw-r--r-- | debug_info_test/allowlist.py (renamed from debug_info_test/whitelist.py) | 27 | ||||
-rw-r--r-- | debug_info_test/check_exist.py | 10 | ||||
-rw-r--r-- | debug_info_test/check_ngcc.py | 6 | ||||
-rw-r--r-- | debug_info_test/ngcc_dso_path.whitelist | 2 |
4 files changed, 23 insertions, 22 deletions
diff --git a/debug_info_test/whitelist.py b/debug_info_test/allowlist.py index b53387a8..978b2370 100644 --- a/debug_info_test/whitelist.py +++ b/debug_info_test/allowlist.py @@ -3,12 +3,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -"""Whitelist functions.""" +"""Allowlist functions.""" from __future__ import print_function -import os import glob +import os import re @@ -18,20 +18,20 @@ import re # # The performance bottleneck of this script is readelf. Unless this becomes # slower than readelf, don't waste time here. -def is_whitelisted(list_name, pattern): - """Check whether the given pattern is specified in the whitelist. +def is_allowlisted(list_name, pattern): + """Check whether the given pattern is specified in the allowlist. Args: - list_name: name of the whitelist. + list_name: name of the allowlist. pattern: the target string. Returns: True if matched otherwise False. """ - return pattern and whitelists[list_name].match(pattern) + return pattern and allowlists[list_name].match(pattern) -def prepare_whitelist(patterns): +def prepare_allowlist(patterns): """Join and compile the re patterns. Args: @@ -43,16 +43,17 @@ def prepare_whitelist(patterns): return re.compile('|'.join(patterns)) -def load_whitelists(dirname): - """Load whitelists under dirname. +# FIXME: s/whitelist/allowlist/ in the file extension. +def load_allowlists(dirname): + """Load allowlists under dirname. - A whitelist ends with .whitelist. + An allowlist ends with .whitelist. Args: dirname: path to the dir. Returns: - A dictionary of 'filename' -> whitelist matcher. + A dictionary of 'filename' -> allowlist matcher. """ wlist = {} for fn in glob.glob(os.path.join(dirname, '*.whitelist')): @@ -61,8 +62,8 @@ def load_whitelists(dirname): patterns = f.read().splitlines() patterns = [l for l in patterns if l != ''] patterns = [l for l in patterns if l[0] != '#'] - wlist[key] = prepare_whitelist(patterns) + wlist[key] = prepare_allowlist(patterns) return wlist -whitelists = load_whitelists(os.path.dirname(__file__)) +allowlists = load_allowlists(os.path.dirname(__file__)) diff --git a/debug_info_test/check_exist.py b/debug_info_test/check_exist.py index dbb89127..f2cc7c6b 100644 --- a/debug_info_test/check_exist.py +++ b/debug_info_test/check_exist.py @@ -10,7 +10,7 @@ from __future__ import print_function import os import subprocess -from whitelist import is_whitelisted +from allowlist import is_allowlisted def check_debug_info(dso_path, readelf_content): @@ -24,8 +24,8 @@ def check_debug_info(dso_path, readelf_content): True if debug info section exists, otherwise False. """ - # Return True if it is whitelisted - if is_whitelisted('exist_debug_info', dso_path): + # Return True if it is allowlisted + if is_allowlisted('exist_debug_info', dso_path): return True for l in readelf_content: @@ -46,8 +46,8 @@ def check_producer(dso_path, readelf_content): Notice: If no compile unit in DSO, also return True. """ - # Return True if it is whitelisted - if is_whitelisted('exist_producer', dso_path): + # Return True if it is allowlisted + if is_allowlisted('exist_producer', dso_path): return True # Indicate if there is a producer under each cu diff --git a/debug_info_test/check_ngcc.py b/debug_info_test/check_ngcc.py index 501bb988..c86c220a 100644 --- a/debug_info_test/check_ngcc.py +++ b/debug_info_test/check_ngcc.py @@ -7,7 +7,7 @@ from __future__ import print_function -from whitelist import is_whitelisted +from allowlist import is_allowlisted def not_by_gcc(dso_path, producer, comp_path): @@ -21,10 +21,10 @@ def not_by_gcc(dso_path, producer, comp_path): Returns: False if compiled by gcc otherwise True. """ - if is_whitelisted('ngcc_comp_path', comp_path): + if is_allowlisted('ngcc_comp_path', comp_path): return True - if is_whitelisted('ngcc_dso_path', dso_path): + if is_allowlisted('ngcc_dso_path', dso_path): return True return 'GNU C' not in producer diff --git a/debug_info_test/ngcc_dso_path.whitelist b/debug_info_test/ngcc_dso_path.whitelist index 8d63a521..858465e0 100644 --- a/debug_info_test/ngcc_dso_path.whitelist +++ b/debug_info_test/ngcc_dso_path.whitelist @@ -1,5 +1,5 @@ # DSOs specified here are not CrOS packages compiled within CrOS SDK. -# CrOS packages should be whitelisted in *_comp_path.whitelist +# CrOS packages should be allowlisted in *_comp_path.allowlist # modules we don't care: .*/binutils/.* .*/binutils-bin/.* |