Skip to content

Commit

Permalink
Add valgrind and sonar
Browse files Browse the repository at this point in the history
* Add cppcheck and sonar

* Remove ubuntu image

* Remove smart_contract directory

* Add authentication

* Add valgrind support for tests

* Fix
  • Loading branch information
Warchant authored Apr 22, 2017
1 parent 50c7ce9 commit 85577bf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
22 changes: 20 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- run:
name: run tests
command: |
TEST_FOLDER=$IROHA_BUILD/test_bin
export TEST_FOLDER=$IROHA_BUILD/test_bin
total=0
for file in ${TEST_FOLDER}/*; do
# run test
Expand All @@ -41,9 +41,26 @@ jobs:
- run:
name: analyze source code with cppcheck and sonarqube
command: |
export TEST_FOLDER=$IROHA_BUILD/test_bin
cd $IROHA_HOME
cppcheck --enable=all --inconclusive --xml --xml-version=2 core/ peer/ smart_contract/ test/ tools/ 2>/tmp/cppcheck.xml || true
# run valgrind for tests
VALGRIND_XML=
mkdir -p valgrind_report
for test in $(ls $TEST_FOLDER); do
xml=valgrind_report/$test.xml
bin=$TEST_FOLDER/$test
valgrind --xml=yes --xml-file=$xml --trace-children=yes --demangle=yes --leak-check=full $bin || true
if [ -z "$VALGRIND_XML" ]; then
VALGRIND_XML=$xml
else
VALGRIND_XML=$xml,$VALGRIND_XML
fi
done
# sonarqube is at /opt/sonar-scanner in warchantua/iroha-dev
/opt/sonar-scanner/bin/sonar-scanner \
-Dsonar.sourceEncoding=UTF-8 \
Expand All @@ -52,7 +69,8 @@ jobs:
-Dsonar.projectKey=hyperledger:iroha \
-Dsonar.projectName="Iroha" \
-Dsonar.projectVersion="$CIRCLE_BUILD_NUM" \
-Dsonar.login=$SONAR_TOKEN \
-Dsonar.login="$SONAR_TOKEN" \
-Dsonar.cxx.valgrind.reportPath="$VALGRIND_XML"
-Dsonar.cxx.cppcheck.reportPath=/tmp/cppcheck.xml || true
Expand Down
3 changes: 2 additions & 1 deletion docker/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ RUN apt-get update && apt-get -y upgrade; \
jq \
pkg-config \
cppcheck \
valgrind
valgrind \
clang-tidy

RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test; \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 20; \
Expand Down

0 comments on commit 85577bf

Please sign in to comment.