From 71a8168cc0db4a9e008bbefd674ba46225c79502 Mon Sep 17 00:00:00 2001 From: Mathieu Faverge Date: Thu, 6 Dec 2018 10:35:23 +0100 Subject: [PATCH] Add gitlab analysis --- .gitlab-ci-filelist.sh | 33 ++++++++++ .gitlab-ci.yml | 39 ++++++++++++ CMakeLists.txt | 2 + CTestConfig.cmake | 60 ++++++++++++++++++ analysis.sh | 63 +++++++++++++++++++ externals/tau/COPYRIGHT | 0 externals/tau/CREDITS | 0 externals/tau/Makefile | 0 externals/tau/include/Makefile | 0 externals/tau/include/Profile/TauTrace.h | 0 externals/tau/include/Profile/tau_types.h | 0 externals/tau/include/TAU_tf.h | 0 externals/tau/include/TAU_tf_writer.h | 0 externals/tau/include/tau_internal.h | 0 externals/tau/include/tauarch.h | 0 externals/tau/include/tauroot.h | 0 externals/tau/src/TraceInput/Makefile | 0 externals/tau/src/TraceInput/TAU_Cwrapper.cpp | 0 externals/tau/src/TraceInput/TAU_tf.cpp | 0 externals/tau/src/TraceInput/TAU_tf_decl.h | 0 externals/tau/src/TraceInput/TAU_tf_headers.h | 0 .../tau/src/TraceInput/TAU_tf_writer.cpp | 0 src/CMakeLists.txt | 20 ++---- 23 files changed, 202 insertions(+), 15 deletions(-) create mode 100755 .gitlab-ci-filelist.sh create mode 100644 .gitlab-ci.yml create mode 100644 CTestConfig.cmake create mode 100755 analysis.sh mode change 100755 => 100644 externals/tau/COPYRIGHT mode change 100755 => 100644 externals/tau/CREDITS mode change 100755 => 100644 externals/tau/Makefile mode change 100755 => 100644 externals/tau/include/Makefile mode change 100755 => 100644 externals/tau/include/Profile/TauTrace.h mode change 100755 => 100644 externals/tau/include/Profile/tau_types.h mode change 100755 => 100644 externals/tau/include/TAU_tf.h mode change 100755 => 100644 externals/tau/include/TAU_tf_writer.h mode change 100755 => 100644 externals/tau/include/tau_internal.h mode change 100755 => 100644 externals/tau/include/tauarch.h mode change 100755 => 100644 externals/tau/include/tauroot.h mode change 100755 => 100644 externals/tau/src/TraceInput/Makefile mode change 100755 => 100644 externals/tau/src/TraceInput/TAU_Cwrapper.cpp mode change 100755 => 100644 externals/tau/src/TraceInput/TAU_tf.cpp mode change 100755 => 100644 externals/tau/src/TraceInput/TAU_tf_decl.h mode change 100755 => 100644 externals/tau/src/TraceInput/TAU_tf_headers.h mode change 100755 => 100644 externals/tau/src/TraceInput/TAU_tf_writer.cpp diff --git a/.gitlab-ci-filelist.sh b/.gitlab-ci-filelist.sh new file mode 100755 index 0000000..9d413a1 --- /dev/null +++ b/.gitlab-ci-filelist.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +if [ $# -gt 0 ] +then + BUILDDIR=$1 +fi +BUILDDIR=${BUILDDIR-=build} + +echo $PWD +rm -f filelist.txt + +git ls-files | grep "\.[ch]pp" > filelist.txt + +# Remove all CMakeFiles generated file +sed -i '/CMakeFiles/d' filelist.txt + +# Remove all external file +sed -i '/^external/d' filelist.txt + +# Remove all .cmake files +sed -i '/.cmake/d' filelist.txt + +# Remove all .in files +sed -i '/.in$/d' filelist.txt + +# Remove all clang files +sed -i '/^\.clang/d' filelist.txt + +# Remove installed files +sed -i '/^install.*/d' filelist.txt + +grep '\.cpp$' filelist.txt > filelist-c.txt + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..85f4713 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,39 @@ +image: hpclib/hiepacs + +stages: + - build + - sonar + +build_vite: + stage: build + artifacts: + name: vite_build + expire_in: 42 minutes + untracked: true + script: + - git submodule update --init --recursive + - mkdir build + - cd build + - cmake .. -DCMAKE_INSTALL_PREFIX=${PWD}/../install -DBUILD_SHARED_LIBS=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_C_FLAGS="-O0 -g -fPIC --coverage -Wall -fdiagnostics-show-option -fno-inline" -DCMAKE_EXE_LINKER_FLAGS="--coverage" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + - make -j 4 | tee ../vite-build.log + - make install | tee -a ../vite-build.log + only: + - branches + - master@solverstack/vite + +sonar_vite: + stage: sonar + dependencies: + - build_vite + artifacts: + name: vite_sonar + expire_in: 1 week + paths: + - vite-cppcheck.xml + - vite-rats.xml + - sonar.log + script: + - ./analysis.sh + only: + - master@solverstack/vite + diff --git a/CMakeLists.txt b/CMakeLists.txt index 61c0121..7520ca9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,7 @@ if (USE_QT5) else(USE_QT5) # Try Qt4 + set(CMAKE_AUTOMOC ON) find_package(Qt4 COMPONENTS QtCore QtGui QtXml REQUIRED) set(QT_USE_QTUITOOLS ON) set(QT_USE_QTOPENGL ON) @@ -111,6 +112,7 @@ else(USE_QT5) # Try Qt4 endif(USE_QT5) +set( OpenGL_GL_PREFERENCE LEGACY ) find_package(OpenGL) #find_package(GLU) diff --git a/CTestConfig.cmake b/CTestConfig.cmake new file mode 100644 index 0000000..45bf293 --- /dev/null +++ b/CTestConfig.cmake @@ -0,0 +1,60 @@ +## This file should be placed in the root directory of your project. +## Then modify the CMakeLists.txt file in the root directory of your +## project to incorporate the testing dashboard. +## # The following are required to uses Dart and the Cdash dashboard +## ENABLE_TESTING() +## INCLUDE(CTest) +set(CTEST_PROJECT_NAME "ViTE") +set(CTEST_NIGHTLY_START_TIME "00:00:00 GMT") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "cdash.inria.fr") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=vite") +set(CTEST_DROP_SITE_CDASH TRUE) + +#-------------------------------------------------------------------- +# BUILDNAME variable construction +# This variable will be used to set the build name which will appear +# on the ViTE dashboard http://cdash.inria.fr/CDash/ +#-------------------------------------------------------------------- +# Start with the short system name, e.g. "Linux", "FreeBSD" or "Windows" +if(NOT BUILDNAME) + + set(BUILDNAME "${CMAKE_SYSTEM_NAME}") + + # Add i386 or amd64 + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(BUILDNAME "${BUILDNAME}-amd64") + else() + set(BUILDNAME "${BUILDNAME}-i386") + endif() + + # Add compiler name + get_filename_component(CMAKE_C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME) + set(BUILDNAME "${BUILDNAME}-${CMAKE_C_COMPILER_NAME}") + + # Add the build type, e.g. "Debug, Release..." + if(CMAKE_BUILD_TYPE) + set(BUILDNAME "${BUILDNAME}-${CMAKE_BUILD_TYPE}") + endif(CMAKE_BUILD_TYPE) + + # Specific options of Pastix + if(USE_QT5) + set(BUILDNAME "${BUILDNAME}-Qt5") + else() + set(BUILDNAME "${BUILDNAME}-Qt4") + endif() + + if(VITE_ENABLE_TAU) + set(BUILDNAME "${BUILDNAME}-Tau") + endif(VITE_ENABLE_TAU) + + if(VITE_ENABLE_OTF) + set(BUILDNAME "${BUILDNAME}-OTF") + endif(VITE_ENABLE_OTF) + + if(VITE_ENABLE_OTF2) + set(BUILDNAME "${BUILDNAME}-OTF2") + endif(VITE_ENABLE_OTF2) + +endif() diff --git a/analysis.sh b/analysis.sh new file mode 100755 index 0000000..0f20c4e --- /dev/null +++ b/analysis.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Performs an analysis of Vite source code: +# - we consider to be in Vite's source code root +# - we consider having the coverage file vite.lcov in the root directory +# - we consider having cppcheck, rats, sonar-scanner programs available in the environment + +# filter sources: +# - consider generated files in ${BUILDDIR} +# - exclude base *z* files to avoid duplication +# - exclude cblas.h and lapacke-.h because not really part of vite and make cppcheck analysis too long + +if [ $# -gt 0 ] +then + BUILDDIR=$1 +fi +BUILDDIR=${BUILDDIR:-build} + +./.gitlab-ci-filelist.sh $BUILDDIR + +# Undefine this because not relevant in our configuration +#export UNDEFINITIONS="-UWIN32 -UWIN64 -U_MSC_EXTENSIONS -U_MSC_VER -U__SUNPRO_C -U__SUNPRO_CC -U__sun -Usun -U__cplusplus" + +# run cppcheck analysis +cppcheck -v -f --language=c++ --platform=unix64 --enable=all --xml --xml-version=2 --suppress=missingInclude ${UNDEFINITIONS} --file-list=./filelist-c.txt 2> vite-cppcheck.xml + +# run rats analysis +rats -w 3 --xml `cat filelist.txt` > vite-rats.xml + +# Set the default for the project key +SONARQUBE_PROJECTKEY=${SONARQUBE_PROJECTKEY:-hiepacs:vite:gitlab:master} + +# create the sonarqube config file +cat > sonar-project.properties << EOF +sonar.host.url=https://sonarqube.bordeaux.inria.fr/sonarqube +sonar.login=$SONARQUBE_LOGIN + +sonar.links.homepage=https://gitlab.inria.fr/solverstack/vite +sonar.links.scm=https://gitlab.inria.fr/solverstack/vite.git +sonar.links.ci=https://gitlab.inria.fr/solverstack/vite/pipelines +sonar.links.issue=https://gitlab.inria.fr/solverstack/vite/issues + +sonar.projectKey=$SONARQUBE_PROJECTKEY +sonar.projectDescription=Parallel Sparse direct Solver +sonar.projectVersion=master + +sonar.language=c++ +sonar.sources=src, tests, plugins +sonar.inclusions=`cat filelist.txt | xargs echo | sed 's/ /, /g'` +sonar.sourceEncoding=UTF-8 +sonar.cxx.errorRecoveryEnabled=true +sonar.cxx.compiler.charset=UTF-8 +sonar.cxx.compiler.parser=GCC +sonar.cxx.compiler.regex=^(.*):(\\d+):\\d+: warning: (.*)\\[(.*)\\]$ +sonar.cxx.compiler.reportPath=vite-build.log +#sonar.cxx.coverage.reportPath=vite-coverage.xml +sonar.cxx.cppcheck.reportPath=vite-cppcheck.xml +sonar.cxx.rats.reportPath=vite-rats.xml +sonar.cxx.jsonCompilationDatabase=build/compile_commands.json +EOF + +# run sonar analysis + publish on sonarqube-dev +sonar-scanner -X > sonar.log diff --git a/externals/tau/COPYRIGHT b/externals/tau/COPYRIGHT old mode 100755 new mode 100644 diff --git a/externals/tau/CREDITS b/externals/tau/CREDITS old mode 100755 new mode 100644 diff --git a/externals/tau/Makefile b/externals/tau/Makefile old mode 100755 new mode 100644 diff --git a/externals/tau/include/Makefile b/externals/tau/include/Makefile old mode 100755 new mode 100644 diff --git a/externals/tau/include/Profile/TauTrace.h b/externals/tau/include/Profile/TauTrace.h old mode 100755 new mode 100644 diff --git a/externals/tau/include/Profile/tau_types.h b/externals/tau/include/Profile/tau_types.h old mode 100755 new mode 100644 diff --git a/externals/tau/include/TAU_tf.h b/externals/tau/include/TAU_tf.h old mode 100755 new mode 100644 diff --git a/externals/tau/include/TAU_tf_writer.h b/externals/tau/include/TAU_tf_writer.h old mode 100755 new mode 100644 diff --git a/externals/tau/include/tau_internal.h b/externals/tau/include/tau_internal.h old mode 100755 new mode 100644 diff --git a/externals/tau/include/tauarch.h b/externals/tau/include/tauarch.h old mode 100755 new mode 100644 diff --git a/externals/tau/include/tauroot.h b/externals/tau/include/tauroot.h old mode 100755 new mode 100644 diff --git a/externals/tau/src/TraceInput/Makefile b/externals/tau/src/TraceInput/Makefile old mode 100755 new mode 100644 diff --git a/externals/tau/src/TraceInput/TAU_Cwrapper.cpp b/externals/tau/src/TraceInput/TAU_Cwrapper.cpp old mode 100755 new mode 100644 diff --git a/externals/tau/src/TraceInput/TAU_tf.cpp b/externals/tau/src/TraceInput/TAU_tf.cpp old mode 100755 new mode 100644 diff --git a/externals/tau/src/TraceInput/TAU_tf_decl.h b/externals/tau/src/TraceInput/TAU_tf_decl.h old mode 100755 new mode 100644 diff --git a/externals/tau/src/TraceInput/TAU_tf_headers.h b/externals/tau/src/TraceInput/TAU_tf_headers.h old mode 100755 new mode 100644 diff --git a/externals/tau/src/TraceInput/TAU_tf_writer.cpp b/externals/tau/src/TraceInput/TAU_tf_writer.cpp old mode 100755 new mode 100644 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ecce85f..4837f6a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -394,34 +394,24 @@ IF(VITE_ENABLE_SERIALIZATION) ENDIF(VITE_ENABLE_SERIALIZATION) -############################################# -# QT5 -############################################# IF(USE_QT5) + ############################################# + # QT5 + ############################################# QT5_WRAP_UI(VITE_UIS_H ${VITE_UIS}) QT5_WRAP_CPP(VITE_MOC ${VITE_UIS_H} ${VITE_MOC_HDRS}) QT5_ADD_RESOURCES(VITE_RCC_SRCS ${VITE_RCCS}) +ELSE(USE_QT5) ############################################# # QT4 ############################################# -ELSE(USE_QT5) - QT4_AUTOMOC(${VITE_SRCS}) - FOREACH(_hdrs_file ${VITE_HDRS}) - GET_FILENAME_COMPONENT(_abs_file ${_hdrs_file} ABSOLUTE) - FILE(READ ${_abs_file} _contents) - STRING(REGEX MATCHALL "Q_OBJECT" _match "${_contents}") - IF(_match) - SET(VITE_MOC_HDRS ${VITE_MOC_HDRS} ${_hdrs_file}) - ENDIF(_match) - ENDFOREACH(_hdrs_file ${VITE_HDRS}) - QT4_WRAP_UI(VITE_UIS_H ${VITE_UIS}) QT4_WRAP_CPP(VITE_MOC ${VITE_UIS_H} ${VITE_MOC_HDRS}) QT4_ADD_RESOURCES(VITE_RCC_SRCS ${VITE_RCCS}) ENDIF(USE_QT5) -############################################# + INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/common -- GitLab