Skip to content

Commit

Permalink
Merge pull request #475 from lembergerth/info-testcov
Browse files Browse the repository at this point in the history
Make log parsing of TestCov more robust
  • Loading branch information
PhilippWendler authored Nov 1, 2019
2 parents b14c00b + ad786c1 commit fc17fad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions benchexec/tools/tbf_testsuite_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
import re
import benchexec.result as result
import benchexec.util as util
import benchexec.tools.template
Expand Down Expand Up @@ -71,8 +72,10 @@ def determine_result(self, returncode, returnsignal, output, isTimeout):

def get_value_from_output(self, lines, identifier):
for line in reversed(lines):
if identifier in line:
start = line.find(":") + 1
end = line.find("(", start)
return line[start:end].strip()
pattern = identifier
if pattern[-1] != ":":
pattern += ":"
match = re.match("^" + pattern + "([^(]*)", line)
if match and match.group(1):
return match.group(1).strip()
return None
11 changes: 7 additions & 4 deletions benchexec/tools/testcov.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
import re
import benchexec.result as result
import benchexec.util as util
import benchexec.tools.template
Expand Down Expand Up @@ -76,8 +77,10 @@ def determine_result(self, returncode, returnsignal, output, isTimeout):

def get_value_from_output(self, lines, identifier):
for line in reversed(lines):
if identifier in line:
start = line.find(":") + 1
end = line.find("(", start)
return line[start:end].strip()
pattern = identifier
if pattern[-1] != ":":
pattern += ":"
match = re.match("^" + pattern + "([^(]*)", line)
if match and match.group(1):
return match.group(1).strip()
return None

0 comments on commit fc17fad

Please sign in to comment.