source: mod_gnutls/test/mgstest/valgrind.py @ f73eeb7

asyncioproxy-ticket
Last change on this file since f73eeb7 was 005b185, checked in by Fiona Klute <fiona.klute@…>, 18 months ago

Fail tests running with Valgrind if Valgrind reports errors

  • Property mode set to 100644
File size: 1.2 KB
Line 
1# Copyright 2020 Fiona Klute
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""Helpers for Valgrind tests."""
16
17import re
18
19err_re = re.compile(r'^==\d+== ERROR SUMMARY: (\d+) errors from '
20                    r'\d+ contexts \(suppressed: (\d+) from \d+\)')
21
22def error_summary(log):
23    """Read all available error summaries from the given log (open text
24    file).
25
26    Returns a tuple of two ints, containing the number of reported and
27    suppressed errors, in that order.
28
29    """
30    # reported errors, suppressed errors
31    errors = (0, 0)
32    for line in log:
33        m = err_re.match(line)
34        if m:
35            add = (int(m.group(1)), int(m.group(2)))
36            errors = tuple(sum(x) for x in zip(errors, add))
37    return errors
Note: See TracBrowser for help on using the repository browser.