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