mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-21 16:45:07 +00:00
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:
parent
a0aef5550d
commit
453dbc685f
17
.github/workflows/ci-main.yml
vendored
17
.github/workflows/ci-main.yml
vendored
@ -51,8 +51,8 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- { tool: scons, cc: gcc, cxx: g++, cfg: release, lto: true }
|
- { tool: scons, cc: gcc, cxx: g++, cfg: debug, lto: false }
|
||||||
- { tool: cmake, cc: clang, cxx: clang++, cfg: debug, lto: false }
|
- { tool: cmake, cc: clang, cxx: clang++, cfg: release, lto: true }
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: wesnoth/wesnoth:2204-master
|
image: wesnoth/wesnoth:2204-master
|
||||||
@ -70,16 +70,19 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- { uses: actions/checkout@v3, with: { submodules: "recursive" } }
|
- { 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
|
- name: Build wesnoth, wesnothd, campaignd and unit tests
|
||||||
id: build # needed to check step outcome
|
id: build # needed to check step outcome
|
||||||
run: |
|
run: |
|
||||||
case $TOOL in
|
case $TOOL in
|
||||||
scons)
|
scons)
|
||||||
build() {
|
build() {
|
||||||
|
ldconfig
|
||||||
scons "$@" build="$CFG" ctool="$CC" cxxtool="$CXX" cxx_std="$CXX_STD" \
|
scons "$@" build="$CFG" ctool="$CC" cxxtool="$CXX" cxx_std="$CXX_STD" \
|
||||||
extra_flags_config="-pipe" strict=true forum_user_handler=true \
|
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
|
build wesnoth boost_unit_tests
|
||||||
|
|
||||||
@ -89,10 +92,14 @@ jobs:
|
|||||||
;;
|
;;
|
||||||
cmake)
|
cmake)
|
||||||
build() {
|
build() {
|
||||||
|
ldconfig
|
||||||
cmake "$@" -DCMAKE_BUILD_TYPE="$CFG" -DCXX_STD="$CXX_STD" \
|
cmake "$@" -DCMAKE_BUILD_TYPE="$CFG" -DCXX_STD="$CXX_STD" \
|
||||||
-DEXTRA_FLAGS_CONFIG="-pipe" -DENABLE_STRICT_COMPILATION=true -DENABLE_MYSQL=true \
|
-DEXTRA_FLAGS_CONFIG="-pipe" -DENABLE_STRICT_COMPILATION=true -DENABLE_MYSQL=true \
|
||||||
-DENABLE_NLS=false -DENABLE_LTO="$LTO" -DFORCE_COLOR_OUTPUT=true -DLTO_JOBS=2 .
|
-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
|
build -DENABLE_GAME=true -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=true
|
||||||
make conftests
|
make conftests
|
||||||
make VERBOSE=1 -j2
|
make VERBOSE=1 -j2
|
||||||
@ -118,7 +125,7 @@ jobs:
|
|||||||
run: ./utils/CI/schema_validation.sh
|
run: ./utils/CI/schema_validation.sh
|
||||||
- name: Run WML tests
|
- name: Run WML tests
|
||||||
if: success() || steps.build.outcome == 'success'
|
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
|
- name: Run play tests
|
||||||
if: success() || steps.build.outcome == 'success'
|
if: success() || steps.build.outcome == 'success'
|
||||||
run: ./utils/CI/play_test_executor.sh
|
run: ./utils/CI/play_test_executor.sh
|
||||||
|
@ -202,9 +202,7 @@ Important switches include:
|
|||||||
in build/release and copy resulting binaries
|
in build/release and copy resulting binaries
|
||||||
into distribution/working copy root.
|
into distribution/working copy root.
|
||||||
build=debug same for debug build variant
|
build=debug same for debug build variant
|
||||||
binaries will be copied with -debug suffix
|
|
||||||
build=profile build with instrumentation for a supported profiler
|
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
|
With no arguments, the recipe builds wesnoth and wesnothd. Available
|
||||||
build targets include the individual binaries:
|
build targets include the individual binaries:
|
||||||
@ -688,9 +686,6 @@ if env["use_srcdir"] == True:
|
|||||||
else:
|
else:
|
||||||
build_dir = os.path.join("$build_dir", build)
|
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)
|
env.SConscript("src/SConscript", variant_dir = build_dir, duplicate = False)
|
||||||
Import(binaries + ["sources"])
|
Import(binaries + ["sources"])
|
||||||
binary_nodes = [eval(binary) for binary in binaries]
|
binary_nodes = [eval(binary) for binary in binaries]
|
||||||
@ -796,7 +791,7 @@ env.InstallBinary(campaignd)
|
|||||||
install = env.Alias('install', [])
|
install = env.Alias('install', [])
|
||||||
for installable in ('wesnoth',
|
for installable in ('wesnoth',
|
||||||
'wesnothd', 'campaignd'):
|
'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))
|
env.Alias('install', env.Alias('install-'+installable))
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
This script runs a sequence of C++ unit test scenarios.
|
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):
|
def get_tests(filename):
|
||||||
test_list = []
|
test_list = []
|
||||||
|
@ -148,9 +148,9 @@ def WesnothProgram(env, target, source, can_build, **kw):
|
|||||||
|
|
||||||
if can_build:
|
if can_build:
|
||||||
if env["use_srcdir"] == True:
|
if env["use_srcdir"] == True:
|
||||||
bin = env.Program(target + build_suffix, source, **kw)
|
bin = env.Program(target, source, **kw)
|
||||||
else:
|
else:
|
||||||
bin = env.Program("#/" + target + build_suffix, source, **kw)
|
bin = env.Program("#/" + target, source, **kw)
|
||||||
env.Alias(target, bin)
|
env.Alias(target, bin)
|
||||||
else:
|
else:
|
||||||
bin = env.Alias(target, [], error_action)
|
bin = env.Alias(target, [], error_action)
|
||||||
|
@ -3,6 +3,9 @@ set -e #Error if any line errors
|
|||||||
set -m #Enable job control
|
set -m #Enable job control
|
||||||
set -v #Print shell commands as they are read
|
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
|
TIMEOUT_TIME=300
|
||||||
LOOP_TIME=6
|
LOOP_TIME=6
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/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
|
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="$?"
|
error_code="$?"
|
||||||
while grep -q 'Could not initialize SDL_video' error.log; do
|
while grep -q 'Could not initialize SDL_video' error.log; do
|
||||||
|
@ -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
|
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
|
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
|
Loading…
x
Reference in New Issue
Block a user