Autobuild & Code Sanity

Under:

This page will contain results from code-sanity tools i.e. tools checking for code syntax, memory leak, profiling etc ... and tips on how to correct those problems.
Most, if not all, pages here are generated automatically. If you encountered an error in the formatting, please send me a note ...

 



AutoBuild

AutoBuild is a tool which automatically builds/compiles our libraries based on what has been committed during the day. From time to time, please consult those pages and remember the following guideline for code submission into the repository :

  • Code submitted to cvs must compile and run under Linux platform.
  • Compilation should not give any serious warnings.

AutoBuild is self documented, just type AutoBuild.pl -h for all command line options.

AutoBuild behavior may be altered using directives. Directives are tags (key=value pairs) to be placed in a configuration file. The configuration file name is .ABrc_$^O where $^O is the string returned by the perl command % perl -e 'print $^O'. The following directives are allowed. If you have multiple values for one directive, each should be on a separate line.

  • SKIP_DIRS=XXX
    Excludes XXX from compilation, this directive will be passed to cons (the build system in STAR). This works only for directories.
    Example:
    SKIP_DIRS=StEbyePool
     
  • CO_DIRS=XXX   
    This directive forces the full tree to be CVS check out. Normally, AutoBuild only updates trees (which means that new sub-directories would not appear by defaults). This directive only works on directories and should not be used extensively as it is resource intensive (re-check out the entire directory).
    Example:
    CO_DIRS=StRoot/StEEmcPool
     
  • EX_DIRS=XXX     - This directives indicates that the item XXX (already present and deployed) should be ignored from CVS UPDATE. Practically, AutoBuild will rename the item XXX to a temporary name and restore. This directive works on files or directories.
    Example:
    EX_DIRS=StChain
     
  • #
    Not a directive per-se, this is indicate the start of a comment (the rest of the line is ignored)
    Examples: 
    SKIP_DIRS=StJetmaker  # Disabled 2008/07/23
    # the following lines are for blabla
    
     

 


Valgrind

Valgrind is a flexible tool for debugging and profiling Linux-x86 executable. The tool consists of a core, which provides a synthetic x86 CPU in software, and a series of "skins", each of which is a debugging or profiling tool.For more information valgrind, check its documentation page and the quick How to use valgrind.

 


Quick guide to run cppcheck

% cppcheck --force --enable=information StRoot/ 

In his mode, you will see all errors as it finds it.

 


Quickly running coverity

Nothing quick about it here as you will need to compile your code and generate the report ... But here is what you will need to do

  • Add the coverity path to your PATH 
    % set COVPATH=/afs/rhic.bnl.gov/x8664_sl6/app/coverity-7.6.0
    % set path=($COVPATH/bin $path)
    % rehash
  • Run a build using cov-build command. In the below command, the coverity output and results go into to a temporary directory named $MYDIR/covtmp
    % cov-build --dir $MYDIR/covtmp cons -k
  • "Analyze" the results (i.e. it will relate errors with one another)
    % cov-analyze --dir $MYDIR/covtmp --all -j auto
  • Finally, generate the HTML report
    % cov-format-errors --dir $MYDIR/covtmp  --filesort -x  --title "Bla" --html-output $MYDIR/html
Not very convenient, I suggest you use the automatically generated report above.

 

STACK_USE

Coverity uses an arbitrary limit for the checking of a single variable size allocation. This default is 10000 bytes and far too small. In C/C++ only the total number of bytes for the whole stack is relevant and this is provided by the value of stacksize (provided by the shell limit command). Our dashboard will analyze the report using a max_total_use_bytes equal to the return value stacksize from the limit command and 1/10th of that value for a single variable allocation. Any excess will be reported as a defect but may not be.

Practically, add similar options to cov-analyze command:

  • --checker-option STACK_USE:max_total_use_bytes:10240000  --checker-option STACK_USE:max_single_base_use_bytes:1024000
  • ...


 


Was also available ...

Profiling, Valgrind Results

Run-time - sorry, runtime profiling results were removed (nobody looked at them and it used lots of resources).

Profiling using gprof

This section was removed as not always working and not used by out users.