parser func parse log

NAME [edit section]

parse_log

SYNOPSIS [edit section]

DESCRIPTION [edit section]

This function parses the test log for the just-exected test, using the regex string to match lines from the log.

It returns a list of tuples with group elements for each of the matches found.

The regular expression string is compiled using re.MULTILINE, so it should usually include anchors for the start and end of the a line ("^" and "$"). (That is, if the test log is line-oriented). The pattern should have enough detail to make the parsing results unique. The regular expression string should also include groups, to pull out the values desired from the test log.

After this call, it is customary to build a list of results to provide to the process function. See that page for details about it's input parameter format.

EXAMPLES [edit section]

Here is a sample invocation:

Dhrystone [edit section]

This regex_string has 4 groups, to match:

In this example, the 2nd and 4th parts of the pattern did not need to be in groups (surrounded by parentheses).

After a normal run of Benchmark.Dhrystone, this will return something like the following:

In this case, the group that is desired is the 3rd tuple element, of the first match. That is, matches[0][2] has the value '11111111.0' (as a string).

A Dhrystone test log is shown below. Note that the indicated regex_string only matches one line in the file.

ENVIRONMENT and ARGUMENTS [edit section]

The "common.py" module uses the following environment variables, to find the test log:

RETURN [edit section]

Returns a list of tuples, with each tuple holding the matched text from the log for the groups in the regex_string.

Returns an empty list ([]) if there were no matches found.

Returns None if there was a error reading the test log.

Raises an exception if there was a problem compiling the regular expression string.

SOURCE [edit section]

Located in scripts/parser/common.py

SEE ALSO [edit section]