mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-24 19:49:49 +00:00
Re-add unit tests to docker runs.
This commit is contained in:
parent
489eed7760
commit
9dcf25452b
27
.travis.yml
27
.travis.yml
@ -29,21 +29,13 @@ matrix:
|
||||
env: CXXSTD=11 NLS=false TOOL=scons OPT=-O0
|
||||
|
||||
before_install:
|
||||
- export TARGETS="wesnoth wesnothd campaignd boost_unit_tests"
|
||||
- export EXTRA_FLAGS_RELEASE=""
|
||||
- export WML_TESTS=true
|
||||
- export CPP_TESTS=false
|
||||
- export PLAY_TEST=true
|
||||
- export MP_TEST=true
|
||||
- export WML_TEST_TIME=15
|
||||
- export BOOST_TEST=false
|
||||
|
||||
- if [ "$NLS" == "true" ]; then
|
||||
export TARGETS="translations";
|
||||
export WML_TESTS=false;
|
||||
export CPP_TESTS=false;
|
||||
export PLAY_TEST=false;
|
||||
export MP_TEST=false;
|
||||
fi
|
||||
- if [ "$OPT" == "-O0" ]; then
|
||||
export EXTRA_FLAGS_RELEASE="-O0";
|
||||
export PLAY_TEST=false;
|
||||
@ -57,7 +49,7 @@ install:
|
||||
export CXXFLAGS="-I/usr/local/opt/openssl/include $CFLAGS";
|
||||
export LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS";
|
||||
else
|
||||
docker build -t wesnoth-ubuntu:16.04 .;
|
||||
docker build -t wesnoth-ubuntu:16.04 -f Dockerfile1604 .;
|
||||
fi
|
||||
|
||||
script:
|
||||
@ -65,25 +57,14 @@ script:
|
||||
./utils/travis/check_utf8.sh;
|
||||
./utils/travis/utf8_bom_dog.sh;
|
||||
$CXX --version;
|
||||
scons cxxtool=$CXX ctool=$CC --debug=time build=release extra_flags_config="-pipe" extra_flags_release="$EXTRA_FLAGS_RELEASE" strict=true $TARGETS cxx_std=$CXXSTD nls=$NLS jobs=2;
|
||||
scons wesnoth wesnothd campaignd boost_unit_tests build=release ctool=$CC cxxtool=$CXX --debug=time extra_flags_config="-pipe" extra_flags_release="$EXTRA_FLAGS_RELEASE" strict=true cxx_std=$CXXSTD nls=$NLS jobs=2;
|
||||
else
|
||||
export DISPLAY=:99.0;
|
||||
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x24;
|
||||
|
||||
if [ "$TOOL" == "cmake" ]; then
|
||||
docker run wesnoth-ubuntu:16.04 bash -c "$CXX --version; cmake -DCMAKE_BUILD_TYPE=Release -DEXTRA_FLAGS_CONFIG="-pipe" -DEXTRA_FLAGS_RELEASE="$EXTRA_FLAGS_RELEASE" -DENABLE_STRICT_COMPILATION=true -DENABLE_NLS=$NLS -DENABLE_TESTS=$CPP_TESTS && make VERBOSE=1 -j2";
|
||||
else
|
||||
docker run wesnoth-ubuntu:16.04 bash -c "$CXX --version; scons cxxtool=$CXX ctool=$CC --debug=time build=release extra_flags_config="-pipe" extra_flags_release="$EXTRA_FLAGS_RELEASE" strict=true $TARGETS cxx_std=$CXXSTD nls=$NLS jobs=2";
|
||||
fi
|
||||
docker run wesnoth-ubuntu:16.04 bash -c "./docker_run.sh \"$NLS\" \"$TOOL\" \"$CC\" \"$CXX\" \"$CXXSTD\" \"$EXTRA_FLAGS_RELEASE\" \"$WML_TESTS\" \"$WML_TEST_TIME\" \"$PLAY_TEST\" \"$MP_TEST\" \"$BOOST_TEST\"";
|
||||
fi
|
||||
|
||||
after_failure:
|
||||
- if [ -f "errors.log" ]; then
|
||||
echo -e "\n*** \n*\n* Errors reported in wml unit tests, here is errors.log...\n*\n*** \n";
|
||||
cat errors.log;
|
||||
fi
|
||||
- ./utils/travis/test_executor.sh;
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
irc:
|
||||
|
@ -4,7 +4,7 @@ COPY ./ /home/wesnoth-travis/
|
||||
|
||||
RUN apt update
|
||||
RUN apt install -y -qq apt-utils
|
||||
RUN apt install -y -qq libboost-filesystem1.58-dev libboost-filesystem1.58.0 libboost-iostreams1.58-dev libboost-iostreams1.58.0 libboost-locale1.58-dev libboost-locale1.58.0 libboost-regex1.58-dev libboost-regex1.58.0 libboost-serialization1.58-dev libboost-serialization1.58.0 libasio-dev libboost-program-options1.58-dev libboost-program-options1.58.0 libboost-random1.58-dev libboost-random1.58.0 libboost-system1.58-dev libboost-system1.58.0 libboost-thread1.58-dev libboost-thread1.58.0 libboost-test-dev libbz2-1.0 libbz2-dev bzip2 zlib1g zlib1g-dev libpangocairo-1.0-0 libssl-dev libsdl2-2.0-0 libsdl2-dev libsdl2-image-2.0-0 libsdl2-image-dev libsdl2-mixer-2.0-0 libsdl2-mixer-dev libsdl2-ttf-2.0-0 libsdl2-ttf-dev libpng12-0 libpng12-dev libreadline6-dev libvorbis-dev libcairo2 libcairo2-dev libpango-1.0-0 libpango1.0-dev libfribidi0 libfribidi-dev git scons gcc g++ make cmake clang openssl
|
||||
RUN apt install -y -qq libboost-filesystem1.58-dev libboost-filesystem1.58.0 libboost-iostreams1.58-dev libboost-iostreams1.58.0 libboost-locale1.58-dev libboost-locale1.58.0 libboost-regex1.58-dev libboost-regex1.58.0 libboost-serialization1.58-dev libboost-serialization1.58.0 libasio-dev libboost-program-options1.58-dev libboost-program-options1.58.0 libboost-random1.58-dev libboost-random1.58.0 libboost-system1.58-dev libboost-system1.58.0 libboost-thread1.58-dev libboost-thread1.58.0 libboost-test-dev libbz2-1.0 libbz2-dev bzip2 zlib1g zlib1g-dev libpangocairo-1.0-0 libssl-dev libsdl2-2.0-0 libsdl2-dev libsdl2-image-2.0-0 libsdl2-image-dev libsdl2-mixer-2.0-0 libsdl2-mixer-dev libsdl2-ttf-2.0-0 libsdl2-ttf-dev libpng12-0 libpng12-dev libreadline6-dev libvorbis-dev libcairo2 libcairo2-dev libpango-1.0-0 libpango1.0-dev libfribidi0 libfribidi-dev git scons gcc g++ make cmake clang openssl gdb xvfb
|
||||
|
||||
WORKDIR /home/wesnoth-travis
|
||||
|
109
docker_run.sh
Executable file
109
docker_run.sh
Executable file
@ -0,0 +1,109 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set the fake display for unit tests
|
||||
export DISPLAY=:99.0
|
||||
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x24
|
||||
|
||||
# name the parameters
|
||||
NLS="$1"
|
||||
TOOL="$2"
|
||||
CC="$3"
|
||||
CXX="$4"
|
||||
CXXSTD="$5"
|
||||
EXTRA_FLAGS_RELEASE="$6"
|
||||
WML_TESTS="$7"
|
||||
WML_TEST_TIME="$8"
|
||||
PLAY_TEST="$9"
|
||||
MP_TEST="${10}"
|
||||
BOOST_TEST="${11}"
|
||||
|
||||
# only enable strict builds when no optimizations are done
|
||||
if [ "$EXTRA_FLAGS_RELEASE" == "-O0" ]; then
|
||||
STRICT="true"
|
||||
else
|
||||
STRICT="false"
|
||||
fi
|
||||
|
||||
echo "Using configuration:"
|
||||
echo "NLS: $NLS"
|
||||
echo "TOOL: $TOOL"
|
||||
echo "CC: $CC"
|
||||
echo "CXX: $CXX"
|
||||
echo "CXXSTD: $CXXSTD"
|
||||
echo "EXTRA_FLAGS_RELEASE: $EXTRA_FLAGS_RELEASE"
|
||||
echo "WML_TESTS: $WML_TESTS"
|
||||
echo "WML_TEST_TIME: $WML_TEST_TIME"
|
||||
echo "PLAY_TEST: $PLAY_TEST"
|
||||
echo "MP_TEST: $MP_TEST"
|
||||
echo "BOOST_TEST: $BOOST_TEST"
|
||||
|
||||
$CXX --version
|
||||
|
||||
# if doing the translations, don't build anything else
|
||||
if [ "$NLS" == "true" ]; then
|
||||
if [ "$TOOL" == "cmake" ]; then
|
||||
cmake -DENABLE_NLS=true -DENABLE_GAME=false -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=false && make VERBOSE=1 -j2
|
||||
else
|
||||
scons translations build=release --debug=time nls=true jobs=2
|
||||
fi
|
||||
else
|
||||
# if not doing the translations, build wesnoth, wesnothd, campaignd, boost_unit_tests
|
||||
if [ "$TOOL" == "cmake" ]; then
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GAME=true -DENABLE_SERVER=true -DENABLE_CAMPAIGN_SERVER=true -DENABLE_TESTS=true -DENABLE_NLS=false -DEXTRA_FLAGS_CONFIG="-pipe" -DEXTRA_FLAGS_RELEASE="$EXTRA_FLAGS_RELEASE" -DENABLE_STRICT_COMPILATION="$STRICT" && make VERBOSE=1 -j2
|
||||
else
|
||||
scons wesnoth wesnothd campaignd boost_unit_tests build=release ctool=$CC cxxtool=$CXX --debug=time extra_flags_config="-pipe" extra_flags_release="$EXTRA_FLAGS_RELEASE" strict="$STRICT" cxx_std=$CXXSTD nls=false jobs=2
|
||||
fi
|
||||
|
||||
# check if the build was successful
|
||||
BUILD_RET=$?
|
||||
if [ $BUILD_RET != 0 ]; then
|
||||
exit $BUILD_RET
|
||||
fi
|
||||
|
||||
# needed since docker returns the exit code of the final comman executed, so a failure needs to be returned if any unit tests fail
|
||||
EXIT_VAL=0
|
||||
|
||||
if [ "$WML_TESTS" == "true" ]; then
|
||||
echo "Executing run_wml_tests"
|
||||
./run_wml_tests -g -v -c -t "$WML_TEST_TIME"
|
||||
RET=$?
|
||||
if [ $RET != 0 ]; then
|
||||
EXIT_VAL=$RET
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$PLAY_TEST" == "true" ]; then
|
||||
echo "Executing play_test_executor.sh"
|
||||
./utils/travis/play_test_executor.sh
|
||||
RET=$?
|
||||
if [ $RET != 0 ]; then
|
||||
EXIT_VAL=$RET
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$MP_TEST" == "true" ]; then
|
||||
echo "Executing mp_test_executor.sh"
|
||||
./utils/travis/mp_test_executor.sh
|
||||
RET=$?
|
||||
if [ $RET != 0 ]; then
|
||||
EXIT_VAL=$RET
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$BOOST_TEST" == "true" ]; then
|
||||
echo "Executing boost unit tests"
|
||||
./utils/travis/test_wrapper.sh
|
||||
RET=$?
|
||||
if [ $RET != 0 ]; then
|
||||
EXIT_VAL=$RET
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "errors.log" ]; then
|
||||
echo -e "\n*** \n*\n* Errors reported in wml unit tests, here is errors.log...\n*\n*** \n"
|
||||
cat errors.log
|
||||
./utils/travis/test_executor.sh
|
||||
fi
|
||||
|
||||
exit $EXIT_VAL
|
||||
fi
|
@ -17,7 +17,6 @@ include_directories(SYSTEM ${VORBISFILE_INCLUDE_DIR} )
|
||||
|
||||
include_directories(SYSTEM ${SDL2_INCLUDE_DIR} )
|
||||
set(sdl-lib ${SDL2_LIBRARY})
|
||||
set(sdlmain-lib ${SDL2MAIN_LIBRARY})
|
||||
#optional dependencies
|
||||
if(SDL2IMAGE_INCLUDE_DIR)
|
||||
include_directories(SYSTEM ${SDL2IMAGE_INCLUDE_DIR} )
|
||||
|
Loading…
x
Reference in New Issue
Block a user