The Samba-Bugzilla – Attachment 17689 Details for
Bug 15258
filter-subunit is inefficient with large numbers of knownfails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Patch for v4-17-test
bfixes-tmp417.txt (text/plain), 3.75 KB, created by
Stefan Metzmacher
on 2022-12-13 22:52:49 UTC
(
hide
)
Description:
Patch for v4-17-test
Filename:
MIME Type:
Creator:
Stefan Metzmacher
Created:
2022-12-13 22:52:49 UTC
Size:
3.75 KB
patch
obsolete
>From b54882fabc75874d1349b798a3dd710bbb984df1 Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Tue, 6 Dec 2022 17:16:00 +1300 >Subject: [PATCH] selftest: make filter-subunit much more efficient for large > knownfail lists > >By compiling the knownfail lists ahead of time we change a 20min test >into a 90sec test. > >This could be improved further by combining this into a single regular expression, >but this is enough for now. The 'reason' is thankfully not used. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15258 > >Pair-programmed-with: Joseph Sutton <josephsutton@catalyst.net.nz> > >Signed-off-by: Andrew Bartlett <abartlet@samba.org> >Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> >Reviewed-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit 22128c718cadd34af892df102bd52df6a6b03303) >--- > selftest/subunithelper.py | 32 +++++++++++++++----------------- > 1 file changed, 15 insertions(+), 17 deletions(-) > >diff --git a/selftest/subunithelper.py b/selftest/subunithelper.py >index 2b78d16eb3ae..801149f8910d 100644 >--- a/selftest/subunithelper.py >+++ b/selftest/subunithelper.py >@@ -236,7 +236,7 @@ class SubunitOps(TestProtocolClient, TestsuiteEnabledTestResult): > > > def read_test_regexes(*names): >- ret = {} >+ ret = [] > files = [] > for name in names: > # if we are given a directory, we read all the files it contains >@@ -256,20 +256,18 @@ def read_test_regexes(*names): > continue > if "#" in l: > (regex, reason) = l.split("#", 1) >- ret[regex.strip()] = reason.strip() >+ ret.append(re.compile(regex.strip())) > else: >- ret[l] = None >+ ret.append(re.compile(l)) > > return ret > > > def find_in_list(regexes, fullname): >- for regex, reason in regexes.items(): >- if re.match(regex, fullname): >- if reason is None: >- return "" >- return reason >- return None >+ for regex in regexes: >+ if regex.match(fullname): >+ return True >+ return False > > > class ImmediateFail(Exception): >@@ -344,10 +342,10 @@ class FilterOps(unittest.TestResult): > > def addFailure(self, test, err=None): > test = self._add_prefix(test) >- xfail_reason = find_in_list(self.expected_failures, test.id()) >- if xfail_reason is None: >- xfail_reason = find_in_list(self.flapping, test.id()) >- if xfail_reason is not None: >+ xfail = find_in_list(self.expected_failures, test.id()) >+ if not xfail: >+ xfail = find_in_list(self.flapping, test.id()) >+ if xfail: > self.xfail_added += 1 > self.total_xfail += 1 > self._ops.addExpectedFailure(test, err) >@@ -365,8 +363,8 @@ class FilterOps(unittest.TestResult): > > def addSuccess(self, test): > test = self._add_prefix(test) >- xfail_reason = find_in_list(self.expected_failures, test.id()) >- if xfail_reason is not None: >+ xfail = find_in_list(self.expected_failures, test.id()) >+ if xfail: > self.uxsuccess_added += 1 > self.total_uxsuccess += 1 > self._ops.addUnexpectedSuccess(test) >@@ -438,11 +436,11 @@ class FilterOps(unittest.TestResult): > if expected_failures is not None: > self.expected_failures = expected_failures > else: >- self.expected_failures = {} >+ self.expected_failures = [] > if flapping is not None: > self.flapping = flapping > else: >- self.flapping = {} >+ self.flapping = [] > self.strip_ok_output = strip_ok_output > self.xfail_added = 0 > self.fail_added = 0 >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
abartlet
:
review+
Actions:
View
Attachments on
bug 15258
: 17689 |
17690
|
17691