analysis.sh 2.84 KB
Newer Older
PRUVOST Florent's avatar
PRUVOST Florent committed
1 2 3 4 5 6
#!/bin/bash

# Performs an analysis of Chameleon source code
# We consider to be in Chameleon's source code root

# build with proper options
7 8 9 10 11
#mkdir -p build
#cd build
#rm * -rf
#cmake .. -DCHAMELEON_USE_MPI=ON -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_VERBOSE_MAKEFILE=ON -DMORSE_ENABLE_WARNING=ON -DMORSE_ENABLE_COVERAGE=ON
#make -j5 | tee ../chameleon-build.log
PRUVOST Florent's avatar
PRUVOST Florent committed
12 13

# run tests
14
#STARPU_SILENT=1 ctest --no-compress-output || /usr/bin/true
PRUVOST Florent's avatar
PRUVOST Florent committed
15 16

# capture coverage
17 18 19 20
#lcov --directory . --capture --output-file ../chameleon.lcov
lcov --directory build --capture --output-file chameleon.lcov
#cd ..
#genhtml -o coverage chameleon.lcov
PRUVOST Florent's avatar
PRUVOST Florent committed
21 22 23 24 25
lcov_cobertura.py chameleon.lcov --output chameleon-coverage.xml

# filter sources:
# - consider generated files in build
# - exclude base *z* files to avoid duplication
26
# - exclude cblas.h and lapacke-.h because not really part of chameleon and make cppcheck analysis too long
27
./tools/find_sources.sh
28

PRUVOST Florent's avatar
PRUVOST Florent committed
29
# Undefine this because not relevant in our configuration
30
export UNDEFINITIONS="-UCHAMELEON_USE_OPENCL -UWIN32 -UWIN64 -U_MSC_EXTENSIONS -U_MSC_VER -U__SUNPRO_C -U__SUNPRO_CC -U__sun -Usun -U__cplusplus"
PRUVOST Florent's avatar
PRUVOST Florent committed
31
# run cppcheck analysis
PRUVOST Florent's avatar
PRUVOST Florent committed
32 33
cppcheck -v -f --language=c --platform=unix64 --enable=all --xml --xml-version=2 --suppress=missingIncludeSystem ${UNDEFINITIONS} --file-list=./filelist.txt 2> chameleon-cppcheck.xml
#cppcheck -v -f --language=c --platform=unix64 --enable=all --xml --xml-version=2 --suppress=missingIncludeSystem ${UNDEFINITIONS} `cat filelist.txt` 2> chameleon-cppcheck.xml
PRUVOST Florent's avatar
PRUVOST Florent committed
34
# run rats analysis
35
rats -w 3 --xml  `cat filelist.txt` > chameleon-rats.xml
36

PRUVOST Florent's avatar
PRUVOST Florent committed
37 38 39 40 41 42 43 44 45 46 47
# create the sonarqube config file
cat > sonar-project.properties << EOF
sonar.host.url=https://hpclib-sed.bordeaux.inria.fr/sonarqube-dev
sonar.links.homepage=https://gitlab.inria.fr/solverstack/chameleon
sonar.links.ci=https://gitlab.inria.fr/solverstack/chameleon/pipelines
sonar.links.scm=https://gitlab.inria.fr/solverstack/chameleon/
sonar.projectKey=chameleon
sonar.projectName=Chameleon
sonar.projectDescription=Dense linear algebra subroutines for heterogeneous and distributed architectures
sonar.projectVersion=master
sonar.language=c++
48 49
sonar.sources=build, compute, control, coreblas, example, include, runtime, testing, timing
sonar.inclusions=`cat filelist.txt | xargs echo | sed 's/ /, /g'`
PRUVOST Florent's avatar
PRUVOST Florent committed
50 51
sonar.sourceEncoding=UTF-8
sonar.cxx.compiler.charset=UTF-8
PRUVOST Florent's avatar
PRUVOST Florent committed
52 53
sonar.cxx.compiler.parser=GCC
sonar.cxx.compiler.regex=^(.*):(\\d+):\\d+: warning: (.*)\\[(.*)\\]$
54
sonar.cxx.compiler.reportPath=chameleon-build-starpu-mpi.log, chameleon-build-starpu-cuda.log, chameleon-build-starpu-simgrid.log, chameleon-build-quark.log
PRUVOST Florent's avatar
PRUVOST Florent committed
55 56 57 58 59 60 61
sonar.cxx.coverage.reportPath=chameleon-coverage.xml
sonar.cxx.cppcheck.reportPath=chameleon-cppcheck.xml
sonar.cxx.rats.reportPath=chameleon-rats.xml
EOF

# run sonar analysis + publish on sonarqube-dev
sonar-scanner -X -Dsonar.login=077ef775a8b4fe9ba722497ef0511ca6dcfb3fcd > sonar.log