diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/result.py | 21 | ||||
| -rw-r--r-- | src/test/test.py | 3 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/test/result.py b/src/test/result.py index 3d16c7e..55cda54 100644 --- a/src/test/result.py +++ b/src/test/result.py @@ -6,7 +6,7 @@ # By: charles <me@cacharle.xyz> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/09/11 12:17:34 by charles #+# #+# # -# Updated: 2020/10/08 08:53:49 by cacharle ### ########.fr # +# Updated: 2020/10/09 11:04:16 by cacharle ### ########.fr # # # # ############################################################################ # @@ -51,18 +51,25 @@ class Result: def leak(cmd: str, leak_output: str = None): return Result(cmd, None, None, None, leak_output) - @property - def lost_bytes(self): - m = re.search( - r"definitely lost: (?P<bytes>[0-9,]+) bytes in [0-9,]+ blocks", + def _search_leak_kind(self, kind: str) -> int: + match = re.search( + r"==\d+==\s+" + kind + r" lost: (?P<bytes>[0-9,]+) bytes in [0-9,]+ blocks", self.leak_output ) - if m is None: + if match is None: raise RuntimeError( "valgrind output parsing failed for `{}`:\n{}" .format(self.cmd, self.leak_output) ) - return int(m.group("bytes")) + return match + + @property + def lost_bytes(self): + definite_match = self._search_leak_kind("definitely") + indirect_match = self._search_leak_kind("indirectly") + definite_bytes = int(definite_match.group("bytes").replace(",", "")) + indirect_bytes = int(indirect_match.group("bytes").replace(",", "")) + return definite_bytes + indirect_bytes @property def passed(self): diff --git a/src/test/test.py b/src/test/test.py index 6668573..b487f10 100644 --- a/src/test/test.py +++ b/src/test/test.py @@ -6,14 +6,13 @@ # By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/06/16 21:48:50 by charles #+# #+# # -# Updated: 2020/10/08 10:05:39 by cacharle ### ########.fr # +# Updated: 2020/10/09 11:00:57 by cacharle ### ########.fr # # # # ############################################################################ # import os import sys import subprocess -#import time import config from test.captured import Captured |
