Enable stricter checks for debug builds.

Use _GLIBCXX_DEBUG, _GLIBCXX_DEBUG_PEDANTIC, and _GLIBCXX_ASSERTIONS for the debug Ubuntu build.
This commit is contained in:
pentarctagon 2024-01-15 17:00:16 -06:00 committed by Pentarctagon
parent a0aef5550d
commit 453dbc685f
7 changed files with 26 additions and 14 deletions

View File

@ -51,8 +51,8 @@ jobs:
fail-fast: false
matrix:
include:
- { tool: scons, cc: gcc, cxx: g++, cfg: release, lto: true }
- { tool: cmake, cc: clang, cxx: clang++, cfg: debug, lto: false }
- { tool: scons, cc: gcc, cxx: g++, cfg: debug, lto: false }
- { tool: cmake, cc: clang, cxx: clang++, cfg: release, lto: true }
runs-on: ubuntu-latest
container:
image: wesnoth/wesnoth:2204-master
@ -70,16 +70,19 @@ jobs:
steps:
- { uses: actions/checkout@v3, with: { submodules: "recursive" } }
# wesnothd and campaignd should be buildable without SDL2 being present
# 1) wesnothd and campaignd should be buildable without SDL2 being present
# 2) boost is installed via apt as well as built and installed into /usr/local (for _GLIBCXX_DEBUG support in boost program options)
- name: Build wesnoth, wesnothd, campaignd and unit tests
id: build # needed to check step outcome
run: |
case $TOOL in
scons)
build() {
ldconfig
scons "$@" build="$CFG" ctool="$CC" cxxtool="$CXX" cxx_std="$CXX_STD" \
extra_flags_config="-pipe" strict=true forum_user_handler=true \
nls=false enable_lto="$LTO" force_color=true jobs=2 --debug=time
nls=false enable_lto="$LTO" force_color=true jobs=2 --debug=time \
glibcxx_debug=true glibcxx_assertions=true
}
build wesnoth boost_unit_tests
@ -89,10 +92,14 @@ jobs:
;;
cmake)
build() {
ldconfig
cmake "$@" -DCMAKE_BUILD_TYPE="$CFG" -DCXX_STD="$CXX_STD" \
-DEXTRA_FLAGS_CONFIG="-pipe" -DENABLE_STRICT_COMPILATION=true -DENABLE_MYSQL=true \
-DENABLE_NLS=false -DENABLE_LTO="$LTO" -DFORCE_COLOR_OUTPUT=true -DLTO_JOBS=2 .
}
rm -R /usr/local/lib/cmake
rm /usr/local/lib/libboost*
rm -R /usr/local/include/boost
build -DENABLE_GAME=true -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=true
make conftests
make VERBOSE=1 -j2
@ -118,7 +125,7 @@ jobs:
run: ./utils/CI/schema_validation.sh
- name: Run WML tests
if: success() || steps.build.outcome == 'success'
run: ./run_wml_tests -g -c -t 20
run: ./run_wml_tests -g -c -t 20 -bt 1000
- name: Run play tests
if: success() || steps.build.outcome == 'success'
run: ./utils/CI/play_test_executor.sh

View File

@ -202,9 +202,7 @@ Important switches include:
in build/release and copy resulting binaries
into distribution/working copy root.
build=debug same for debug build variant
binaries will be copied with -debug suffix
build=profile build with instrumentation for a supported profiler
binaries will be copied with -profile suffix
With no arguments, the recipe builds wesnoth and wesnothd. Available
build targets include the individual binaries:
@ -688,9 +686,6 @@ if env["use_srcdir"] == True:
else:
build_dir = os.path.join("$build_dir", build)
if build == "release" : build_suffix = ""
else : build_suffix = "-" + build
Export("build_suffix")
env.SConscript("src/SConscript", variant_dir = build_dir, duplicate = False)
Import(binaries + ["sources"])
binary_nodes = [eval(binary) for binary in binaries]
@ -796,7 +791,7 @@ env.InstallBinary(campaignd)
install = env.Alias('install', [])
for installable in ('wesnoth',
'wesnothd', 'campaignd'):
if os.path.exists(installable + build_suffix) or installable in COMMAND_LINE_TARGETS or "all" in COMMAND_LINE_TARGETS:
if os.path.exists(installable) or installable in COMMAND_LINE_TARGETS or "all" in COMMAND_LINE_TARGETS:
env.Alias('install', env.Alias('install-'+installable))
#

View File

@ -4,7 +4,7 @@
This script runs a sequence of C++ unit test scenarios.
"""
import argparse, enum, os, re, subprocess, sys
import argparse, os, subprocess, sys
def get_tests(filename):
test_list = []

View File

@ -148,9 +148,9 @@ def WesnothProgram(env, target, source, can_build, **kw):
if can_build:
if env["use_srcdir"] == True:
bin = env.Program(target + build_suffix, source, **kw)
bin = env.Program(target, source, **kw)
else:
bin = env.Program("#/" + target + build_suffix, source, **kw)
bin = env.Program("#/" + target, source, **kw)
env.Alias(target, bin)
else:
bin = env.Alias(target, [], error_action)

View File

@ -3,6 +3,9 @@ set -e #Error if any line errors
set -m #Enable job control
set -v #Print shell commands as they are read
if [ -f ./wesnoth ]; then client="./wesnoth"; else client="./wesnoth-debug"; fi
if [ -f ./wesnothd ]; then server="./wesnothd"; else server="./wesnothd-debug"; fi
TIMEOUT_TIME=300
LOOP_TIME=6

View File

@ -1,4 +1,5 @@
#!/bin/bash
gdb -q -batch -return-child-result -ex "set disable-randomization off" -ex "set style enabled on" -ex "run" -ex "thread apply all bt" -ex "quit" --args ./wesnoth -m --controller 1:ai --controller 2:ai --nogui 2> error.log
error_code="$?"
while grep -q 'Could not initialize SDL_video' error.log; do

View File

@ -24,3 +24,9 @@ RUN apt install -y -qq libpng16-16 libpng-dev libreadline6-dev libvorbis-dev lib
RUN apt install -y -qq openssl gdb xvfb bzip2 git scons cmake make ccache gcc g++ clang lld doxygen graphviz lua-check
WORKDIR /home/wesnoth-travis
# build another copy of boost with _GLIBCXX_DEBUG enabled, since program options requires this
COPY boost_1_74_0.tar.gz .
RUN tar -xvzf boost_1_74_0.tar.gz && cd boost_1_74_0 && ./bootstrap.sh --with-libraries=filesystem,locale,iostreams,program_options,regex,random,thread,coroutine,context,test && ./b2 -j2 variant=debug install cxxflags='-fstack-protector-strong' define=_GLIBCXX_DEBUG=1 define=_FORTIFY_SOURCE=2 address-model=64
RUN rm -R /home/wesnoth-travis/boost_1_74_0
RUN rm /home/wesnoth-travis/boost_1_74_0.tar.gz