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>
diff --git a/debug_info_test/whitelist.py b/debug_info_test/allowlist.py
similarity index 68%
rename from debug_info_test/whitelist.py
rename to debug_info_test/allowlist.py
index b53387a..978b237 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 @@
 #
 # 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 @@
   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 @@
       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 dbb8912..f2cc7c6 100644
--- a/debug_info_test/check_exist.py
+++ b/debug_info_test/check_exist.py
@@ -10,7 +10,7 @@
 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 @@
     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 @@
     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 501bb98..c86c220 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 @@
   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 8d63a52..858465e 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/.*