Updated build test to use CMake

This commit is contained in:
fmp 2018-12-06 20:01:36 -05:00
parent df6c61657c
commit 1b31e7db1c

View File

@ -1,55 +1,63 @@
#!/bin/bash
#
# buildtst.sh for the Paho C++ library.
# buildtst.sh
#
# Test the build with a few compilers on Linux.
# Build test for the Paho C++ library.
#
# This does a build against the GNU Make, and runs the unit tests for each
# of the compilers in the list. If a particular compiler is not installed on
# the system, it is just skipped.
# This test the build with a few compilers on Linux. It does a build using
# CMake, for the library, tests, and examples, then runs the unit tests.
# This is repeated for each of the compilers in the list. If a particular
# compiler is not installed on the system, it is just skipped.
#
# This is not meant to replace Travis or other CI on the repo server, but
# is rather meant to be a quick test to use during development.
# is a quick test to use locally during development.
#
#COMPILERS="g++-4.8 g++-4.9 g++-5 g++-6 clang++-3.6 clang++-3.8"
COMPILERS="g++-5 g++-6 g++-7 g++-8 clang++-3.8 clang++-4.0 clang++-5.0 clang++-6.0"
[ "$#" -gt 0 ] && COMPILERS="$@"
[ -z "${BUILD_JOBS}" ] && BUILD_JOBS=4
[ -n "${PAHO_C_PATH}" ] && PAHO_C_SWITCH="-DCMAKE_PREFIX_PATH=${PAHO_C_PATH}"
for COMPILER in $COMPILERS
do
for COMPILER in $COMPILERS; do
if [ -z "$(which ${COMPILER})" ]; then
printf "Compiler not found: %s\n" "${COMPILER}"
else
printf "===== Testing: %s =====\n\n" "${COMPILER}"
make distclean
if ! make CXX=${COMPILER} SSL=1 -j${BUILD_JOBS} ; then
rm -rf buildtst-build/
mkdir buildtst-build ; pushd buildtst-build &> /dev/null
if ! cmake -DCMAKE_CXX_COMPILER=${COMPILER} -DPAHO_WITH_SSL=ON -DPAHO_BUILD_SAMPLES=ON ${PAHO_C_SWITCH} .. ; then
printf "\nCMake configuration failed for %s\n" "${COMPILER}"
exit 1
fi
if ! make -j${BUILD_JOBS} ; then
printf "\nCompilation failed for %s\n" "${COMPILER}"
exit 1
fi
pushd test/unit &> /dev/null
make clean
if ! make CXX=${COMPILER} SSL=1 ; then
printf "\nUnit test compilation failed for %s\n" "${COMPILER}"
exit 2
fi
rm -rf tmp/*
printf "Running unit tests:\n"
if ! ./mqttpp-unittest ; then
printf "\nUnit test failed for %s\n" "${COMPILER}"
exit 3
fi
make clean
#pushd test/unit &> /dev/null
#make clean
#if ! make CXX=${COMPILER} SSL=1 ; then
# printf "\nUnit test compilation failed for %s\n" "${COMPILER}"
# exit 2
#fi
#rm -rf tmp/*
#printf "Running unit tests:\n"
#if ! ./mqttpp-unittest ; then
# printf "\nUnit test failed for %s\n" "${COMPILER}"
# exit 3
#fi
#make clean
#popd &> /dev/null
popd &> /dev/null
fi
printf "\n"
done
make distclean
rm -rf buildtst-build/
printf "\n===== All tests completed successfully =====\n\n"
exit 0