Report errors found in a build log.
errors.py is a Python script that generates a text based report of the errors from an XML build log. The report contains a summary of the overall build along with details on each failed target and makefile, including exit code, target name, directory, shell command and output. The report can be emailed to project members or used as input to other scripts for automation.
python errors.py [ --help ] [ -u URL ] filename.xml
python errors.py -u http://www.bell-labs.com/project/nmake/manual/buildlogs/xyz/nightly-20100722-linux makelog.xml
The following example is from a build containing errors for demonstration purposes.
Note that the generated error-specific URLs point directly to the entry for the failed target on the appropriate sub-page in the web log. This can reduce the number of steps required to find the error in the log.
Build exit code: 1 Number of failed targets: 3 Number of failed Makefiles: 1 Project name: XYZ Build name: nightly-20100722-linux Build start time: 2010-07-23 12:56:21.088679 -04:00 Build end time: 2010-07-23 13:02:00.117332 -04:00 Build duration: 0:05:39.028653 Host: phoebe Directory: /home/richb/projects/nightly/linux/src MAKEFILE: /home/richb/projects/nightly/source/src/Makefile VPATH: /home/richb/projects/nightly/linux:/home/richb/projects/nightly/source MAKE: nmake Command line arguments: arg 1: -k arg 2: install Web log URL: http://www.bell-labs.com/project/nmake/manual/buildlogs/xyz/nightly-20100722-linux Web Build Index URL: http://www.bell-labs.com/project/nmake/manual/buildlogs/xyz Failed Target 1 =============== Error code: 1 Makefile target: dove1.o Execution directory: /home/richb/projects/nightly/linux/src/lib/libbd1 Offset from vpath: src/lib/libbd1 Make recursion level (MAKELEVEL): 2 Start time: 2010-07-23 12:57:34.169650 -04:00 End time: 2010-07-23 12:57:34.302829 -04:00 Job duration: 0:00:00.133179 Why triggered: state variable (CCFLAGS) initialized to '-O' Weblog URL: http://www.bell-labs.com/project/nmake/manual/buildlogs/xyz/nightly-20100722-linux/makefile_1_1_2.html#t1_1_2_10 Rule action output: + cc -O -I- -c /home/richb/projects/nightly/source/src/lib/libbd1/dove1.c cc1: note: obsolete option -I- used, please use -iquote instead /home/richb/projects/nightly/source/src/lib/libbd1/dove1.c: In function 'dove1': /home/richb/projects/nightly/source/src/lib/libbd1/dove1.c:5: error: expected ';' before '}' token Failed Target 2 =============== Error code: 1 Makefile target: finch1.o Execution directory: /home/richb/projects/nightly/linux/src/lib/libbd1 Offset from vpath: src/lib/libbd1 Make recursion level (MAKELEVEL): 2 Start time: 2010-07-23 12:57:36.106033 -04:00 End time: 2010-07-23 12:57:36.237525 -04:00 Job duration: 0:00:00.131492 Why triggered: state variable (CCFLAGS) initialized to '-O' Weblog URL: http://www.bell-labs.com/project/nmake/manual/buildlogs/xyz/nightly-20100722-linux/makefile_1_1_2.html#t1_1_2_15 Rule action output: + cc -O -I- -c /home/richb/projects/nightly/source/src/lib/libbd1/finch1.c cc1: note: obsolete option -I- used, please use -iquote instead /home/richb/projects/nightly/source/src/lib/libbd1/finch1.c: In function 'finch1': /home/richb/projects/nightly/source/src/lib/libbd1/finch1.c:5: error: expected ';' before '}' token Failed Target 3 =============== Error code: 1 Makefile target: boysenberry1.o Execution directory: /home/richb/projects/nightly/linux/src/cmd/br1 Offset from vpath: src/cmd/br1 Make recursion level (MAKELEVEL): 2 Start time: 2010-07-23 13:01:56.488570 -04:00 End time: 2010-07-23 13:01:56.622205 -04:00 Job duration: 0:00:00.133635 Why triggered: state variable (CCFLAGS) initialized to '-O' Weblog URL: http://www.bell-labs.com/project/nmake/manual/buildlogs/xyz/nightly-20100722-linux/makefile_1_2_6.html#t1_2_6_3 Rule action output: + cc -O -I- -c /home/richb/projects/nightly/source/src/cmd/br1/boysenberry1.c cc1: note: obsolete option -I- used, please use -iquote instead /home/richb/projects/nightly/source/src/cmd/br1/boysenberry1.c: In function 'boysenberry1': /home/richb/projects/nightly/source/src/cmd/br1/boysenberry1.c:5: error: expected ';' before '}' token Failed Makefile 1 ================= Error code: 1 Triggering parent rule: gk Execution directory: /home/richb/projects/nightly/linux/src/cmd/gk Offset from vpath: src/cmd/gk Make recursion level (MAKELEVEL): 2 Start time: 2010-07-23 13:00:43.104945 -04:00 End time: 2010-07-23 13:00:54.641532 -04:00 Makefile run duration: 0:00:11.536587 Weblog URL: http://www.bell-labs.com/project/nmake/manual/buildlogs/xyz/nightly-20100722-linux/makefile_1_2_1.html
The XML build log is parsed and stored in the
variable in an element tree structure. The tree is preprocessed through
addition of element attributes to allow easier processing later on. For
example, the index of a target element relative to its siblings is stored
in an index attribute to allow generation of unique target-specific URLs
into a web based buildlog (which may be separately generated using the
build2html script included in nmake since the nmake 11
release.) Building block routines handling operations related to dates,
vpath manipulation, URL generation, and explain string handling are
imported from separate modules to allow reuse in multiple scripts. The
flt variable is set to a list of failed leaf targets. The
fmf variable is set to a list of failed makefiles not
containing any failed child targets, that is, makefiles where the failure
is due to some problem in the makefile itself rather than inheriting a
non-zero exit code from a failed child target. Calculating these lists up
front allows summary counts to be printed at the beginning of the report
prior to printing the detailed sections. A summary section is then
printed for the entire build, listing overall build information such as
overall build exit code, error counts, timing data, and command line
arguments. Then details are printed for each failed target and makefile.