Skip to content

Commit

Permalink
Renamed the target and binary for the Boost unit tests from test to…
Browse files Browse the repository at this point in the history
… `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.
  • Loading branch information
GregoryLundberg authored and jyrkive committed Nov 6, 2017
1 parent 9019074 commit d091391
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 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
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

0 comments on commit d091391

Please sign in to comment.