3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

test-runner: don't run duplicate tests

If the user provides duplicate tests in the list only append one
of them to the list. This can happen accidentally when using
glob matches.
This commit is contained in:
James Prestwood 2021-08-12 13:21:53 -07:00 committed by Denis Kenzior
parent 9a15a46df5
commit 30158fe89c

View File

@ -1013,15 +1013,17 @@ def build_test_list(args):
tests = [test_root + '/' + x for x in full_list[i:] \ tests = [test_root + '/' + x for x in full_list[i:] \
if x.startswith('test')] if x.startswith('test')]
elif os.path.exists(t): elif os.path.exists(t):
if t not in tests:
tests.append(t) tests.append(t)
elif os.path.exists(path): elif os.path.exists(path):
if path not in tests:
tests.append(path) tests.append(path)
else: else:
matches = glob(path) matches = glob(path)
if matches == []: if matches == []:
raise Exception("Could not find test %s" % t) raise Exception("Could not find test %s" % t)
tests.extend(matches) tests.extend(list(set(matches) - set(tests)))
return sorted(tests) return sorted(tests)