mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1697772 - Replace uses of "whitelist" with "allowlist" in Talos r=perftest-reviewers,sparky
Differential Revision: https://phabricator.services.mozilla.com/D108163
This commit is contained in:
parent
6e4c1b1588
commit
9e3ef144c3
@ -15,7 +15,7 @@ KEY_XRE = "{xre}"
|
||||
DEFAULT_DURATION = 100.0
|
||||
|
||||
|
||||
class Whitelist:
|
||||
class Allowlist:
|
||||
# we need to find the root dir of the profile at runtime
|
||||
PRE_PROFILE = ""
|
||||
|
||||
@ -46,8 +46,8 @@ class Whitelist:
|
||||
with open(filename, "r") as fHandle:
|
||||
temp = json.load(fHandle)
|
||||
|
||||
for whitelist_name in temp:
|
||||
self.listmap[whitelist_name.lower()] = temp[whitelist_name]
|
||||
for allowlist_name in temp:
|
||||
self.listmap[allowlist_name.lower()] = temp[allowlist_name]
|
||||
|
||||
except IOError as e:
|
||||
print("%s: %s" % (e.filename, e.strerror))
|
||||
@ -170,7 +170,7 @@ class Whitelist:
|
||||
print("TEST-UNEXPECTED-FAIL | %s | %s" % (self.test_name, error_msg))
|
||||
|
||||
# Note that we don't store dependent libs in listmap. This makes
|
||||
# save_baseline cleaner. Since a baseline whitelist should not include
|
||||
# save_baseline cleaner. Since a baseline allowlist should not include
|
||||
# the dependent_libs, we would need to filter them out if everything was
|
||||
# stored in the same dict.
|
||||
def load_dependent_libs(self):
|
@ -8,7 +8,7 @@ from __future__ import absolute_import, print_function
|
||||
import os
|
||||
import re
|
||||
from talos import utils
|
||||
from talos import whitelist
|
||||
from talos import allowlist
|
||||
|
||||
from collections import OrderedDict
|
||||
import six
|
||||
@ -60,7 +60,7 @@ NAME_SUBSTITUTIONS = OrderedDict(
|
||||
|
||||
TUPLE_EVENT_SOURCE_INDEX = 1
|
||||
TUPLE_FILENAME_INDEX = 2
|
||||
WHITELIST_FILENAME = os.path.join(SCRIPT_DIR, "mtio-whitelist.json")
|
||||
ALLOWLIST_FILENAME = os.path.join(SCRIPT_DIR, "mtio-allowlist.json")
|
||||
|
||||
|
||||
def parse(logfilename, data):
|
||||
@ -155,15 +155,15 @@ def main(argv):
|
||||
print("Log parsing failed")
|
||||
return 1
|
||||
|
||||
wl = whitelist.Whitelist(
|
||||
wl = allowlist.Allowlist(
|
||||
test_name="mainthreadio",
|
||||
paths={"{xre}": argv[3]},
|
||||
path_substitutions=PATH_SUBSTITUTIONS,
|
||||
name_substitutions=NAME_SUBSTITUTIONS,
|
||||
event_sources=["PoisonIOInterposer"],
|
||||
)
|
||||
if not wl.load(WHITELIST_FILENAME):
|
||||
print("Failed to load whitelist")
|
||||
if not wl.load(ALLOWLIST_FILENAME):
|
||||
print("Failed to load allowlist")
|
||||
return 1
|
||||
|
||||
wl.filter(data, TUPLE_FILENAME_INDEX)
|
||||
|
@ -295,11 +295,11 @@ def updateStage(row, stage):
|
||||
return stage
|
||||
|
||||
|
||||
def loadWhitelist(filename):
|
||||
def loadAllowlist(filename):
|
||||
if not filename:
|
||||
return
|
||||
if not os.path.exists(filename):
|
||||
print("Warning: xperf whitelist %s was not found" % filename)
|
||||
print("Warning: xperf allowlist %s was not found" % filename)
|
||||
return
|
||||
lines = open(filename).readlines()
|
||||
# Expand paths
|
||||
@ -319,17 +319,17 @@ def loadWhitelist(filename):
|
||||
return (files, dirs, recur)
|
||||
|
||||
|
||||
def checkWhitelist(filename, whitelist):
|
||||
if not whitelist:
|
||||
def checkAllowlist(filename, allowlist):
|
||||
if not allowlist:
|
||||
return False
|
||||
if filename in whitelist[0]:
|
||||
if filename in allowlist[0]:
|
||||
return True
|
||||
if os.path.dirname(filename) in whitelist[1]:
|
||||
if os.path.dirname(filename) in allowlist[1]:
|
||||
return True
|
||||
head = filename
|
||||
while len(head) > 3: # Length 3 implies root directory, e.g. C:\
|
||||
head, tail = os.path.split(head)
|
||||
if head in whitelist[2]:
|
||||
if head in allowlist[2]:
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -341,7 +341,7 @@ def etlparser(
|
||||
approot=None,
|
||||
configFile=None,
|
||||
outputFile=None,
|
||||
whitelist_file=None,
|
||||
allowlist_file=None,
|
||||
error_filename=None,
|
||||
all_stages=False,
|
||||
all_threads=False,
|
||||
@ -393,19 +393,19 @@ def etlparser(
|
||||
else:
|
||||
print(output)
|
||||
|
||||
whitelist = loadWhitelist(whitelist_file)
|
||||
allowlist = loadAllowlist(allowlist_file)
|
||||
|
||||
header = "filename, tid, stage, readcount, readbytes, writecount," " writebytes"
|
||||
outFile.write(header + "\n")
|
||||
|
||||
# Filter out stages, threads, and whitelisted files that we're not
|
||||
# Filter out stages, threads, and allowlisted files that we're not
|
||||
# interested in
|
||||
filekeys = [
|
||||
x
|
||||
for x in six.iterkeys(files)
|
||||
if (all_stages or x[2] == stages[0])
|
||||
and (all_threads or x[1].endswith("(main)"))
|
||||
and (all_stages and x[2] != stages[0] or not checkWhitelist(x[0], whitelist))
|
||||
and (all_stages and x[2] != stages[0] or not checkAllowlist(x[0], allowlist))
|
||||
]
|
||||
if debug:
|
||||
# in debug, we want stages = [startup+normal] and all threads, not just (main)
|
||||
@ -417,7 +417,7 @@ def etlparser(
|
||||
and (
|
||||
all_stages
|
||||
and x[2] not in [stages[0], stages[1]]
|
||||
or not checkWhitelist(x[0], whitelist)
|
||||
or not checkAllowlist(x[0], allowlist)
|
||||
)
|
||||
]
|
||||
else:
|
||||
@ -444,19 +444,19 @@ def etlparser(
|
||||
|
||||
# We still like to have the outputfile to record the raw data, now
|
||||
# filter out acceptable files/ranges
|
||||
whitelist_path = None
|
||||
allowlist_path = None
|
||||
wl_temp = {}
|
||||
dirname = os.path.dirname(__file__)
|
||||
if os.path.exists(os.path.join(dirname, "xperf_whitelist.json")):
|
||||
whitelist_path = os.path.join(dirname, "xperf_whitelist.json")
|
||||
if os.path.exists(os.path.join(dirname, "xperf_allowlist.json")):
|
||||
allowlist_path = os.path.join(dirname, "xperf_allowlist.json")
|
||||
elif os.path.exists(os.path.join(dirname, "xtalos")) and os.path.exists(
|
||||
os.path.join(dirname, "xtalos", "xperf_whitelist.json")
|
||||
os.path.join(dirname, "xtalos", "xperf_allowlist.json")
|
||||
):
|
||||
whitelist_path = os.path.join(dirname, "xtalos", "xperf_whitelist.json")
|
||||
allowlist_path = os.path.join(dirname, "xtalos", "xperf_allowlist.json")
|
||||
|
||||
wl_temp = {}
|
||||
if whitelist_path:
|
||||
with open(whitelist_path, "r") as fHandle:
|
||||
if allowlist_path:
|
||||
with open(allowlist_path, "r") as fHandle:
|
||||
wl_temp = json.load(fHandle)
|
||||
|
||||
# Approot is the full path where the application is located at
|
||||
@ -582,7 +582,7 @@ def etlparser_from_config(config_file, **kwargs):
|
||||
"outputFile": "etl_output.csv",
|
||||
"processID": None,
|
||||
"approot": None,
|
||||
"whitelist_file": None,
|
||||
"allowlist_file": None,
|
||||
"error_filename": None,
|
||||
"all_stages": False,
|
||||
"all_threads": False,
|
||||
@ -628,7 +628,7 @@ def main(args=sys.argv[1:]):
|
||||
args.approot,
|
||||
args.configFile,
|
||||
args.outputFile,
|
||||
args.whitelist_file,
|
||||
args.allowlist_file,
|
||||
args.error_filename,
|
||||
args.all_stages,
|
||||
args.all_threads,
|
||||
|
@ -112,11 +112,11 @@ class XtalosOptions(argparse.ArgumentParser):
|
||||
|
||||
self.add_argument(
|
||||
"-w",
|
||||
"--whitelist-file",
|
||||
dest="whitelist_file",
|
||||
help="Name of whitelist file",
|
||||
"--allowlist-file",
|
||||
dest="allowlist_file",
|
||||
help="Name of allowlist file",
|
||||
)
|
||||
defaults["whitelist_file"] = None
|
||||
defaults["allowlist_file"] = None
|
||||
|
||||
self.add_argument(
|
||||
"-i",
|
||||
|
@ -331,11 +331,7 @@ avoid-blacklist-and-whitelist:
|
||||
- testing/raptor/raptor/control_server.py
|
||||
- testing/raptor/raptor/manifest.py
|
||||
- testing/specialpowers/content/SpecialPowersChild.jsm
|
||||
- testing/talos/talos/mainthreadio.py
|
||||
- testing/talos/talos/tests/devtools/addon/content/pages/custom/debugger/static/js/main.js
|
||||
- testing/talos/talos/whitelist.py
|
||||
- testing/talos/talos/xtalos/etlparser.py
|
||||
- testing/talos/talos/xtalos/xtalos.py
|
||||
- testing/web-platform/tests/common/security-features/README.md
|
||||
- testing/web-platform/tests/docs/writing-tests/general-guidelines.md
|
||||
- testing/web-platform/tests/docs/writing-tests/lint-tool.md
|
||||
|
Loading…
Reference in New Issue
Block a user