Merge lp:~widelands-dev/widelands/bug-1830868-skip-tests into lp:widelands

Proposed by Notabilis
Status: Merged
Merged at revision: 9150
Proposed branch: lp:~widelands-dev/widelands/bug-1830868-skip-tests
Merge into: lp:widelands
Diff against target: 131 lines (+42/-13)
3 files modified
CMakeLists.txt (+13/-10)
cmake/WlFunctions.cmake (+6/-0)
compile.sh (+23/-3)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1830868-skip-tests
Reviewer Review Type Date Requested Status
GunChleoc Approve
Review via email: mp+368858@code.launchpad.net

Commit message

Adding compile.sh switch -s to skip building the tests.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 5195. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/546082615.
Appveyor build 4975. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1830868_skip_tests-4975.

Revision history for this message
GunChleoc (gunchleoc) wrote :

LGTM :)

The inputqueues test again

@bunnybot merge force

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2019-05-09 06:43:00 +0000
3+++ CMakeLists.txt 2019-06-15 09:39:05 +0000
4@@ -48,6 +48,7 @@
5 option(OPTION_GLEW_STATIC "Use static GLEW Library" OFF)
6 option(OPTION_BUILD_WEBSITE_TOOLS "Build website-related tools" ON)
7 option(OPTION_BUILD_TRANSLATIONS "Build translations" ON)
8+option(OPTION_BUILD_TESTS "Build tests" ON)
9
10 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
11 message(FATAL_ERROR "Build directory and source directory must not be the same.")
12@@ -298,17 +299,19 @@
13 endif (NOT DEFINED WL_VERSION)
14
15 # Enable testing.
16-include(CTest)
17-enable_testing()
18+if (OPTION_BUILD_TESTS)
19+ include(CTest)
20+ enable_testing()
21
22-# Run a test after a normal compile. This magic is needed as 'make test' will
23-# not rebuild tests:
24-# http://stackoverflow.com/questions/733475/cmake-ctest-make-test-doesnt-build-tests
25-add_custom_target(_run_all_tests ALL
26- COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
27- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
28- DEPENDS wl_tests
29-)
30+ # Run a test after a normal compile. This magic is needed as 'make test' will
31+ # not rebuild tests:
32+ # http://stackoverflow.com/questions/733475/cmake-ctest-make-test-doesnt-build-tests
33+ add_custom_target(_run_all_tests ALL
34+ COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
35+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
36+ DEPENDS wl_tests
37+ )
38+endif (OPTION_BUILD_TESTS)
39
40 install (
41 FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION
42
43=== modified file 'cmake/WlFunctions.cmake'
44--- cmake/WlFunctions.cmake 2019-04-18 12:46:07 +0000
45+++ cmake/WlFunctions.cmake 2019-06-15 09:39:05 +0000
46@@ -178,6 +178,12 @@
47
48 # Common test target definition.
49 function(wl_test NAME)
50+
51+ if (NOT OPTION_BUILD_TESTS)
52+ return()
53+ endif()
54+
55+
56 _parse_common_args("${ARGN}")
57
58 add_executable(${NAME} ${ARG_SRCS})
59
60=== modified file 'compile.sh'
61--- compile.sh 2018-12-06 21:59:09 +0000
62+++ compile.sh 2019-06-15 09:39:05 +0000
63@@ -38,6 +38,9 @@
64 echo "-t or --no-translations"
65 echo " Omit building translations."
66 echo " "
67+ echo "-s or --skip-tests"
68+ echo " Skip linking and executing the tests."
69+ echo " "
70 echo "-a or --no-asan If in debug mode, switch off the AddressSanitizer."
71 echo " Release builds are created without AddressSanitizer"
72 echo " by default."
73@@ -81,6 +84,7 @@
74 ## Options to control the build.
75 BUILD_WEBSITE="ON"
76 BUILD_TRANSLATIONS="ON"
77+BUILD_TESTS="ON"
78 BUILD_TYPE="Debug"
79 USE_ASAN="ON"
80 COMPILER="default"
81@@ -128,6 +132,10 @@
82 BUILD_TRANSLATIONS="OFF"
83 shift
84 ;;
85+ -s|--skip-tests)
86+ BUILD_TESTS="OFF"
87+ shift
88+ ;;
89 -w|--no-website)
90 BUILD_WEBSITE="OFF"
91 shift
92@@ -169,7 +177,14 @@
93 echo "Translations will be built."
94 echo "You can use -t or --no-translations to omit building them."
95 else
96-echo "Translations will not be built."
97+ echo "Translations will not be built."
98+fi
99+echo " "
100+if [ $BUILD_TESTS = "ON" ]; then
101+ echo "Tests will be built."
102+ echo "You can use -s or --skip-tests to omit building them."
103+else
104+ echo "Tests will not be built."
105 fi
106 echo " "
107 echo "###########################################################"
108@@ -245,9 +260,9 @@
109 # Compile Widelands
110 compile_widelands () {
111 if [ $buildtool = "ninja" ] || [ $buildtool = "ninja-build" ] ; then
112- cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DOPTION_BUILD_WEBSITE_TOOLS=$BUILD_WEBSITE -DOPTION_BUILD_TRANSLATIONS=$BUILD_TRANSLATIONS -DOPTION_ASAN=$USE_ASAN
113+ cmake -G Ninja .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DOPTION_BUILD_WEBSITE_TOOLS=$BUILD_WEBSITE -DOPTION_BUILD_TRANSLATIONS=$BUILD_TRANSLATIONS -DOPTION_BUILD_TESTS=$BUILD_TESTS -DOPTION_ASAN=$USE_ASAN
114 else
115- cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DOPTION_BUILD_WEBSITE_TOOLS=$BUILD_WEBSITE -DOPTION_BUILD_TRANSLATIONS=$BUILD_TRANSLATIONS -DOPTION_ASAN=$USE_ASAN
116+ cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DOPTION_BUILD_WEBSITE_TOOLS=$BUILD_WEBSITE -DOPTION_BUILD_TRANSLATIONS=$BUILD_TRANSLATIONS -DOPTION_BUILD_TESTS=$BUILD_TESTS -DOPTION_ASAN=$USE_ASAN
117 fi
118
119 $buildtool -j $CORES
120@@ -339,6 +354,11 @@
121 else
122 echo "# - No translations #"
123 fi
124+if [ $BUILD_TESTS = "ON" ]; then
125+ echo "# - Tests #"
126+else
127+ echo "# - No tests #"
128+fi
129
130 if [ $BUILD_WEBSITE = "ON" ]; then
131 echo "# - Website-related executables #"

Subscribers

People subscribed via source and target branches

to status/vote changes: