-
-
Notifications
You must be signed in to change notification settings - Fork 988
/
docker_run.sh
executable file
·150 lines (122 loc) · 3.92 KB
/
docker_run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
# set the fake display for unit tests
export DISPLAY=:99.0
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1024x768x24
# name the parameters
NLS="$1"
TOOL="$2"
CC="$3"
CXX="$4"
CXXSTD="$5"
OPT="$6"
WML_TESTS="$7"
WML_TEST_TIME="$8"
PLAY_TEST="$9"
MP_TEST="${10}"
BOOST_TEST="${11}"
LTO="${12}"
SAN="${13}"
if [ "$OPT" == "-O0" ]; then
STRICT="true"
build_timeout=35
else
STRICT="false"
build_timeout=40
fi
if [ "$CXXSTD" == "17" ]; then
STRICT="true"
fi
echo "Using configuration:"
echo "NLS: $NLS"
echo "TOOL: $TOOL"
echo "CC: $CC"
echo "CXX: $CXX"
echo "CXXSTD: $CXXSTD"
echo "OPT: $OPT"
echo "WML_TESTS: $WML_TESTS"
echo "WML_TEST_TIME: $WML_TEST_TIME"
echo "PLAY_TEST: $PLAY_TEST"
echo "MP_TEST: $MP_TEST"
echo "BOOST_TEST: $BOOST_TEST"
echo "LTO: $LTO"
echo "SAN: $SAN"
echo "STRICT: $STRICT"
echo "build_timeout(mins): $build_timeout"
$CXX --version
if [ "$NLS" == "true" ]; then
if [ "$TOOL" == "cmake" ]; then
cmake -DENABLE_NLS=true -DENABLE_GAME=false -DENABLE_SERVER=false -DENABLE_CAMPAIGN_SERVER=false -DENABLE_TESTS=false && make VERBOSE=1 -j2
else
scons translations build=release --debug=time nls=true jobs=2
fi
else
build_start=$(date +%s)
if [ "$TOOL" == "cmake" ]; then
echo "max_size = 200M" > $HOME/.ccache/ccache.conf
echo "compiler_check = content" >> $HOME/.ccache/ccache.conf
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GAME=true -DENABLE_SERVER=true -DENABLE_CAMPAIGN_SERVER=true -DENABLE_TESTS=true -DENABLE_NLS=false \
-DEXTRA_FLAGS_CONFIG="-pipe" -DOPT="$OPT" -DENABLE_STRICT_COMPILATION="$STRICT" -DENABLE_LTO="$LTO" -DLTO_JOBS=2 -DENABLE_MYSQL=true \
-DCXX_STD="$CXXSTD" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache && \
make VERBOSE=1 -j2
BUILD_RET=$?
ccache -s
ccache -z
else
scons wesnoth wesnothd campaignd boost_unit_tests build=release \
ctool=$CC cxxtool=$CXX cxx_std=$CXXSTD \
extra_flags_config="-pipe" opt="$OPT" strict="$STRICT" forum_user_handler=true \
nls=false enable_lto="$LTO" sanitize="$SAN" jobs=2 --debug=time
BUILD_RET=$?
fi
if [ $BUILD_RET != 0 ]; then
exit $BUILD_RET
fi
build_end=$(date +%s)
if (( build_end-build_start > 60*build_timeout )); then
echo "Insufficient time remaining to execute unit tests. Exiting now to allow caching to occur. Please restart the job."
exit 1
fi
# needed since docker returns the exit code of the final command executed, so a failure needs to be returned if any unit tests fail
EXIT_VAL=0
if [ "$WML_TESTS" == "true" ]; then
echo "Executing run_wml_tests"
./run_wml_tests -g -v -c -t "$WML_TEST_TIME"
RET=$?
if [ $RET != 0 ]; then
echo "WML tests failed!"
EXIT_VAL=$RET
fi
fi
if [ "$PLAY_TEST" == "true" ]; then
echo "Executing play_test_executor.sh"
./utils/travis/play_test_executor.sh
RET=$?
if [ $RET != 0 ]; then
echo "Play tests failed!"
EXIT_VAL=$RET
fi
fi
if [ "$MP_TEST" == "true" ]; then
echo "Executing mp_test_executor.sh"
./utils/travis/mp_test_executor.sh
RET=$?
if [ $RET != 0 ]; then
echo "MP tests failed!"
EXIT_VAL=$RET
fi
fi
if [ "$BOOST_TEST" == "true" ]; then
echo "Executing boost unit tests"
./utils/travis/test_executor.sh
RET=$?
if [ $RET != 0 ]; then
echo "Boost tests failed!"
EXIT_VAL=$RET
fi
fi
if [ -f "errors.log" ]; then
echo -e "\n*** \n*\n* Errors reported in wml unit tests, here is errors.log...\n*\n*** \n"
cat errors.log
fi
exit $EXIT_VAL
fi