1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#!/bin/bash
set -e
check_status()
{
STATUS=`git status -s`
if [ "$STATUS"x = ""x ]; then
#Success
return 0;
else
#Failure
echo "ERROR: Directory is not clean. Please clean it up during the tests, or update .gitignore file"
git status
return 1;
fi
}
if [ "$TEST"x = "coverage"x ]; then
CONFIGURE_FLAGS="--enable-gcov"
fi
if [ "$TEST"x = "doc"x ]; then
CONFIGURE_FLAGS="--enable-gtk-doc"
fi
if [ "$COMPILER"x = "gcc"x ]; then
export CC="gcc"
export CXX="g++"
elif [ "$COMPILER"x = "clang"x ]; then
export CC="clang"
export CXX="clang++"
fi
./autogen.sh
mkdir bin && cd bin
if [ -n "$COMPILER" ]; then
../configure --enable-debug --enable-silent-rules --disable-warnings $CONFIGURE_FLAGS
make
fi
if [ "$TEST"x = "install"x ]; then
sudo make install
denemo -n -a "(d-Quit)"
fi
if [ "$TEST"x = "integration"x ]; then
make distcheck
rm -rf denemo-*.tar.gz
fi
if [ "$TEST"x = "coverage"x ]; then
make check
fi
if [ "$TEST"x = "cppcheck"x ]; then
cd ..
cppcheck --force --enable=unusedFunction --template '{file}:{line} — {severity} — {id} — {message}' -q -I include src tools
fi
#Should be the last command ran, it checks that the repository is clean after tests are ran.
check_status
|