Change uses of 'whitelist' to 'allowlist' in check_gn_headers.
To make the code a bit more inclusive ... Bug: 40713186 Change-Id: I2bac2ddcd56bc1e0de6c4761b53d8f193b8641d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6169387 Reviewed-by: Fumitoshi Ukai <ukai@google.com> Commit-Queue: Dirk Pranke <dpranke@google.com> Reviewed-by: Ben Pastene <bpastene@chromium.org> Cr-Commit-Position: refs/heads/main@{#1406519}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
b335e4cce4
commit
efbb751fc1
@ -175,9 +175,10 @@ def IsBuildClean(out_dir):
|
|||||||
print(e)
|
print(e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def ParseWhiteList(whitelist):
|
|
||||||
|
def ParseAllowlist(allowlist):
|
||||||
out = set()
|
out = set()
|
||||||
for line in whitelist.split('\n'):
|
for line in allowlist.split('\n'):
|
||||||
line = re.sub(r'#.*', '', line).strip()
|
line = re.sub(r'#.*', '', line).strip()
|
||||||
if line:
|
if line:
|
||||||
out.add(line)
|
out.add(line)
|
||||||
@ -214,8 +215,9 @@ def main():
|
|||||||
help='output directory of the build')
|
help='output directory of the build')
|
||||||
parser.add_argument('--json',
|
parser.add_argument('--json',
|
||||||
help='JSON output filename for missing headers')
|
help='JSON output filename for missing headers')
|
||||||
parser.add_argument('--whitelist', help='file containing whitelist')
|
parser.add_argument('--allowlist', help='file containing allowlist')
|
||||||
parser.add_argument('--skip-dirty-check', action='store_true',
|
parser.add_argument('--skip-dirty-check',
|
||||||
|
action='store_true',
|
||||||
help='skip checking whether the build is dirty')
|
help='skip checking whether the build is dirty')
|
||||||
parser.add_argument('--verbose', action='store_true',
|
parser.add_argument('--verbose', action='store_true',
|
||||||
help='print more diagnostic info')
|
help='print more diagnostic info')
|
||||||
@ -278,10 +280,10 @@ def main():
|
|||||||
if any((('/gen/' in i) for i in nonexisting)):
|
if any((('/gen/' in i) for i in nonexisting)):
|
||||||
PrintError('OUT_DIR looks wrong. You should build all there.')
|
PrintError('OUT_DIR looks wrong. You should build all there.')
|
||||||
|
|
||||||
if args.whitelist:
|
if args.allowlist:
|
||||||
whitelist = ParseWhiteList(open(args.whitelist).read())
|
allowlist = ParseAllowlist(open(args.allowlist).read())
|
||||||
missing -= whitelist
|
missing -= allowlist
|
||||||
nonexisting -= whitelist
|
nonexisting -= allowlist
|
||||||
|
|
||||||
missing = sorted(missing)
|
missing = sorted(missing)
|
||||||
nonexisting = sorted(nonexisting)
|
nonexisting = sorted(nonexisting)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Do not add files to this whitelist unless you are adding a new OS or
|
# Do not add files to this allowlist unless you are adding a new OS or
|
||||||
# changing the GN arguments on bots.
|
# changing the GN arguments on bots.
|
||||||
|
|
||||||
ash/accelerators/accelerator_table.h
|
ash/accelerators/accelerator_table.h
|
@ -51,7 +51,7 @@ gn_input = json.loads(r'''
|
|||||||
''')
|
''')
|
||||||
|
|
||||||
|
|
||||||
whitelist = r'''
|
allowlist = r'''
|
||||||
white-front.c
|
white-front.c
|
||||||
a/b/c/white-end.c # comment
|
a/b/c/white-end.c # comment
|
||||||
dir/white-both.c #more comment
|
dir/white-both.c #more comment
|
||||||
@ -85,8 +85,8 @@ class CheckGnHeadersTest(unittest.TestCase):
|
|||||||
])
|
])
|
||||||
self.assertEqual(headers, expected)
|
self.assertEqual(headers, expected)
|
||||||
|
|
||||||
def testWhitelist(self):
|
def testAllowlist(self):
|
||||||
output = check_gn_headers.ParseWhiteList(whitelist)
|
output = check_gn_headers.ParseAllowlist(allowlist)
|
||||||
expected = set([
|
expected = set([
|
||||||
'white-front.c',
|
'white-front.c',
|
||||||
'a/b/c/white-end.c',
|
'a/b/c/white-end.c',
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
".*isolate",
|
".*isolate",
|
||||||
".vpython",
|
".vpython",
|
||||||
"build/check_gn_headers.py",
|
"build/check_gn_headers.py",
|
||||||
"build/check_gn_headers_whitelist.txt",
|
"build/check_gn_headers_allowlist.txt",
|
||||||
"build/get_landmines.py",
|
"build/get_landmines.py",
|
||||||
"build/gn_helpers.py",
|
"build/gn_helpers.py",
|
||||||
"build/mac_toolchain.py",
|
"build/mac_toolchain.py",
|
||||||
|
@ -17,8 +17,8 @@ def main_run(args):
|
|||||||
os.path.join(common.SRC_DIR, 'build', 'check_gn_headers.py'),
|
os.path.join(common.SRC_DIR, 'build', 'check_gn_headers.py'),
|
||||||
'--out-dir',
|
'--out-dir',
|
||||||
args.build_dir,
|
args.build_dir,
|
||||||
'--whitelist',
|
'--allowlist',
|
||||||
os.path.join(common.SRC_DIR, 'build', 'check_gn_headers_whitelist.txt'),
|
os.path.join(common.SRC_DIR, 'build', 'check_gn_headers_allowlist.txt'),
|
||||||
'--json',
|
'--json',
|
||||||
tempfile_path,
|
tempfile_path,
|
||||||
'--verbose',
|
'--verbose',
|
||||||
|
Reference in New Issue
Block a user