diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2017-06-01 15:26:48 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-06-03 13:55:41 +0200 |
commit | 5b60600b32fa9d4c4842fcb66d6f2986410c0af9 (patch) | |
tree | e0c8f011223e3e93df473cc651079d9713615493 /selftest/subunithelper.py | |
parent | b6201407a346a376e215f4303e55bbdf8febd5df (diff) | |
download | samba-5b60600b32fa9d4c4842fcb66d6f2986410c0af9.tar.gz |
selftest: use an additional directory of knownfail/flapping files
This makes it easier to add a temporary knownfail to cover a patch
series.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Jun 3 13:55:41 CEST 2017 on sn-devel-144
Diffstat (limited to 'selftest/subunithelper.py')
-rw-r--r-- | selftest/subunithelper.py | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py index c17036defba..fab7d6f0b41 100644 --- a/selftest/subunithelper.py +++ b/selftest/subunithelper.py @@ -20,6 +20,7 @@ __all__ = ['parse_results'] import datetime import re import sys +import os from samba import subunit from samba.subunit.run import TestProtocolClient from samba.subunit import iso8601 @@ -228,21 +229,33 @@ class SubunitOps(TestProtocolClient,TestsuiteEnabledTestResult): self._stream.write(msg) -def read_test_regexes(name): +def read_test_regexes(*names): ret = {} - f = open(name, 'r') - try: - for l in f: - l = l.strip() - if l == "" or l[0] == "#": - continue - if "#" in l: - (regex, reason) = l.split("#", 1) - ret[regex.strip()] = reason.strip() - else: - ret[l] = None - finally: - f.close() + files = [] + for name in names: + # if we are given a directory, we read all the files it contains + # (except the ones that end with "~"). + if os.path.isdir(name): + files.extend([os.path.join(name, x) + for x in os.listdir(name) + if x[-1] != '~']) + else: + files.append(name) + + for filename in files: + f = open(filename, 'r') + try: + for l in f: + l = l.strip() + if l == "" or l[0] == "#": + continue + if "#" in l: + (regex, reason) = l.split("#", 1) + ret[regex.strip()] = reason.strip() + else: + ret[l] = None + finally: + f.close() return ret |