add auto memory leak check with valgrind to test script

This commit is contained in:
Pedro Flemming 2017-02-08 11:21:04 +01:00
parent 1f183147ec
commit d576350e1e
3 changed files with 35 additions and 7 deletions

View File

@ -4,17 +4,30 @@ language: cpp
install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get -qq update
- sudo apt-get install -y bison flex
- sudo apt-get install -y g++-4.8 libstdc++-4.8-dev
- sudo apt-get install -y flex valgrind
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90
# Install bison 3.0.4.
- wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz
- tar -xvzf bison-3.0.4.tar.gz
- cd bison-3.0.4
- ./configure && make && sudo make install
- cd ..
# Show installed versions.
- which g++
- g++ -v
- bison --version
- flex --version
- valgrind --version
compiler:
- gcc
- clang
script:
- make cleanall
- make
- make test

View File

@ -2,9 +2,11 @@
all: bison_parser.cpp flex_lexer.cpp
bison_parser.cpp: bison_parser.y
@bison --version | head -n 1
bison bison_parser.y -v
flex_lexer.cpp: flex_lexer.l
@flex --version
flex flex_lexer.l
clean:

View File

@ -1,15 +1,28 @@
#!/bin/bash
# has to be executed from the root of the repository
# Has to be executed from the root of the repository.
# Usually invoked by `make test`.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./
RET=0
# Running the tests.
bin/sql_grammar_test -f "test/lib/valid_queries.sql"
RET1=$?
RET=$(($RET + $?))
bin/sql_tests
RET2=$?
RET=$(($RET + $?))
if [[ $RET1 != 0 ]]; then exit $RET1; fi
if [[ $RET2 != 0 ]]; then exit $RET2; fi
# Running memory leak checks.
echo ""
echo "Running memory leak checks..."
exit 0
valgrind --leak-check=full --error-exitcode=1 \
./bin/sql_grammar_test -f "test/lib/valid_queries.sql" >> /dev/null
RET=$(($RET + $?))
valgrind --leak-check=full --error-exitcode=1 \
./bin/sql_tests -f "test/lib/valid_queries.sql" >> /dev/null
RET=$(($RET + $?))
exit $RET