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