Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wesnoth/wesnoth
Browse files Browse the repository at this point in the history
  • Loading branch information
AI0867 committed Nov 6, 2017
2 parents 8ab8ff7 + bf8758a commit 7c5b312
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -133,6 +133,7 @@ userdata

# testing
/test*
/boost_unit_tests*
!/test_wrapper.sh
src/test
error*.log
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -33,7 +33,7 @@ matrix:
env: opt=-O0 CXXSTD=11 NLS=false

before_install:
- export TARGETS="wesnoth wesnothd campaignd test"
- export TARGETS="wesnoth wesnothd campaignd boost_unit_tests"
- export STRICT_COMPILATION=false
- export EXTRA_FLAGS_RELEASE=""
- export WML_TESTS=true CPP_TESTS=false PLAY_TEST=true MP_TEST=true
Expand Down
14 changes: 5 additions & 9 deletions CMakeLists.txt
Expand Up @@ -11,10 +11,6 @@ cmake_minimum_required(VERSION 2.6.0)

include(CheckCXXCompilerFlag)

if(COMMAND cmake_policy)
cmake_policy(SET CMP0005 OLD)
endif(COMMAND cmake_policy)

set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)

# use our own version of FindBoost.cmake and other Find* scripts
Expand Down Expand Up @@ -485,14 +481,14 @@ endif(UNIX AND NOT CMAKE_COMPILER_IS_GNUCXX)
set(DATADIR ${DATAROOTDIR}/${DATADIRNAME})

if(NOT WIN32)
add_definitions(-DWESNOTH_PATH=\\\"${DATADIR}\\\")
add_definitions(-DWESNOTH_PATH="${DATADIR}")
endif(NOT WIN32)

if(X11_FOUND)
add_definitions(-D_X11)
endif(X11_FOUND)

add_definitions(-DLOCALEDIR=\\\"${LOCALEDIR}\\\")
add_definitions(-DLOCALEDIR="${LOCALEDIR}")

# -NDEBUG is automatically added to all release build types, so manually remove
# this define from the related variables
Expand Down Expand Up @@ -677,15 +673,15 @@ else(LOCALEDIR MATCHES "^/")
set(LOCALE_INSTALL ${DATADIR}/${LOCALEDIR})
endif(LOCALEDIR MATCHES "^/")

add_definitions(-DFIFODIR=\\\"${FIFO_DIR}\\\")
add_definitions(-DFIFODIR="${FIFO_DIR}")

if(PREFERENCES_DIR)
add_definitions(-DPREFERENCES_DIR=\\\"${PREFERENCES_DIR}\\\")
add_definitions(-DPREFERENCES_DIR="${PREFERENCES_DIR"})
endif(PREFERENCES_DIR)
if(DEFAULT_PREFS_FILE)
add_definitions(-DDEFAULT_PREFS_PATH=\\\"${DEFAULT_PREFS_FILE}\\\")
add_definitions(-DDEFAULT_PREFS_PATH="${DEFAULT_PREFS_FILE"})

if(NOT DEFAULT_PREFS_FILE MATCHES "^/")
add_definitions(-DHAS_RELATIVE_DEFPREF)
Expand Down
12 changes: 6 additions & 6 deletions SConstruct
Expand Up @@ -46,7 +46,7 @@ def OptionalPath(key, val, env):

opts.AddVariables(
ListVariable('default_targets', 'Targets that will be built if no target is specified in command line.',
"wesnoth,wesnothd", Split("wesnoth wesnothd campaignd test")),
"wesnoth,wesnothd", Split("wesnoth wesnothd campaignd boost_unit_tests")),
EnumVariable('build', 'Build variant: release, debug, or profile', "release", ["release", "debug", "profile"]),
PathVariable('build_dir', 'Build all intermediate files(objects, test programs, etc) under this dir', "build", PathVariable.PathAccept),
('extra_flags_config', "Extra compiler and linker flags to use for configuration and all builds. Whether they're compiler or linker is determined by env.ParseFlags. Unknown flags are compile flags by default. This applies to all extra_flags_* variables", ""),
Expand Down Expand Up @@ -201,11 +201,11 @@ Important switches include:
With no arguments, the recipe builds wesnoth and wesnothd. Available
build targets include the individual binaries:
wesnoth wesnothd campaignd test
wesnoth wesnothd campaignd boost_unit_tests
You can make the following special build targets:
all = wesnoth wesnothd campaignd test (*).
all = wesnoth wesnothd campaignd boost_unit_tests (*).
TAGS = build tags for Emacs (*).
wesnoth-deps.png = project dependency graph
install = install all executables that currently exist, and any data needed
Expand Down Expand Up @@ -431,8 +431,8 @@ if env["prereqs"]:
have_test_prereqs = have_client_prereqs and conf.CheckBoost('unit_test_framework') \
or Warning("Unit tests are disabled because their prerequisites are not met")
test_env = conf.Finish()
if not have_test_prereqs and "test" in env["default_targets"]:
env["default_targets"].remove("test")
if not have_test_prereqs and "boost_unit_tests" in env["default_targets"]:
env["default_targets"].remove("boost_unit_tests")

print(" " + env.subst("If any config checks fail, look in $build_dir/config.log for details"))
print(" If a check fails spuriously due to caching, use --config=force to force its rerun")
Expand Down Expand Up @@ -595,7 +595,7 @@ except:
Export(Split("env client_env test_env have_client_prereqs have_server_prereqs have_test_prereqs"))
SConscript(dirs = Split("po doc packaging/windows packaging/systemd"))

binaries = Split("wesnoth wesnothd campaignd test")
binaries = Split("wesnoth wesnothd campaignd boost_unit_tests")
builds = {
"release" : dict(CCFLAGS = Split(rel_comp_flags) , LINKFLAGS = Split(rel_link_flags)),
"debug" : dict(CCFLAGS = Split(debug_flags) , CPPDEFINES = Split(glibcxx_debug_flags)),
Expand Down
5 changes: 5 additions & 0 deletions changelog
Expand Up @@ -4,6 +4,11 @@ Version 1.13.10+dev:
have linger=no in [end_level].
* A Tale of Two Brothers:
* Added a full set of hints on easy difficulty.
* Contiuous Integration (CI) and Unit testing
* Renamed the target and binary for the Boost unit tests from `test` to
`boost_unit_tests`. This quells warnings from CMake about reserved target
names, and reduces confusion about which `test` is intended: the wesnoth
executable or the standard shell command.
* Language and i18n:
* Updated translations: Chinese (Simplified)
* Lua API:
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/CMakeLists.txt
Expand Up @@ -485,7 +485,7 @@ if(ENABLE_TESTS)

add_definitions(-DBOOST_TEST_DYN_LINK)

GetSources("test" test_SRC)
GetSources("boost_unit_tests" test_SRC)

if(ENABLE_GAME)
set(test_LIB
Expand Down Expand Up @@ -514,16 +514,16 @@ if(ENABLE_TESTS)
"${CXX_FLAG_NO_USELESS_CAST}"
)

add_executable(test
add_executable(boost_unit_tests
${test_SRC}
)
target_link_libraries(test
target_link_libraries(boost_unit_tests
${test_LIB}
${game-external-libs}
boost_unit_test_framework
)
set_target_properties(test
PROPERTIES OUTPUT_NAME ${BINARY_PREFIX}test${BINARY_SUFFIX}
set_target_properties(boost_unit_tests
PROPERTIES OUTPUT_NAME ${BINARY_PREFIX}boost_unit_tests${BINARY_SUFFIX}
)

endif(ENABLE_TESTS)
Expand Down
8 changes: 4 additions & 4 deletions src/SConscript
Expand Up @@ -80,7 +80,7 @@ if env["png"]:
libwesnoth_sdl = client_env.Library("wesnoth_sdl", libwesnoth_sdl_sources)

#---wesnoth---
# Used by both 'wesnoth' and 'test' targets
# Used by both 'wesnoth' and 'boost_unit_tests' targets

wesnoth_sources = GetSources("wesnoth")

Expand Down Expand Up @@ -161,9 +161,9 @@ env.WesnothProgram("wesnothd", wesnothd_sources + [libwesnoth_core, env["wesnoth
campaignd_sources = GetSources("campaignd")
env.WesnothProgram("campaignd", campaignd_sources + [libwesnoth_core], have_server_prereqs, OBJPREFIX = "campaignd_")

#---test---
test_sources = GetSources("test")
test = test_env.WesnothProgram("test", test_sources + [libwesnoth_extras, libwesnoth_core, libwesnoth, libwesnoth_sdl, libwesnoth_extras], have_test_prereqs)
#---boost_unit_tests---
test_sources = GetSources("boost_unit_tests")
boost_unit_tests = test_env.WesnothProgram("boost_unit_tests", test_sources + [libwesnoth_extras, libwesnoth_core, libwesnoth, libwesnoth_sdl, libwesnoth_extras], have_test_prereqs)
#---end of getting sources---

sources = []
Expand Down
2 changes: 1 addition & 1 deletion utils/travis/test_executor.sh
@@ -1,3 +1,3 @@
#!/bin/bash
set -e
gdb -q -batch -return-child-result -ex "run" -ex "thread apply all bt" -ex "quit" --args ./test
gdb -q -batch -return-child-result -ex "run" -ex "thread apply all bt" -ex "quit" --args ./boost_unit_tests
8 changes: 4 additions & 4 deletions utils/travis/test_wrapper.sh
@@ -1,15 +1,15 @@
#!/bin/bash
COUNTER=10
./test
./boost_unit_tests
ERRORCODE=$?
while [ $COUNTER -gt 0 -a $ERRORCODE -eq 200 ]; do
echo "test gave error code 200 (segfault).. trying again."
echo "boost_unit_tests gave error code 200 (segfault).. trying again."
COUNTER=$((COUNTER-1))
./test
./boost_unit_tests
ERRORCODE=$?
done
if [ $ERRORCODE -eq 200 ]; then
echo "test gave error code 200 ten times. suppressing this error...\n"
echo "boost_unit_tests gave error code 200 ten times. suppressing this error...\n"
ERRORCODE=0
fi
export TEST_ERROR_CODE="$ERRORCODE"
Expand Down

0 comments on commit 7c5b312

Please sign in to comment.