Parser module API
It is used by parser.py programs in each Benchmark test directory, to process the log after each test run. The data produced is used to check for Benchmark regressions (by checking against a reference threshold value) and to provide data for plotting the of multiple test runs.
Main functions:
- parse()
- process_data()
- CUR_LOG
sys.argv [edit section]
The common.py module uses the arguments passed to parser.py on it's command line. The position arguments used are:- $1 - JOB_NAME
- $2 - PLATFORM
- $3 - BUILD_ID
- $4 - BUILD_NUMBER
- $5 - FIRMWARE
- $6 - SDK
- $7 - DEVICE
(see parser.py for invocation details)
parse() [edit section]
- input:
- cur_search_pattern - compiled re search pattern
- output:
- list of regular expression matches for each line matching the specified pattern
This routine scans the current log file, using a regular expression. It returns an re match object for each line of the log file that matches the expression.
This list is used to populate a dictionary of metric/value pairs that can be passed to the process_data function.
process_data [edit section]
This is the main routine of the module. It processes the list of metrics, and populates various output files for test.
- input:
- ref_section_pat - regular expression used to read reference.log
- cur_dict - dictionary of metric/value pairs
- m - indicates the size of the plot. It should be one of: 's', 'm', 'l', 'xl'
- if 'm', 'l', or 'xl' are used, then a multiplot is created
- label - label for the plot
This routine has the following outline:
- write_report_results
- read the reference thresholds
- check the values against the reference thresholds
- store the plot data to a file (plot.data)
- create the plot
- save the plot to an image file (plot.png)
CUR_LOG [edit section]
This has the name of the current log file, which can be opened and read directly by parser.py. Use of this is not needed if the parse() function is used.