From 00d0265508e4149f98353af7d9209315b665e8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Sun, 22 May 2016 17:14:15 +0200 Subject: [PATCH] Add tests to travis build. Some modifications for this --- .travis.yml | 8 +++++--- ci/{entrypoint.sh => compile.sh} | 2 +- ci/{compile_container.sh => execute.sh} | 7 +++++-- ci/static_analysis.sh | 18 +++++------------- 4 files changed, 16 insertions(+), 19 deletions(-) rename ci/{entrypoint.sh => compile.sh} (67%) rename ci/{compile_container.sh => execute.sh} (75%) diff --git a/.travis.yml b/.travis.yml index d8e3fd0..1383c0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ before_install: - ./ci/update_travis.sh script: - - CXX=clang++ CC=clang ./ci/compile_container.sh - - ./ci/compile_container.sh - - ./ci/static_analysis.sh \ No newline at end of file + - script=compile CXX=clang++ CC=clang ./ci/execute.sh + - script=clean ./ci/execute.sh + - script=compile ./ci/execute.sh + - script=static_analysis ./ci/execute.sh + - script=compile make_command="broadwayd & make test" ./ci/execute.sh \ No newline at end of file diff --git a/ci/entrypoint.sh b/ci/compile.sh similarity index 67% rename from ci/entrypoint.sh rename to ci/compile.sh index 7107c5a..9a072b0 100755 --- a/ci/entrypoint.sh +++ b/ci/compile.sh @@ -1,7 +1,7 @@ #!/bin/bash if [ "${cmake_command}" == "" ]; then - cmake_command="cmake -DCMAKE_CXX_FLAGS=\"-Werror\" .." + cmake_command="cmake -DENABLE_TESTING=1 -DCMAKE_CXX_FLAGS=-Werror .." fi if [ "${make_command}" == "" ]; then diff --git a/ci/compile_container.sh b/ci/execute.sh similarity index 75% rename from ci/compile_container.sh rename to ci/execute.sh index 87fac58..a90cee5 100755 --- a/ci/compile_container.sh +++ b/ci/execute.sh @@ -2,7 +2,10 @@ function linux () { cd ci || exit - sudo rm ../build -rf + if [ "${script}" == "clean" ]; then + sudo rm ../build -rf + return 0 + fi sudo docker run -it \ -e "CXX=$CXX" \ -e "CC=$CC" \ @@ -10,7 +13,7 @@ function linux () { -e "cmake_command=$cmake_command" \ -e "distribution=$distribution" \ -v "$PWD/../:/jucipp" \ - --entrypoint="/jucipp/ci/entrypoint.sh" \ + --entrypoint="/jucipp/ci/${script}.sh" \ "cppit/jucipp:$distribution" } diff --git a/ci/static_analysis.sh b/ci/static_analysis.sh index 9c1ca86..f24a142 100755 --- a/ci/static_analysis.sh +++ b/ci/static_analysis.sh @@ -1,16 +1,8 @@ #!/bin/bash -function linux () { - cd ci || exit - sudo docker run -it \ - -v "${PWD}/../:/jucipp/" \ - "cppit/jucipp:${distribution}" \ - sh -c "cd jucipp/build && scan-build -o ../html_${distribution} --status-bugs make" -} +if [ "${make_command}" == "" ]; then + make_command="make -j 2" +fi -#TODO should do static analysis on build -function osx () { - true -} - -$TRAVIS_OS_NAME +cd jucipp/build || exit +exec sh -c "scan-build -o ../html_${distribution} --status-bugs ${make_command}"