d484e102b4439bc49c2ce89e9065217ca5ac6260
[lttng-ci.git] / scripts / lttng-tools / build.sh
1 #!/bin/bash
2 #
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
6 #
7 # shellcheck disable=SC2103
8
9 set -exu
10
11 # Version compare functions
12 vercomp () {
13 set +u
14 if [[ "$1" == "$2" ]]; then
15 return 0
16 fi
17 local IFS=.
18 # Ignore the shellcheck warning, we want splitting to happen based on IFS.
19 # shellcheck disable=SC2206
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
41 verlte() {
42 vercomp "$1" "$2"; local res="$?"
43 [ "$res" -eq "0" ] || [ "$res" -eq "2" ]
44 }
45
46 verlt() {
47 vercomp "$1" "$2"; local res="$?"
48 [ "$res" -eq "2" ]
49 }
50
51 vergte() {
52 vercomp "$1" "$2"; local res="$?"
53 [ "$res" -eq "0" ] || [ "$res" -eq "1" ]
54 }
55
56 vergt() {
57 vercomp "$1" "$2"; local res="$?"
58 [ "$res" -eq "1" ]
59 }
60
61 verne() {
62 vercomp "$1" "$2"; local res="$?"
63 [ "$res" -ne "0" ]
64 }
65
66 print_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
86 failed_configure() {
87 # Assume we are in the configured build directory
88 print_header "BEGIN config.log"
89 cat config.log
90 print_header "END config.log"
91
92 # End the build with failure
93 exit 1
94 }
95
96 set_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
114 print_header "LTTng-tools build script starting"
115
116 # Required variables
117 WORKSPACE=${WORKSPACE:-}
118
119 # Axis
120 platform=${platform:-}
121 conf=${conf:-}
122 build=${build:-}
123 cc=${cc:-}
124
125 # Build steps that can be overriden by the environment
126 LTTNG_TOOLS_MAKE_INSTALL="${LTTNG_TOOLS_MAKE_INSTALL:-yes}"
127 LTTNG_TOOLS_MAKE_CLEAN="${LTTNG_TOOLS_MAKE_CLEAN:-yes}"
128 LTTNG_TOOLS_GEN_COMPILE_COMMANDS="${LTTNG_TOOLS_GEN_COMPILE_COMMANDS:-no}"
129 LTTNG_TOOLS_RUN_TESTS="${LTTNG_TOOLS_RUN_TESTS:-yes}"
130 LTTNG_TOOLS_RUN_TESTS_LONG_REGRESSION="${LTTNG_TOOLS_RUN_TESTS_LONG_REGRESSION:-no}"
131 LTTNG_TOOLS_RUN_UST_JAVA_TESTS="${LTTNG_TOOLS_RUN_UST_JAVA_TESTS:-yes}"
132 LTTNG_TOOLS_CLANG_TIDY="${LTTNG_TOOLS_CLANG_TIDY:-no}"
133
134 SRCDIR="$WORKSPACE/src/lttng-tools"
135 TAPDIR="$WORKSPACE/tap"
136 PREFIX="/build"
137 LIBDIR="lib"
138 LIBDIR_ARCH="$LIBDIR"
139
140 # RHEL and SLES both use lib64 but don't bother shipping a default autoconf
141 # site config that matches this.
142 if [[ ( -f /etc/redhat-release || -f /etc/products.d/SLES.prod || -f /etc/yocto-release ) ]]; then
143 # Detect the userspace bitness in a distro agnostic way
144 if file -L /bin/bash | grep '64-bit' >/dev/null 2>&1; then
145 LIBDIR_ARCH="${LIBDIR}64"
146 fi
147 fi
148
149 DEPS_INC="$WORKSPACE/deps/build/include"
150 DEPS_LIB="$WORKSPACE/deps/build/$LIBDIR_ARCH"
151 DEPS_PKGCONFIG="$DEPS_LIB/pkgconfig"
152 DEPS_BIN="$WORKSPACE/deps/build/bin"
153 DEPS_JAVA="$WORKSPACE/deps/build/share/java"
154
155 export PATH="$DEPS_BIN:$PATH"
156 export LD_LIBRARY_PATH="$DEPS_LIB:${LD_LIBRARY_PATH:-}"
157 export PKG_CONFIG_PATH="$DEPS_PKGCONFIG"
158 export CPPFLAGS="-I$DEPS_INC"
159 export LDFLAGS="-L$DEPS_LIB"
160
161 exit_status=0
162
163 # Use bear to generate compile_commands.json when enabled
164 BEAR=""
165 if [ "$LTTNG_TOOLS_GEN_COMPILE_COMMANDS" = "yes" ]; then
166 BEAR="bear"
167 fi
168
169 # Create tmp directory
170 TMPDIR="$WORKSPACE/tmp"
171 mkdir -p "$TMPDIR"
172
173 # Use a symlink in /tmp to point to the the tmp directory
174 # inside the workspace, this is to work around the path length
175 # limit of unix sockets which are created by the test suite.
176 tmpdir="$(mktemp)"
177 ln -sf "$TMPDIR" "$tmpdir"
178 export TMPDIR="$tmpdir"
179
180 # Create a symlink to "babeltrace" when the "babeltrace2" executable is found.
181 # This is a temporary workaround until lttng-tools either allows the override of
182 # the trace reader in its test suite or that we move to only supporting
183 # babeltrace2
184 if [ -x "$DEPS_BIN/babeltrace2" ]; then
185 ln -s "$DEPS_BIN/babeltrace2" "$DEPS_BIN/babeltrace"
186 fi
187
188 # When using babeltrace2 make sure that it finds its plugins and
189 # plugin-providers.
190 export BABELTRACE_PLUGIN_PATH="$DEPS_LIB/babeltrace2/plugins/"
191 export LIBBABELTRACE2_PLUGIN_PROVIDER_DIR="$DEPS_LIB/babeltrace2/plugin-providers/"
192
193 export CFLAGS="-g -O2"
194 export CXXFLAGS="-g -O2"
195
196 # Set compiler variables
197 case "$cc" in
198 gcc)
199 export CC=gcc
200 export CXX=g++
201 ;;
202 gcc-*)
203 export CC=gcc-${cc#gcc-}
204 export CXX=g++-${cc#gcc-}
205 ;;
206 clang)
207 export CC=clang
208 export CXX=clang++
209 ;;
210 clang-*)
211 export CC=clang-${cc#clang-}
212 export CXX=clang++-${cc#clang-}
213 ;;
214 *)
215 if [ "x$cc" != "x" ]; then
216 export CC="$cc"
217 fi
218 ;;
219 esac
220
221 # Set platform variables
222 case "$platform" in
223 macos*)
224 export MAKE=make
225 export TAR=tar
226 export NPROC="getconf _NPROCESSORS_ONLN"
227 export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
228 export CPPFLAGS="-I/opt/local/include $CPPFLAGS"
229 export LDFLAGS="-L/opt/local/lib $LDFLAGS"
230 export PYTHON="python3"
231 export PYTHON_CONFIG="python3-config"
232 ;;
233
234 cygwin|cygwin64|msys32|msys64)
235 export MAKE=make
236 export TAR=tar
237 export NPROC=nproc
238 ;;
239
240 *)
241 export MAKE=make
242 export TAR=tar
243 export NPROC=nproc
244
245 PYTHON2=python2
246 PYTHON3=python3
247
248 if command -v $PYTHON2 >/dev/null 2>&1; then
249 P2_VERSION=$($PYTHON2 -c 'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))')
250 DEPS_PYTHON2="$WORKSPACE/deps/build/$LIBDIR/python$P2_VERSION/site-packages"
251 if [ "$LIBDIR" != "$LIBDIR_ARCH" ]; then
252 DEPS_PYTHON2="$DEPS_PYTHON2:$WORKSPACE/deps/build/$LIBDIR_ARCH/python$P2_VERSION/site-packages"
253 fi
254 fi
255
256 P3_VERSION=$($PYTHON3 -c 'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))')
257
258 # Temporary fix for an issue on debian python >= 3.10, add the 'local' prefix
259 DEPS_PYTHON3="$WORKSPACE/deps/build/$LIBDIR/python$P3_VERSION/site-packages:$WORKSPACE/deps/build/local/$LIBDIR/python$P3_VERSION/dist-packages"
260 if [ "$LIBDIR" != "$LIBDIR_ARCH" ]; then
261 DEPS_PYTHON3="$DEPS_PYTHON3:$WORKSPACE/deps/build/$LIBDIR_ARCH/python$P3_VERSION/site-packages"
262 fi
263
264 # Most build configs require access to the babeltrace 2 python bindings.
265 # This also makes the lttngust python agent available for `agents` builds.
266 export PYTHONPATH="${DEPS_PYTHON2:-}${DEPS_PYTHON2:+:}$DEPS_PYTHON3"
267 ;;
268 esac
269
270 # Some warning flags are very dumb in GCC 4.8 on SLES12 / EL7, disable them
271 # even if they are available.
272 if [[ $platform = sles12sp5* ]] || [[ $platform = el7* ]]; then
273 CFLAGS="$CFLAGS -Wno-missing-field-initializers -Wno-shadow"
274 CXXFLAGS="$CXXFLAGS -Wno-missing-field-initializers -Wno-shadow"
275 fi
276
277 # If we have modules, build them
278 if [ -d "$WORKSPACE/src/lttng-modules" ]; then
279 print_header "Build and install LTTng-modules"
280 cd "$WORKSPACE/src/lttng-modules"
281 $MAKE -j"$($NPROC)" V=1
282 $MAKE modules_install V=1
283 depmod
284 fi
285
286 # Print build env details
287 print_header "Build environment details"
288 print_hardware || true
289 print_os || true
290 print_tooling || true
291
292 # Enter the source directory
293 cd "$SRCDIR"
294
295 # Run bootstrap in the source directory prior to configure
296 print_header "Bootstrap autotools"
297 ./bootstrap
298
299 # Get source version from configure script
300 eval "$(grep '^PACKAGE_VERSION=' ./configure)"
301 PACKAGE_VERSION=${PACKAGE_VERSION//\-pre*/}
302
303 CONF_OPTS=("--prefix=$PREFIX" "--libdir=$PREFIX/$LIBDIR_ARCH" "--disable-maintainer-mode")
304 DIST_CONF_OPTS=("--disable-maintainer-mode")
305
306 # Set configure options and environment variables for each build
307 # configuration.
308 case "$conf" in
309 static)
310 print_header "Conf: Static lib only"
311
312 CONF_OPTS+=("--enable-static" "--disable-shared" "--enable-python-bindings")
313 ;;
314
315 no-ust)
316 print_header "Conf: Without UST support"
317
318 CONF_OPTS+=("--without-lttng-ust")
319 DIST_CONF_OPTS+=("--without-lttng-ust")
320 ;;
321
322 agents)
323 print_header "Conf: Java and Python agents"
324
325 if [[ -z "${JAVA_HOME:-}" ]] ; then
326 export JAVA_HOME="/usr/lib/jvm/default-java"
327 fi
328 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"
329 if [[ -f /etc/products.d/SLES.prod ]] ; then
330 export JAVA_HOME="/usr/${LIBDIR_ARCH}/jvm/java-1.8.0-openjdk-1.8.0"
331 export PATH="/usr/${LIBDIR_ARCH}/jvm/java-1.8.0-openjdk-1.8.0/bin:/usr/${LIBDIR_ARCH}/jvm/jre-1.8.0-openjdk/bin:${PATH}"
332 SLES_VERSION="$(grep -E '</version>' /etc/products.d/SLES.prod | grep -E -o '[0-9]+\.[0-9]+')"
333 if vergte "${SLES_VERSION}" "15.4" ; then
334 export CLASSPATH="${DEPS_JAVA}/lttng-ust-agent-all.jar:/usr/share/java/log4j/log4j-api.jar:/usr/share/java/log4j/log4j-core.jar:/usr/share/java/log4j12/log4j-12.jar"
335 fi
336 fi
337
338
339 CONF_OPTS+=("--enable-python-bindings" "--enable-test-java-agent-all")
340
341 # Explicitly add '--enable-test-java-agent-log4j2', it's not part of '-all' in stable 2.12/2.13
342 if verlt "$PACKAGE_VERSION" "2.14"; then
343 CONF_OPTS+=("--enable-test-java-agent-log4j2")
344 fi
345
346 # Some distros don't ship python2 anymore
347 if command -v $PYTHON2 >/dev/null 2>&1; then
348 CONF_OPTS+=("--enable-test-python-agent-all")
349 else
350 CONF_OPTS+=("--enable-test-python3-agent")
351 fi
352 ;;
353
354 relayd-only)
355 print_header "Conf: Relayd only"
356
357 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")
358
359 # A config option for lib-lttng-ctl was added in 2.14
360 if vergte "$PACKAGE_VERSION" "2.14"; then
361 CONF_OPTS+=("--disable-lib-lttng-ctl")
362 fi
363 ;;
364
365 debug-rcu)
366 print_header "Conf: RCU sanity checks for debugging"
367
368 CONF_OPTS+=("--enable-python-bindings")
369
370 export CPPFLAGS="$CPPFLAGS -DDEBUG_RCU"
371 ;;
372
373 *)
374 print_header "Conf: Standard"
375
376 CONF_OPTS+=("--enable-python-bindings")
377
378 # Something is broken in docbook-xml on yocto
379 if [[ "$platform" = yocto* ]]; then
380 CONF_OPTS+=("--disable-man-pages")
381 fi
382 ;;
383 esac
384
385 # Build type
386 # oot : out-of-tree build
387 # dist : build via make dist
388 # oot-dist: build via make dist out-of-tree
389 # * : normal tree build
390 #
391 # Make sure to move to the build directory and run configure
392 # before continuing.
393 case "$build" in
394 oot)
395 print_header "Build: Out of tree"
396
397 # Create and enter a temporary build directory
398 builddir=$(mktemp -d)
399 cd "$builddir"
400
401 "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure
402 ;;
403
404 dist)
405 print_header "Build: Distribution in-tree"
406
407 # Run configure and generate the tar file
408 # in the source directory
409
410 ./configure "${DIST_CONF_OPTS[@]}" || failed_configure
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
422 ./configure "${CONF_OPTS[@]}" || failed_configure
423 ;;
424
425 oot-dist)
426 print_header "Build: Distribution Out of tree"
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
433 "$SRCDIR/configure" "${DIST_CONF_OPTS[@]}" || failed_configure
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
449 "$dist_srcdir/configure" "${CONF_OPTS[@]}" || failed_configure
450 ;;
451
452 *)
453 print_header "Build: Standard In-tree"
454 ./configure "${CONF_OPTS[@]}" || failed_configure
455 ;;
456 esac
457
458 # We are now inside a configured build directory
459
460 # BUILD!
461 print_header "BUILD!"
462 $BEAR ${BEAR:+--} $MAKE -j "$($NPROC)" V=1
463
464 # Install in the workspace if enabled
465 if [ "$LTTNG_TOOLS_MAKE_INSTALL" = "yes" ]; then
466 print_header "Install"
467
468 $MAKE install V=1 DESTDIR="$WORKSPACE"
469
470 # Cleanup rpath in executables
471 find "$WORKSPACE/$PREFIX/bin" -type f -perm -0500 -exec chrpath --delete {} \;
472
473 # Some configs don't build liblttng-ctl
474 if [ -d "$WORKSPACE/$PREFIX/$LIBDIR_ARCH" ]; then
475 # Cleanup rpath in shared libraries
476 find "$WORKSPACE/$PREFIX/$LIBDIR_ARCH" -name "*.so" -exec chrpath --delete {} \;
477 # Remove libtool .la files
478 find "$WORKSPACE/$PREFIX/$LIBDIR_ARCH" -name "*.la" -delete
479 fi
480 fi
481
482 # Run clang-tidy on the topmost commit
483 if [ "$LTTNG_TOOLS_CLANG_TIDY" = "yes" ]; then
484 print_header "Run clang-tidy"
485
486 # This would be better by linting only the lines touched by a patch but it
487 # doesn't seem to work, the lines are always filtered and no error is
488 # reported.
489 #git diff -U0 HEAD^ | clang-tidy-diff -p1 -j "$($NPROC)" -timeout 60 -fix
490
491 # Instead, run clan-tidy on all the files touched by the patch.
492 while read -r filepath; do
493 if [[ "$filepath" =~ (\.cpp|\.hhp|\.c|\.h)$ ]]; then
494 clang-tidy --fix-errors "$(realpath "$filepath")"
495 fi
496 done < <(git diff-tree --no-commit-id --diff-filter=d --name-only -r HEAD)
497
498 # If the tree has local changes, the formatting was incorrect
499 GIT_DIFF_OUTPUT=$(git diff)
500 if [ -n "$GIT_DIFF_OUTPUT" ]; then
501 echo "Saving clang-tidy proposed fixes in clang-tidy-fixes.diff"
502 git diff > "$WORKSPACE/clang-tidy-fixes.diff"
503
504 # Restore the unfixed files so they can be viewed in the warnings web
505 # interface
506 git checkout .
507 exit_status=1
508 fi
509 fi
510
511 # Run tests for all configs except 'no-ust' / 'relayd-only'
512 if [ "$LTTNG_TOOLS_RUN_TESTS" = "yes" ] && [[ ! "$conf" =~ (no-ust|relayd-only) ]]; then
513 print_header "Run test suite"
514
515 # Allow core dumps
516 ulimit -c unlimited
517
518 # Force the lttng-sessiond path to /bin/true to prevent the spawing of a
519 # lttng-sessiond --daemonize on "lttng create"
520 export LTTNG_SESSIOND_PATH="/bin/true"
521
522 # It is implied that tests depending on LTTNG_ENABLE_DESTRUCTIVE_TESTS
523 # only run for the root user. Note that here `destructive` means that
524 # operations are performed at the host level (add user etc.) that
525 # effectively modify the host. Running those tests are acceptable on our
526 # CI and root jobs since we always run root tests against a `snapshot`
527 # of the host.
528 if [ "$(id -u)" == "0" ]; then
529 # Allow the traversal of all directories leading to the
530 # DEPS_LIBS directory to enable test app run by temp users to
531 # access lttng-ust.
532 set_execute_traversal_bit "$DEPS_LIB"
533 # Allow `all` to interact with all deps libs.
534 chmod a+rwx -R "$DEPS_LIB"
535
536 export LTTNG_ENABLE_DESTRUCTIVE_TESTS="will-break-my-system"
537
538 # Some destructive tests play with the system clock, disable timesyncd
539 systemctl stop systemd-timesyncd.service || true
540 fi
541
542 make --keep-going check || exit_status=1
543
544 # Copy tap logs for the jenkins tap parser before cleaning the build dir
545 rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$TAPDIR"
546
547 # Copy the test suites top-level log which includes all tests failures
548 rsync -a --include 'test-suite.log' --include '*/' --exclude='*' tests/ "$WORKSPACE/log"
549
550 if [ "$LTTNG_TOOLS_RUN_TESTS_LONG_REGRESSION" = "yes" ]; then
551 print_header "Run long regression tests"
552 cd tests
553 mkdir -p "$TAPDIR/long_regression"
554 prove --merge -v --exec '' - < long_regression --archive "$TAPDIR/long_regression/" || exit_status=1
555 cd ..
556 fi
557
558 if [ "$LTTNG_TOOLS_RUN_UST_JAVA_TESTS" = "yes" ] && [ "$LTTNG_TOOLS_MAKE_INSTALL" = "yes" ] && [ "$conf" = "agents" ] ; then
559 print_header "Run lttng-ust-java-tests"
560 # Git Source
561 LTTNG_UST_JAVA_TESTS_GIT_SOURCE="${LTTNG_UST_JAVA_TESTS_GIT_SOURCE:-https://github.com/lttng/lttng-ust-java-tests.git}"
562 LTTNG_UST_JAVA_TESTS_GIT_BRANCH="${LTTNG_UST_JAVA_TESTS_GIT_BRANCH:-master}"
563
564 OWD="$(pwd)"
565 cd ..
566 git clone -b "${LTTNG_UST_JAVA_TESTS_GIT_BRANCH}" "${LTTNG_UST_JAVA_TESTS_GIT_SOURCE}" lttng-ust-java-tests
567 cd lttng-ust-java-tests
568
569 LTTNG_UST_JAVA_TESTS_ENV=(
570 # Some ci nodes (eg. SLES12) don't have maven distributed by their
571 # package manager. As a result, the maven binary is deployed in
572 # '/opt/apache/maven/bin'.
573 PATH="${WORKSPACE}/build/bin/:$PATH:/opt/apache/maven/bin/"
574 LD_LIBRARY_PATH="${WORKSPACE}/build/${LIBDIR}/:${WORKSPACE}/build/${LIBDIR_ARCH}:$LD_LIBRARY_PATH"
575 LTTNG_UST_DEBUG=1
576 LTTNG_CONSUMERD32_BIN="${WORKSPACE}/build/${LIBDIR_ARCH}/lttng/libexec/lttng-consumerd"
577 LTTNG_CONSUMERD64_BIN="${WORKSPACE}/build/${LIBDIR_ARCH}/lttng/libexec/lttng-consumerd"
578 LTTNG_SESSION_CONFIG_XSD_PATH="${WORKSPACE}/build/share/xml/lttng"
579 BABELTRACE_PLUGIN_PATH="${WORKSPACE}/deps/build/${LIBDIR_ARCH}/babeltrace2/plugins"
580 LIBBABELTRACE2_PLUGIN_PROVIDER_DIR="${WORKSPACE}/deps/build/${LIBDIR_ARCH}/babeltrace2/plugin-providers"
581 )
582 LTTNG_UST_JAVA_TESTS_MAVEN_OPTS=(
583 "-Dmaven.test.failure.ignore=true"
584 "-Dcommon-jar-location=${WORKSPACE}/deps/build/share/java/lttng-ust-agent-common.jar"
585 "-Djul-jar-location=${WORKSPACE}/deps/build/share/java/lttng-ust-agent-jul.jar"
586 "-Dlog4j-jar-location=${WORKSPACE}/deps/build/share/java/lttng-ust-agent-log4j.jar"
587 "-Dlog4j2-jar-location=${WORKSPACE}/deps/build/share/java/lttng-ust-agent-log4j2.jar"
588 "-DargLine=-Djava.library.path=${WORKSPACE}/deps/build/${LIBDIR_ARCH}"
589 '-Dgroups=!domain:log4j2'
590 )
591
592 env "${LTTNG_UST_JAVA_TESTS_ENV[@]}" mvn -version
593
594 if [[ -n "${LTTNG_TOOLS_UST_JAVA_TESTS_LOG4J_API_VERSION:-}" ]] ; then
595 env "${LTTNG_UST_JAVA_TESTS_ENV[@]}" mvn versions:use-dep-version -Dincludes=org.apache.logging.log4j:'*' -DdepVersion="${LTTNG_TOOLS_UST_JAVA_TESTS_LOG4J_API_VERSION}"
596 fi
597
598 mkdir -p "${WORKSPACE}/log"
599 env "${LTTNG_UST_JAVA_TESTS_ENV[@]}" lttng-sessiond -b -vvv 1>"${WORKSPACE}/log/lttng-ust-java-tests-lttng-sessiond.log" 2>&1
600 env "${LTTNG_UST_JAVA_TESTS_ENV[@]}" mvn "${LTTNG_UST_JAVA_TESTS_MAVEN_OPTS[@]}" clean compile dependency:build-classpath dependency:tree verify || exit_status=1
601 killall lttng-sessiond
602
603 cd "${OWD}"
604 fi
605 fi
606
607 if [ "$LTTNG_TOOLS_RUN_TESTS" = "yes" ] && [[ "$conf" =~ (no-ust|relayd-only) ]]; then
608 # The TAP plugin will fail the job if no test logs are present
609 mkdir -p "$TAPDIR/no-tests"
610 echo "1..1" > "$TAPDIR/no-tests/tests.log"
611 echo "ok 1 - Test suite disabled" >> "$TAPDIR/no-tests/tests.log"
612 fi
613
614 # Clean the build directory
615 if [ "$LTTNG_TOOLS_MAKE_CLEAN" = "yes" ]; then
616 print_header "Clean"
617 $MAKE clean
618 fi
619
620 print_header "LTTng-tools build script ended with: $(test $exit_status == 0 && echo SUCCESS || echo FAILURE)"
621
622 # Exit with failure if any of the tests failed
623 exit $exit_status
624
625 # EOF
626 # vim: expandtab tabstop=4 shiftwidth=4
This page took 0.046523 seconds and 3 git commands to generate.