From 3b2d64b2a140a40175e5147cbe2881ad93de5223 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 10 Nov 2020 14:55:40 -0800 Subject: [PATCH] test: rename blacklist/whitelist in autotest scripts The options and variables are renamed to use block/allow terminology. Signed-off-by: Stephen Hemminger Acked-by: Luca Boccassi Signed-off-by: Thomas Monjalon --- app/test/autotest.py | 16 ++++++++-------- app/test/autotest_runner.py | 18 +++++++++--------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/test/autotest.py b/app/test/autotest.py index 9eef1efbe5..6ff2e71475 100644 --- a/app/test/autotest.py +++ b/app/test/autotest.py @@ -10,7 +10,7 @@ import sys def usage(): print("Usage: autotest.py [test app|test iso image] ", - "[target] [whitelist|-blacklist]") + "[target] [allow|-block]") if len(sys.argv) < 3: usage() @@ -18,18 +18,18 @@ if len(sys.argv) < 3: target = sys.argv[2] -test_whitelist = None -test_blacklist = None +test_allowlist = None +test_blocklist = None -# get blacklist/whitelist +# get blocklist/allowlist if len(sys.argv) > 3: testlist = sys.argv[3].split(',') testlist = [test.lower() for test in testlist] if testlist[0].startswith('-'): testlist[0] = testlist[0].lstrip('-') - test_blacklist = testlist + test_blocklist = testlist else: - test_whitelist = testlist + test_allowlist = testlist cmdline = "%s -c f" % (sys.argv[1]) @@ -39,8 +39,8 @@ print(cmdline) # processes, so make it 1, otherwise make it 4. ignored for non-parallel tests n_processes = 1 if "bsd" in target else 4 -runner = autotest_runner.AutotestRunner(cmdline, target, test_blacklist, - test_whitelist, n_processes) +runner = autotest_runner.AutotestRunner(cmdline, target, test_blocklist, + test_allowlist, n_processes) runner.parallel_tests = autotest_data.parallel_test_list[:] runner.non_parallel_tests = autotest_data.non_parallel_test_list[:] diff --git a/app/test/autotest_runner.py b/app/test/autotest_runner.py index 998fe57a55..8aa4d45569 100644 --- a/app/test/autotest_runner.py +++ b/app/test/autotest_runner.py @@ -188,14 +188,14 @@ class AutotestRunner: n_tests = 0 fails = 0 log_buffers = [] - blacklist = [] - whitelist = [] + blocklist = [] + allowlist = [] - def __init__(self, cmdline, target, blacklist, whitelist, n_processes): + def __init__(self, cmdline, target, blocklist, allowlist, n_processes): self.cmdline = cmdline self.target = target - self.blacklist = blacklist - self.whitelist = whitelist + self.blocklist = blocklist + self.allowlist = allowlist self.skipped = [] self.parallel_tests = [] self.non_parallel_tests = [] @@ -269,7 +269,7 @@ class AutotestRunner: self.csvwriter.writerow([test_name, test_result, result_str]) # this function checks individual test and decides if this test should be in - # the group by comparing it against whitelist/blacklist. it also checks if + # the group by comparing it against allowlist/blocklist. it also checks if # the test is compiled into the binary, and marks it as skipped if necessary def __filter_test(self, test): test_cmd = test["Command"] @@ -279,10 +279,10 @@ class AutotestRunner: if "_autotest" in test_id: test_id = test_id[:-len("_autotest")] - # filter out blacklisted/whitelisted tests - if self.blacklist and test_id in self.blacklist: + # filter out blocked/allowed tests + if self.blocklist and test_id in self.blocklist: return False - if self.whitelist and test_id not in self.whitelist: + if self.allowlist and test_id not in self.allowlist: return False # if test wasn't compiled in, remove it as well -- 2.20.1