Commit | Line | Data |
---|---|---|
51c9c62d | 1 | #!/bin/bash |
09d45745 | 2 | # shellcheck disable=SC2103 |
b4005bbf | 3 | # |
09d45745 | 4 | # Copyright (C) 2016 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com> |
7361d941 | 5 | # Copyright (C) 2016-2020 Michael Jeanson <mjeanson@efficios.com> |
b4005bbf MJ |
6 | # |
7 | # This program is free software: you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation, either version 3 of the License, or | |
10 | # (at your option) any later version. | |
11 | # | |
12 | # This program is distributed in the hope that it will be useful, | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | # GNU General Public License for more details. | |
16 | # | |
17 | # You should have received a copy of the GNU General Public License | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | ||
51c9c62d MJ |
20 | set -exu |
21 | ||
0cdaa21c | 22 | # Version compare functions |
b6e62a6a MJ |
23 | vercomp () { |
24 | set +u | |
25 | if [[ "$1" == "$2" ]]; then | |
26 | return 0 | |
27 | fi | |
28 | local IFS=. | |
4afa623f MJ |
29 | # Ignore the shellcheck warning, we want splitting to happen based on IFS. |
30 | # shellcheck disable=SC2206 | |
b6e62a6a MJ |
31 | local i ver1=($1) ver2=($2) |
32 | # fill empty fields in ver1 with zeros | |
33 | for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do | |
34 | ver1[i]=0 | |
35 | done | |
36 | for ((i=0; i<${#ver1[@]}; i++)); do | |
37 | if [[ -z ${ver2[i]} ]]; then | |
38 | # fill empty fields in ver2 with zeros | |
39 | ver2[i]=0 | |
40 | fi | |
41 | if ((10#${ver1[i]} > 10#${ver2[i]})); then | |
42 | return 1 | |
43 | fi | |
44 | if ((10#${ver1[i]} < 10#${ver2[i]})); then | |
45 | return 2 | |
46 | fi | |
47 | done | |
48 | set -u | |
49 | return 0 | |
50 | } | |
51 | ||
0cdaa21c | 52 | verlte() { |
b6e62a6a MJ |
53 | vercomp "$1" "$2"; local res="$?" |
54 | [ "$res" -eq "0" ] || [ "$res" -eq "2" ] | |
0cdaa21c MJ |
55 | } |
56 | ||
57 | verlt() { | |
b6e62a6a MJ |
58 | vercomp "$1" "$2"; local res="$?" |
59 | [ "$res" -eq "2" ] | |
0cdaa21c MJ |
60 | } |
61 | ||
62 | vergte() { | |
b6e62a6a MJ |
63 | vercomp "$1" "$2"; local res="$?" |
64 | [ "$res" -eq "0" ] || [ "$res" -eq "1" ] | |
0cdaa21c MJ |
65 | } |
66 | ||
67 | vergt() { | |
b6e62a6a MJ |
68 | vercomp "$1" "$2"; local res="$?" |
69 | [ "$res" -eq "1" ] | |
70 | } | |
71 | ||
72 | verne() { | |
73 | vercomp "$1" "$2"; local res="$?" | |
74 | [ "$res" -ne "0" ] | |
0cdaa21c MJ |
75 | } |
76 | ||
51c9c62d MJ |
77 | failed_configure() { |
78 | # Assume we are in the configured build directory | |
79 | echo "#################### BEGIN config.log ####################" | |
80 | cat config.log | |
81 | echo "#################### END config.log ####################" | |
82 | ||
83 | # End the build with failure | |
84 | exit 1 | |
85 | } | |
86 | ||
54c3c7ec JR |
87 | set_execute_traversal_bit() |
88 | { | |
89 | path=$1 | |
90 | ||
91 | level="$path" | |
92 | if [ ! -d "$path" ]; then | |
93 | fail "Path is not a directory" | |
94 | fi | |
95 | while level="$(dirname "$level")" | |
96 | do | |
97 | if [ "$level" = / ]; then | |
98 | break | |
99 | fi | |
100 | chmod a+x "$level" | |
101 | done | |
102 | chmod a+x "$path" | |
103 | } | |
104 | ||
09d45745 MJ |
105 | # Required variables |
106 | WORKSPACE=${WORKSPACE:-} | |
107 | ||
5fcae288 | 108 | platform=${platform:-} |
212d2afd MJ |
109 | conf=${conf:-} |
110 | build=${build:-} | |
09d45745 | 111 | cc=${cc:-} |
9699c0e7 | 112 | test_type=${test_type:-} |
b4005bbf | 113 | |
4afa623f MJ |
114 | SRCDIR="$WORKSPACE/src/lttng-tools" |
115 | TAPDIR="$WORKSPACE/tap" | |
116 | PREFIX="/build" | |
117 | LIBDIR="lib" | |
32dde2a3 | 118 | LIBDIR_ARCH="$LIBDIR" |
4afa623f MJ |
119 | |
120 | # RHEL and SLES both use lib64 but don't bother shipping a default autoconf | |
121 | # site config that matches this. | |
47ca4354 | 122 | if [[ ( -f /etc/redhat-release || -f /etc/products.d/SLES.prod || -f /etc/yocto-release ) ]]; then |
85322e5d MJ |
123 | # Detect the userspace bitness in a distro agnostic way |
124 | if file -L /bin/bash | grep '64-bit' >/dev/null 2>&1; then | |
125 | LIBDIR_ARCH="${LIBDIR}64" | |
85322e5d | 126 | fi |
4afa623f MJ |
127 | fi |
128 | ||
09d45745 | 129 | DEPS_INC="$WORKSPACE/deps/build/include" |
4afa623f | 130 | DEPS_LIB="$WORKSPACE/deps/build/$LIBDIR_ARCH" |
b8bdba8f | 131 | DEPS_PKGCONFIG="$DEPS_LIB/pkgconfig" |
09d45745 MJ |
132 | DEPS_BIN="$WORKSPACE/deps/build/bin" |
133 | DEPS_JAVA="$WORKSPACE/deps/build/share/java" | |
134 | ||
135 | export PATH="$DEPS_BIN:$PATH" | |
136 | export LD_LIBRARY_PATH="$DEPS_LIB:${LD_LIBRARY_PATH:-}" | |
b8bdba8f | 137 | export PKG_CONFIG_PATH="$DEPS_PKGCONFIG" |
09d45745 MJ |
138 | export CPPFLAGS="-I$DEPS_INC" |
139 | export LDFLAGS="-L$DEPS_LIB" | |
140 | ||
212d2afd | 141 | |
09d45745 MJ |
142 | # Create tmp directory |
143 | TMPDIR="$WORKSPACE/tmp" | |
144 | mkdir -p "$TMPDIR" | |
212d2afd | 145 | |
09d45745 MJ |
146 | # Use a symlink in /tmp to point to the the tmp directory |
147 | # inside the workspace, this is to work around the path length | |
148 | # limit of unix sockets which are created by the test suite. | |
149 | tmpdir="$(mktemp)" | |
150 | ln -sf "$TMPDIR" "$tmpdir" | |
151 | export TMPDIR="$tmpdir" | |
b4005bbf | 152 | |
481eadc8 JR |
153 | # Create a symlink to "babeltrace" when the "babeltrace2" executable is found. |
154 | # This is a temporary workaround until lttng-tools either allows the override of | |
155 | # the trace reader in its test suite or that we move to only supporting | |
156 | # babeltrace2 | |
157 | if [ -x "$DEPS_BIN/babeltrace2" ]; then | |
65444f1c | 158 | ln -s "$DEPS_BIN/babeltrace2" "$DEPS_BIN/babeltrace" |
481eadc8 JR |
159 | fi |
160 | ||
161 | # When using babeltrace2 make sure that it finds its plugins and | |
162 | # plugin-providers. | |
163 | export BABELTRACE_PLUGIN_PATH="$DEPS_LIB/babeltrace2/plugins/" | |
164 | export LIBBABELTRACE2_PLUGIN_PROVIDER_DIR="$DEPS_LIB/babeltrace2/plugin-providers/" | |
165 | ||
09d45745 | 166 | export CFLAGS="-g -O2" |
fdb66460 | 167 | export CXXFLAGS="-g -O2" |
b4005bbf | 168 | |
09d45745 MJ |
169 | # Set compiler variables |
170 | case "$cc" in | |
171 | gcc) | |
172 | export CC=gcc | |
173 | export CXX=g++ | |
174 | ;; | |
175 | gcc-4.8) | |
176 | export CC=gcc-4.8 | |
177 | export CXX=g++-4.8 | |
178 | ;; | |
179 | gcc-5) | |
180 | export CC=gcc-5 | |
181 | export CXX=g++-5 | |
182 | ;; | |
183 | gcc-6) | |
184 | export CC=gcc-6 | |
185 | export CXX=g++-6 | |
186 | ;; | |
187 | gcc-7) | |
188 | export CC=gcc-7 | |
189 | export CXX=g++-7 | |
190 | ;; | |
191 | gcc-8) | |
192 | export CC=gcc-8 | |
193 | export CXX=g++-8 | |
194 | ;; | |
195 | clang) | |
196 | export CC=clang | |
197 | export CXX=clang++ | |
198 | ;; | |
199 | clang-3.9) | |
200 | export CC=clang-3.9 | |
201 | export CXX=clang++-3.9 | |
202 | ;; | |
203 | clang-4.0) | |
204 | export CC=clang-4.0 | |
205 | export CXX=clang++-4.0 | |
206 | ;; | |
207 | clang-5.0) | |
208 | export CC=clang-5.0 | |
209 | export CXX=clang++-5.0 | |
210 | ;; | |
211 | clang-6.0) | |
212 | export CC=clang-6.0 | |
213 | export CXX=clang++-6.0 | |
214 | ;; | |
215 | clang-7) | |
216 | export CC=clang-7 | |
217 | export CXX=clang++-7 | |
218 | ;; | |
219 | *) | |
220 | if [ "x$cc" != "x" ]; then | |
65444f1c | 221 | export CC="$cc" |
09d45745 MJ |
222 | fi |
223 | ;; | |
224 | esac | |
b4005bbf | 225 | |
09d45745 MJ |
226 | if [ "x${CC:-}" != "x" ]; then |
227 | echo "Selected compiler:" | |
228 | "$CC" -v | |
229 | fi | |
b4005bbf | 230 | |
0cdaa21c | 231 | # Set platform variables |
5fcae288 | 232 | case "$platform" in |
f0d7e5b1 | 233 | macos*) |
09d45745 MJ |
234 | export MAKE=make |
235 | export TAR=tar | |
236 | export NPROC="getconf _NPROCESSORS_ONLN" | |
237 | export PATH="/opt/local/bin:/opt/local/sbin:$PATH" | |
238 | export CPPFLAGS="-I/opt/local/include $CPPFLAGS" | |
239 | export LDFLAGS="-L/opt/local/lib $LDFLAGS" | |
00f7bb3f MJ |
240 | export PYTHON="python3" |
241 | export PYTHON_CONFIG="python3-config" | |
b6e62a6a | 242 | |
aff4e3d1 | 243 | LTTNG_TOOLS_RUN_TESTS="no" |
b6e62a6a MJ |
244 | ;; |
245 | ||
61afb3c3 | 246 | cygwin|cygwin64|msys32|msys64) |
09d45745 MJ |
247 | export MAKE=make |
248 | export TAR=tar | |
249 | export NPROC=nproc | |
250 | ||
aff4e3d1 | 251 | LTTNG_TOOLS_RUN_TESTS="no" |
61afb3c3 MJ |
252 | ;; |
253 | ||
0cdaa21c | 254 | *) |
09d45745 MJ |
255 | export MAKE=make |
256 | export TAR=tar | |
257 | export NPROC=nproc | |
258 | ||
aff4e3d1 | 259 | LTTNG_TOOLS_RUN_TESTS="yes" |
0cdaa21c MJ |
260 | |
261 | PYTHON2=python2 | |
262 | PYTHON3=python3 | |
263 | ||
b4c6a892 MJ |
264 | if command -v $PYTHON2 >/dev/null 2>&1; then |
265 | P2_VERSION=$($PYTHON2 -c 'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))') | |
4afa623f MJ |
266 | DEPS_PYTHON2="$WORKSPACE/deps/build/$LIBDIR/python$P2_VERSION/site-packages" |
267 | if [ "$LIBDIR" != "$LIBDIR_ARCH" ]; then | |
268 | DEPS_PYTHON2="$DEPS_PYTHON2:$WORKSPACE/deps/build/$LIBDIR_ARCH/python$P2_VERSION/site-packages" | |
269 | fi | |
b4c6a892 | 270 | fi |
0cdaa21c | 271 | |
b4c6a892 | 272 | P3_VERSION=$($PYTHON3 -c 'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))') |
4afa623f MJ |
273 | DEPS_PYTHON3="$WORKSPACE/deps/build/$LIBDIR/python$P3_VERSION/site-packages" |
274 | if [ "$LIBDIR" != "$LIBDIR_ARCH" ]; then | |
275 | DEPS_PYTHON3="$DEPS_PYTHON3:$WORKSPACE/deps/build/$LIBDIR_ARCH/python$P3_VERSION/site-packages" | |
276 | fi | |
de7e8d55 JG |
277 | |
278 | # Most build configs require access to the babeltrace 2 python bindings. | |
279 | # This also makes the lttngust python agent available for `agents` builds. | |
280 | export PYTHONPATH="${DEPS_PYTHON2:-}${DEPS_PYTHON2:+:}$DEPS_PYTHON3" | |
0cdaa21c MJ |
281 | ;; |
282 | esac | |
283 | ||
fdb66460 | 284 | # The missing-field-initializers warning code is very dumb in GCC 4.8 on |
29d9c2b2 MJ |
285 | # SLES12 / EL7, disable it even if it's available. |
286 | if [[ $platform = sles12sp5* ]] || [[ $platform = el7* ]]; then | |
65444f1c MJ |
287 | CFLAGS="$CFLAGS -Wno-missing-field-initializers" |
288 | CXXFLAGS="$CXXFLAGS -Wno-missing-field-initializers" | |
fdb66460 MJ |
289 | fi |
290 | ||
9699c0e7 | 291 | case "$test_type" in |
9699c0e7 | 292 | full) |
aff4e3d1 | 293 | LTTNG_TOOLS_RUN_TESTS_LONG_REGRESSION="yes" |
09d45745 | 294 | ;; |
9699c0e7 | 295 | *) |
aff4e3d1 | 296 | LTTNG_TOOLS_RUN_TESTS_LONG_REGRESSION="no" |
09d45745 | 297 | ;; |
9699c0e7 | 298 | esac |
0cdaa21c | 299 | |
7361d941 MJ |
300 | # If we have modules, build them |
301 | if [ -d "$WORKSPACE/src/lttng-modules" ]; then | |
302 | cd "$WORKSPACE/src/lttng-modules" | |
303 | $MAKE -j"$($NPROC)" V=1 | |
304 | $MAKE modules_install V=1 | |
305 | depmod | |
306 | fi | |
307 | ||
51c9c62d MJ |
308 | # Print build env details |
309 | print_os || true | |
310 | print_tooling || true | |
311 | ||
212d2afd MJ |
312 | # Enter the source directory |
313 | cd "$SRCDIR" | |
314 | ||
315 | # Run bootstrap in the source directory prior to configure | |
0cdaa21c MJ |
316 | ./bootstrap |
317 | ||
318 | # Get source version from configure script | |
212d2afd | 319 | eval "$(grep '^PACKAGE_VERSION=' ./configure)" |
09d45745 | 320 | PACKAGE_VERSION=${PACKAGE_VERSION//\-pre*/} |
0cdaa21c | 321 | |
b4005bbf | 322 | |
0cdaa21c MJ |
323 | # The switch to build without UST changed in 2.8 |
324 | if vergte "$PACKAGE_VERSION" "2.8"; then | |
325 | NO_UST="--without-lttng-ust" | |
326 | else | |
327 | NO_UST="--disable-lttng-ust" | |
328 | fi | |
b4005bbf | 329 | |
6c3ec80e | 330 | # Most build configs require the python bindings |
4afa623f | 331 | CONF_OPTS=("--prefix=$PREFIX" "--libdir=$PREFIX/$LIBDIR_ARCH" "--enable-python-bindings") |
6c3ec80e | 332 | |
edb933dd MJ |
333 | DIST_CONF_OPTS=() |
334 | ||
09d45745 MJ |
335 | # Set configure options and environment variables for each build |
336 | # configuration. | |
b4005bbf | 337 | case "$conf" in |
0cdaa21c | 338 | static) |
09d45745 MJ |
339 | echo "Static lib only configuration" |
340 | ||
341 | CONF_OPTS+=("--enable-static" "--disable-shared") | |
0cdaa21c MJ |
342 | ;; |
343 | ||
0cdaa21c MJ |
344 | no-ust) |
345 | echo "Build without UST support" | |
09d45745 | 346 | CONF_OPTS+=("$NO_UST") |
edb933dd | 347 | DIST_CONF_OPTS+=("$NO_UST") |
0cdaa21c MJ |
348 | ;; |
349 | ||
67122b96 | 350 | agents) |
09d45745 MJ |
351 | echo "Java and Python agents configuration" |
352 | ||
0cdaa21c | 353 | export JAVA_HOME="/usr/lib/jvm/default-java" |
61c5ba32 | 354 | export CLASSPATH="$DEPS_JAVA/lttng-ust-agent-all.jar:/usr/share/java/log4j-api.jar:/usr/share/java/log4j-core.jar:/usr/share/java/log4j-1.2.jar" |
0cdaa21c | 355 | |
09d45745 | 356 | CONF_OPTS+=("--enable-test-java-agent-all" "--enable-test-python-agent-all") |
d51c467a MJ |
357 | |
358 | # Explicitly add '--enable-test-java-agent-log4j2', it's not part of '-all' in stable 2.12/2.13 | |
359 | if verlt "$PACKAGE_VERSION" "2.14"; then | |
360 | CONF_OPTS+=("--enable-test-java-agent-log4j2") | |
361 | fi | |
0cdaa21c MJ |
362 | ;; |
363 | ||
364 | relayd-only) | |
09d45745 MJ |
365 | echo "Relayd only configuration" |
366 | ||
367 | CONF_OPTS=("--prefix=$PREFIX" "--disable-bin-lttng" "--disable-bin-lttng-consumerd" "--disable-bin-lttng-crash" "--disable-bin-lttng-sessiond" "--disable-extras" "--disable-man-pages" "$NO_UST") | |
0cdaa21c MJ |
368 | ;; |
369 | ||
22780fe6 JR |
370 | debug-rcu) |
371 | echo "Enable RCU sanity checks for debugging" | |
09d45745 MJ |
372 | |
373 | export CPPFLAGS="$CPPFLAGS -DDEBUG_RCU" | |
22780fe6 JR |
374 | ;; |
375 | ||
0cdaa21c | 376 | *) |
09d45745 | 377 | echo "Standard configuration" |
6871000c MJ |
378 | |
379 | # Something is broken in docbook-xml on yocto | |
380 | if [[ "$platform" = yocto* ]]; then | |
381 | CONF_OPTS+=("--disable-man-pages") | |
382 | fi | |
0cdaa21c | 383 | ;; |
b4005bbf MJ |
384 | esac |
385 | ||
386 | # Build type | |
67122b96 MJ |
387 | # oot : out-of-tree build |
388 | # dist : build via make dist | |
389 | # oot-dist: build via make dist out-of-tree | |
390 | # * : normal tree build | |
b4005bbf | 391 | # |
09d45745 MJ |
392 | # Make sure to move to the build directory and run configure |
393 | # before continuing. | |
b4005bbf | 394 | case "$build" in |
09d45745 MJ |
395 | oot) |
396 | echo "Out of tree build" | |
397 | ||
398 | # Create and enter a temporary build directory | |
399 | builddir=$(mktemp -d) | |
400 | cd "$builddir" | |
401 | ||
51c9c62d | 402 | "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure |
09d45745 MJ |
403 | ;; |
404 | ||
405 | dist) | |
406 | echo "Distribution in-tree build" | |
407 | ||
408 | # Run configure and generate the tar file | |
409 | # in the source directory | |
51c9c62d | 410 | ./configure "${DIST_CONF_OPTS[@]}" || failed_configure |
09d45745 MJ |
411 | $MAKE dist |
412 | ||
413 | # Create and enter a temporary build directory | |
414 | builddir=$(mktemp -d) | |
415 | cd "$builddir" | |
416 | ||
417 | # Extract the distribution tar in the build directory, | |
418 | # ignore the first directory level | |
419 | $TAR xvf "$SRCDIR"/*.tar.* --strip 1 | |
420 | ||
421 | # Build in extracted source tree | |
51c9c62d | 422 | ./configure "${CONF_OPTS[@]}" || failed_configure |
09d45745 MJ |
423 | ;; |
424 | ||
425 | oot-dist) | |
426 | echo "Distribution out of tree build" | |
427 | ||
428 | # Create and enter a temporary build directory | |
429 | builddir=$(mktemp -d) | |
430 | cd "$builddir" | |
431 | ||
432 | # Run configure out of tree and generate the tar file | |
51c9c62d | 433 | "$SRCDIR/configure" "${DIST_CONF_OPTS[@]}" || failed_configure |
09d45745 MJ |
434 | $MAKE dist |
435 | ||
436 | dist_srcdir="$(mktemp -d)" | |
437 | cd "$dist_srcdir" | |
438 | ||
439 | # Extract the distribution tar in the new source directory, | |
440 | # ignore the first directory level | |
441 | $TAR xvf "$builddir"/*.tar.* --strip 1 | |
442 | ||
443 | # Create and enter a second temporary build directory | |
444 | builddir="$(mktemp -d)" | |
445 | cd "$builddir" | |
446 | ||
447 | # Run configure from the extracted distribution tar, | |
448 | # out of the source tree | |
51c9c62d | 449 | "$dist_srcdir/configure" "${CONF_OPTS[@]}" || failed_configure |
09d45745 MJ |
450 | ;; |
451 | ||
452 | *) | |
453 | echo "Standard in-tree build" | |
51c9c62d | 454 | ./configure "${CONF_OPTS[@]}" || failed_configure |
09d45745 | 455 | ;; |
b4005bbf MJ |
456 | esac |
457 | ||
09d45745 MJ |
458 | # We are now inside a configured build directory |
459 | ||
0cdaa21c | 460 | # BUILD! |
212d2afd | 461 | $MAKE -j "$($NPROC)" V=1 |
b4005bbf | 462 | |
09d45745 MJ |
463 | # Install in the workspace |
464 | $MAKE install DESTDIR="$WORKSPACE" | |
7671741c | 465 | |
09d45745 MJ |
466 | # Run tests for all configs except 'no-ust' |
467 | failed_tests=0 | |
aff4e3d1 | 468 | if [ "$LTTNG_TOOLS_RUN_TESTS" = "yes" ] && [ "$conf" != "no-ust" ]; then |
0cdaa21c MJ |
469 | # Allow core dumps |
470 | ulimit -c unlimited | |
471 | ||
a4e98cc0 JR |
472 | # Force the lttng-sessiond path to /bin/true to prevent the spawing of a |
473 | # lttng-sessiond --daemonize on "lttng create" | |
474 | export LTTNG_SESSIOND_PATH="/bin/true" | |
475 | ||
09d45745 MJ |
476 | # Run 'unit_tests', 2.8 and up has a new test suite |
477 | if vergte "$PACKAGE_VERSION" "2.8"; then | |
65444f1c MJ |
478 | # It is implied that tests depending on LTTNG_ENABLE_DESTRUCTIVE_TESTS |
479 | # only run for the root user. Note that here `destructive` means that | |
480 | # operations are performed at the host level (add user etc.) that | |
481 | # effectively modify the host. Running those tests are acceptable on our | |
482 | # CI and root jobs since we always run root tests against a `snapshot` | |
483 | # of the host. | |
484 | if [ "$(id -u)" == "0" ]; then | |
485 | # Allow the traversal of all directories leading to the | |
486 | # DEPS_LIBS directory to enable test app run by temp users to | |
487 | # access lttng-ust. | |
488 | set_execute_traversal_bit "$DEPS_LIB" | |
489 | # Allow `all` to interact with all deps libs. | |
490 | chmod a+rwx -R "$DEPS_LIB" | |
491 | ||
492 | export LTTNG_ENABLE_DESTRUCTIVE_TESTS="will-break-my-system" | |
493 | ||
494 | # Some destructive tests play with the system clock, disable timesyncd | |
495 | systemctl stop systemd-timesyncd.service || true | |
496 | fi | |
497 | ||
09d45745 | 498 | make --keep-going check || failed_tests=1 |
4174b905 MJ |
499 | |
500 | # Copy tap logs for the jenkins tap parser before cleaning the build dir | |
09d45745 | 501 | rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$TAPDIR" |
4174b905 MJ |
502 | |
503 | # Copy the test suites top-level log which includes all tests failures | |
504 | rsync -a --include 'test-suite.log' --include '*/' --exclude='*' tests/ "$WORKSPACE/log" | |
0cdaa21c | 505 | else |
09d45745 MJ |
506 | cd tests |
507 | mkdir -p "$TAPDIR/unit" | |
508 | mkdir -p "$TAPDIR/fast_regression" | |
509 | mkdir -p "$TAPDIR/with_bindings_regression" | |
510 | prove --merge -v --exec '' - < unit_tests --archive "$TAPDIR/unit/" || failed_tests=1 | |
511 | prove --merge -v --exec '' - < fast_regression --archive "$TAPDIR/fast_regression/" || failed_tests=1 | |
512 | prove --merge -v --exec '' - < with_bindings_regression --archive "$TAPDIR/with_bindings_regression/" || failed_tests=1 | |
65444f1c | 513 | cd .. |
09d45745 MJ |
514 | fi |
515 | ||
aff4e3d1 | 516 | if [ "$LTTNG_TOOLS_RUN_TESTS_LONG_REGRESSION" = "yes" ]; then |
09d45745 MJ |
517 | cd tests |
518 | mkdir -p "$TAPDIR/long_regression" | |
519 | prove --merge -v --exec '' - < long_regression --archive "$TAPDIR/long_regression/" || failed_tests=1 | |
65444f1c | 520 | cd .. |
0cdaa21c MJ |
521 | fi |
522 | ||
0cdaa21c | 523 | # TAP plugin is having a hard time with .yml files. |
212d2afd | 524 | find "$TAPDIR" -name "meta.yml" -exec rm -f {} \; |
09d45745 MJ |
525 | else |
526 | # The TAP plugin will fail the job if no test logs are present | |
527 | mkdir -p "$TAPDIR/no-tests" | |
528 | echo "1..1" > "$TAPDIR/no-tests/tests.log" | |
529 | echo "ok 1 - Test suite disabled" >> "$TAPDIR/no-tests/tests.log" | |
b4005bbf MJ |
530 | fi |
531 | ||
09d45745 | 532 | # Clean the build directory |
0cdaa21c | 533 | $MAKE clean |
b4005bbf | 534 | |
0a059dd4 | 535 | # Cleanup rpath in executables |
09d45745 | 536 | find "$WORKSPACE/$PREFIX/bin" -type f -perm -0500 -exec chrpath --delete {} \; |
0cdaa21c | 537 | |
0a059dd4 | 538 | # Some configs don't build liblttng-ctl |
4afa623f | 539 | if [ -d "$WORKSPACE/$PREFIX/$LIBDIR_ARCH" ]; then |
0a059dd4 | 540 | # Cleanup rpath in shared libraries |
4afa623f | 541 | find "$WORKSPACE/$PREFIX/$LIBDIR_ARCH" -name "*.so" -exec chrpath --delete {} \; |
0a059dd4 | 542 | # Remove libtool .la files |
4afa623f | 543 | find "$WORKSPACE/$PREFIX/$LIBDIR_ARCH" -name "*.la" -exec rm -f {} \; |
0a059dd4 | 544 | fi |
b4005bbf | 545 | |
09d45745 MJ |
546 | # Exit with failure if any of the tests failed |
547 | exit $failed_tests | |
95654431 MJ |
548 | |
549 | # EOF |