forked from open-source-parsers/jsoncpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Refactor and enhance the CI testing infrastructure
1) Improve travis build script for use outside travis. Allow the script used for CI builds to also be used locally in a similar manner to the CI use of the scrips 2) Add ctest compatible testing and CDASH support Report testing and building results to https://my.cdash.org/index.php?project=jsoncpp NOTE: The new ctest infrastructure is not yet robust on winodws Do no yet enable the new features for running test with ctest on windows platform. The previous behaviors are maintainted, but enhance test reporting from windows is not yet supported. 3) Add a cmake coverage testing option Ensure that cmake builds on linux are tested. Ensure that code coverage is reported. 4) Move conditional environment checking into the matrix Avoid multiple places where conditional logic is used to change compiler behavior. As more test environments are created fromt the travis.yml matrix, all settings should be obvious from that one location. 5) Tests with known regressions from the jsonchecker are suppressed Tests that are known to pass with jsoncpp more lenient syntax enforcement are exluded from tests in test/runjsontests.py
- Loading branch information
1 parent
10a1a38
commit a3c8e86
Showing
12 changed files
with
341 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
#!/usr/bin/env sh | ||
# This script can be used on the command line directly to configure several | ||
# different build environments. | ||
# This is called by `.travis.yml` via Travis CI. | ||
# Travis supplies $TRAVIS_OS_NAME. | ||
# http://docs.travis-ci.com/user/multi-os/ | ||
# Our .travis.yml also defines: | ||
|
||
# - BUILD_TYPE=Release/Debug | ||
# - LIB_TYPE=static/shared | ||
# | ||
# Optional environmental variables | ||
# - DESTDIR <- used for setting the install prefix | ||
# - BUILD_TOOL=["Unix Makefile"|"Ninja"] | ||
# - BUILDNAME <-- how to identify this build on the dashboard | ||
# - DO_MemCheck <- if set, try to use valgrind | ||
# - DO_Coverage <- if set, try to do dashboard coverage testing | ||
# | ||
|
||
env_set=1 | ||
if ${BUILD_TYPE+false}; then | ||
echo "BUILD_TYPE not set in environment." | ||
env_set=0 | ||
fi | ||
if ${LIB_TYPE+false}; then | ||
echo "LIB_TYPE not set in environment." | ||
env_set=0 | ||
fi | ||
if ${CXX+false}; then | ||
echo "CXX not set in environment." | ||
env_set=0 | ||
fi | ||
|
||
|
||
if [ ${env_set} -eq 0 ]; then | ||
echo "USAGE: CXX=$(which clang++) BUILD_TYPE=[Release|Debug] LIB_TYPE=[static|shared] $0" | ||
echo "" | ||
echo "Examples:" | ||
echo " CXX=$(which clang++) BUILD_TYPE=Release LIB_TYPE=shared DESTDIR=/tmp/cmake_json_cpp $0" | ||
echo " CXX=$(which clang++) BUILD_TYPE=Debug LIB_TYPE=shared DESTDIR=/tmp/cmake_json_cpp $0" | ||
echo " CXX=$(which clang++) BUILD_TYPE=Release LIB_TYPE=static DESTDIR=/tmp/cmake_json_cpp $0" | ||
echo " CXX=$(which clang++) BUILD_TYPE=Debug LIB_TYPE=static DESTDIR=/tmp/cmake_json_cpp $0" | ||
|
||
echo " CXX=$(which g++) BUILD_TYPE=Release LIB_TYPE=shared DESTDIR=/tmp/cmake_json_cpp $0" | ||
echo " CXX=$(which g++) BUILD_TYPE=Debug LIB_TYPE=shared DESTDIR=/tmp/cmake_json_cpp $0" | ||
echo " CXX=$(which g++) BUILD_TYPE=Release LIB_TYPE=static DESTDIR=/tmp/cmake_json_cpp $0" | ||
echo " CXX=$(which g++) BUILD_TYPE=Debug LIB_TYPE=static DESTDIR=/tmp/cmake_json_cpp $0" | ||
|
||
exit -1 | ||
fi | ||
|
||
if ${DESTDIR+false}; then | ||
DESTDIR="/usr/local" | ||
fi | ||
|
||
# -e: fail on error | ||
# -v: show commands | ||
# -x: show expanded commands | ||
set -vex | ||
|
||
env | sort | ||
|
||
which cmake | ||
cmake --version | ||
|
||
echo ${CXX} | ||
${CXX} --version | ||
_COMPILER_NAME=`basename ${CXX}` | ||
if [ "${BUILD_TYPE}" == "shared" ]; then | ||
_CMAKE_BUILD_SHARED_LIBS=ON | ||
else | ||
_CMAKE_BUILD_SHARED_LIBS=OFF | ||
fi | ||
|
||
CTEST_TESTING_OPTION="-D ExperimentalTest" | ||
# - DO_MemCheck <- if set, try to use valgrind | ||
if ! ${DO_MemCheck+false}; then | ||
valgrind --version | ||
CTEST_TESTING_OPTION="-D ExperimentalMemCheck" | ||
else | ||
# - DO_Coverage <- if set, try to do dashboard coverage testing | ||
if ! ${DO_Coverage+false}; then | ||
export CXXFLAGS="-fprofile-arcs -ftest-coverage" | ||
export LDFLAGS="-fprofile-arcs -ftest-coverage" | ||
CTEST_TESTING_OPTION="-D ExperimentalTest -D ExperimentalCoverage" | ||
#gcov --version | ||
fi | ||
fi | ||
|
||
# Ninja = Generates build.ninja files. | ||
if ${BUILD_TOOL+false}; then | ||
BUILD_TOOL="Ninja" | ||
export _BUILD_EXE=ninja | ||
which ninja | ||
ninja --version | ||
else | ||
# Unix Makefiles = Generates standard UNIX makefiles. | ||
export _BUILD_EXE=make | ||
fi | ||
|
||
_BUILD_DIR_NAME="build-cmake_${BUILD_TYPE}_${LIB_TYPE}_${_COMPILER_NAME}_${_BUILD_EXE}" | ||
mkdir -p ${_BUILD_DIR_NAME} | ||
cd "${_BUILD_DIR_NAME}" | ||
if ${BUILDNAME+false}; then | ||
_HOSTNAME=`hostname -s` | ||
BUILDNAME="${_HOSTNAME}_${BUILD_TYPE}_${LIB_TYPE}_${_COMPILER_NAME}_${_BUILD_EXE}" | ||
fi | ||
cmake \ | ||
-G "${BUILD_TOOL}" \ | ||
-DBUILDNAME:STRING="${BUILDNAME}" \ | ||
-DCMAKE_CXX_COMPILER:PATH=${CXX} \ | ||
-DCMAKE_BUILD_TYPE:STRING=${BUILD_TYPE} \ | ||
-DBUILD_SHARED_LIBS:BOOL=${_CMAKE_BUILD_SHARED_LIBS} \ | ||
-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR} \ | ||
../ | ||
|
||
ctest -C ${BUILD_TYPE} -D ExperimentalStart -D ExperimentalConfigure -D ExperimentalBuild ${CTEST_TESTING_OPTION} -D ExperimentalSubmit | ||
# Final step is to verify that installation succeeds | ||
cmake --build . --config ${BUILD_TYPE} --target install | ||
|
||
if [ "${DESTDIR}" != "/usr/local" ]; then | ||
${_BUILD_EXE} install | ||
fi | ||
cd - | ||
|
||
if ${CLEANUP+false}; then | ||
echo "Skipping cleanup: build directory will persist." | ||
else | ||
rm -r "${_BUILD_DIR_NAME}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/usr/bin/env sh | ||
# This script can be used on the command line directly to configure several | ||
# different build environments. | ||
# This is called by `.travis.yml` via Travis CI. | ||
# Travis supplies $TRAVIS_OS_NAME. | ||
# http://docs.travis-ci.com/user/multi-os/ | ||
# Our .travis.yml also defines: | ||
|
||
# - BUILD_TYPE=release/debug | ||
# - LIB_TYPE=static/shared | ||
|
||
env_set=1 | ||
if ${BUILD_TYPE+false}; then | ||
echo "BUILD_TYPE not set in environment." | ||
env_set=0 | ||
fi | ||
if ${LIB_TYPE+false}; then | ||
echo "LIB_TYPE not set in environment." | ||
env_set=0 | ||
fi | ||
if ${CXX+false}; then | ||
echo "CXX not set in environment." | ||
env_set=0 | ||
fi | ||
|
||
|
||
if [ ${env_set} -eq 0 ]; then | ||
echo "USAGE: CXX=$(which clang++) BUILD_TYPE=[release|debug] LIB_TYPE=[static|shared] $0" | ||
echo "" | ||
echo "Examples:" | ||
echo " CXX=$(which clang++) BUILD_TYPE=release LIB_TYPE=shared DESTDIR=/tmp/meson_json_cpp $0" | ||
echo " CXX=$(which clang++) BUILD_TYPE=debug LIB_TYPE=shared DESTDIR=/tmp/meson_json_cpp $0" | ||
echo " CXX=$(which clang++) BUILD_TYPE=release LIB_TYPE=static DESTDIR=/tmp/meson_json_cpp $0" | ||
echo " CXX=$(which clang++) BUILD_TYPE=debug LIB_TYPE=static DESTDIR=/tmp/meson_json_cpp $0" | ||
|
||
echo " CXX=$(which g++) BUILD_TYPE=release LIB_TYPE=shared DESTDIR=/tmp/meson_json_cpp $0" | ||
echo " CXX=$(which g++) BUILD_TYPE=debug LIB_TYPE=shared DESTDIR=/tmp/meson_json_cpp $0" | ||
echo " CXX=$(which g++) BUILD_TYPE=release LIB_TYPE=static DESTDIR=/tmp/meson_json_cpp $0" | ||
echo " CXX=$(which g++) BUILD_TYPE=debug LIB_TYPE=static DESTDIR=/tmp/meson_json_cpp $0" | ||
|
||
exit -1 | ||
fi | ||
|
||
if ${DESTDIR+false}; then | ||
DESTDIR="/usr/local" | ||
fi | ||
|
||
# -e: fail on error | ||
# -v: show commands | ||
# -x: show expanded commands | ||
set -vex | ||
|
||
|
||
env | sort | ||
|
||
which python3 | ||
which meson | ||
which ninja | ||
echo ${CXX} | ||
${CXX} --version | ||
python3 --version | ||
meson --version | ||
ninja --version | ||
_COMPILER_NAME=`basename ${CXX}` | ||
_BUILD_DIR_NAME="build-${BUILD_TYPE}_${LIB_TYPE}_${_COMPILER_NAME}" | ||
meson --buildtype ${BUILD_TYPE} --default-library ${LIB_TYPE} . "${_BUILD_DIR_NAME}" | ||
ninja -v -j 2 -C "${_BUILD_DIR_NAME}" | ||
#ninja -v -j 2 -C "${_BUILD_DIR_NAME}" test | ||
cd "${_BUILD_DIR_NAME}" | ||
meson test --no-rebuild --print-errorlogs | ||
|
||
if [ "${DESTDIR}" != "/usr/local" ]; then | ||
ninja install | ||
fi | ||
cd - | ||
|
||
if ${CLEANUP+false}; then | ||
echo "Skipping cleanup: build directory will persist." | ||
else | ||
rm -r "${_BUILD_DIR_NAME}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## This file should be placed in the root directory of your project. | ||
## Then modify the CMakeLists.txt file in the root directory of your | ||
## project to incorporate the testing dashboard. | ||
## | ||
## # The following are required to submit to the CDash dashboard: | ||
## ENABLE_TESTING() | ||
## INCLUDE(CTest) | ||
|
||
set(CTEST_PROJECT_NAME "jsoncpp") | ||
set(CTEST_NIGHTLY_START_TIME "01:23:45 UTC") | ||
|
||
set(CTEST_DROP_METHOD "https") | ||
set(CTEST_DROP_SITE "my.cdash.org") | ||
set(CTEST_DROP_LOCATION "/submit.php?project=jsoncpp") | ||
set(CTEST_DROP_SITE_CDASH TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.