forked from loafle/openapi-generator-original
cpp-qt5-client: add valgrind memory test (#3663)
This commit is contained in:
parent
d64ec14ab4
commit
1fc03c88b2
@ -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
|
||||
|
@ -26,3 +26,6 @@ SOURCES += main.cpp \
|
||||
HEADERS += PetApiTests.h \
|
||||
StoreApiTests.h \
|
||||
UserApiTests.h
|
||||
|
||||
# Disable optimisation for better valgrind report
|
||||
QMAKE_CXXFLAGS_DEBUG += -O0
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user