diff --git a/.travis.yml b/.travis.yml index b4bd3d852f7..8f0ffe389d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -94,6 +94,8 @@ before_install: # - Rely on `kerl` for [pre-compiled versions available](https://docs.travis-ci.com/user/languages/erlang#Choosing-OTP-releases-to-test-against). Rely on installation path chosen by [`travis-erlang-builder`](https://github.com/travis-ci/travis-erlang-builder/blob/e6d016b1a91ca7ecac5a5a46395bde917ea13d36/bin/compile#L18). # - . ~/otp/18.2.1/activate && erl -version #- curl -f -L -o ./rebar3 https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 && ./rebar3 version && export PATH="${TRAVIS_BUILD_DIR}:$PATH" + # install valgrind for C++ memory test + - sudo apt-get install valgrind # install Qt 5.10 - sudo add-apt-repository --yes ppa:beineri/opt-qt-5.10.1-trusty - sudo apt-get update -qq diff --git a/samples/client/petstore/cpp-qt5/PetStore/PetStore.pro b/samples/client/petstore/cpp-qt5/PetStore/PetStore.pro index 819ae4898b1..2e43c3f7dc8 100644 --- a/samples/client/petstore/cpp-qt5/PetStore/PetStore.pro +++ b/samples/client/petstore/cpp-qt5/PetStore/PetStore.pro @@ -26,3 +26,6 @@ SOURCES += main.cpp \ HEADERS += PetApiTests.h \ StoreApiTests.h \ UserApiTests.h + +# Disable optimisation for better valgrind report +QMAKE_CXXFLAGS_DEBUG += -O0 diff --git a/samples/client/petstore/cpp-qt5/build-and-test.bash b/samples/client/petstore/cpp-qt5/build-and-test.bash index fd4d633b59d..ea8cbeb1357 100755 --- a/samples/client/petstore/cpp-qt5/build-and-test.bash +++ b/samples/client/petstore/cpp-qt5/build-and-test.bash @@ -2,10 +2,41 @@ set -e -mkdir build +mkdir -p build cd build -qmake ../PetStore/PetStore.pro +qmake ../PetStore/PetStore.pro CONFIG+=debug + make -./PetStore +valgrind --leak-check=full ./PetStore |& tee result.log || exit 1 + +echo "Make sure the tests are launched:" +testCount=$(cat result.log | grep 'Finished testing of' | wc -l) +if [ $testCount == 3 ] +then + echo "Ok" +else + echo "The tests were not run!!!" + exit 1 +fi + +echo "Make sure the tests passed:" +successCount=$(cat result.log | grep '0 failed' | wc -l) +if [ $successCount == 3 ] +then + echo "Ok" +else + echo "The tests failed!!!" + exit 1 +fi + +echo "Check if no memory leaks occured:" +leakCount=$(cat result.log | grep 'lost: 0 bytes in 0 blocks' | wc -l) +if [ $leakCount == 3 ] +then + echo "Ok" +else + echo "There was memory leaks!!!" + exit 1 +fi