aboutsummaryrefslogtreecommitdiff
path: root/debug_info_test
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2020-06-24 15:45:15 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-25 18:34:08 +0000
commitad5e320d98f0101b5c094270d6f26dae981c1460 (patch)
treef757e2e15dc7c1d20d17f31b14e3d80baa7ad3da /debug_info_test
parent536aff5f6d015f840bafd6ea70774bbc6b3da6f3 (diff)
downloadtoolchain-utils-ad5e320d98f0101b5c094270d6f26dae981c1460.tar.gz
debug_info_test: replace whitelist with allowlist
This CL tweaks language to better reflect the intent that's meant to be conveyed, per go/chromium-project-code-inclusion . This change is meant to trivially be a local, functional nop; renaming extensions will be a later CL. BUG=chromium:1099035 TEST=CQ+1 Change-Id: Iaee8b96c54660b4ebb4363a230e768c3da3f885a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2265049 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: George Burgess <gbiv@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'debug_info_test')
-rw-r--r--debug_info_test/allowlist.py (renamed from debug_info_test/whitelist.py)27
-rw-r--r--debug_info_test/check_exist.py10
-rw-r--r--debug_info_test/check_ngcc.py6
-rw-r--r--debug_info_test/ngcc_dso_path.whitelist2
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/.*