3 # Copyright (C) 2016 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4 # Michael Jeanson <mjeanson@efficios.com>
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # Version compare functions
22 if [[ "$1" == "$2" ]]; then
26 local i ver1
=($1) ver2
=($2)
27 # fill empty fields in ver1 with zeros
28 for ((i
=${#ver1[@]}; i
<${#ver2[@]}; i
++)); do
31 for ((i
=0; i
<${#ver1[@]}; i
++)); do
32 if [[ -z ${ver2[i]} ]]; then
33 # fill empty fields in ver2 with zeros
36 if ((10#${ver1[i]} > 10#${ver2[i]})); then
39 if ((10#${ver1[i]} < 10#${ver2[i]})); then
48 vercomp
"$1" "$2"; local res
="$?"
49 [ "$res" -eq "0" ] ||
[ "$res" -eq "2" ]
53 vercomp
"$1" "$2"; local res
="$?"
58 vercomp
"$1" "$2"; local res
="$?"
59 [ "$res" -eq "0" ] ||
[ "$res" -eq "1" ]
63 vercomp
"$1" "$2"; local res
="$?"
68 vercomp
"$1" "$2"; local res
="$?"
76 test_type
=${test_type:-}
78 SRCDIR
="$WORKSPACE/src/lttng-tools"
79 #TMPDIR="$WORKSPACE/tmp"
80 PREFIX
="$WORKSPACE/build"
81 TAPDIR
="$WORKSPACE/tap"
84 # Create build and tmp directories
85 rm -rf "$PREFIX" "$TAPDIR"
86 mkdir
-p "$PREFIX" "$TAPDIR"
92 URCU_INCS
="$WORKSPACE/deps/liburcu/build/include/"
93 URCU_LIBS
="$WORKSPACE/deps/liburcu/build/lib/"
96 UST_INCS
="$WORKSPACE/deps/lttng-ust/build/include/"
97 UST_LIBS
="$WORKSPACE/deps/lttng-ust/build/lib/"
98 UST_JAVA
="$WORKSPACE/deps/lttng-ust/build/share/java/"
101 #BABEL_INCS="$WORKSPACE/deps/babeltrace/build/include/"
102 BABEL_LIBS
="$WORKSPACE/deps/babeltrace/build/lib/"
103 BABEL_BINS
="$WORKSPACE/deps/babeltrace/build/bin/"
106 # Set platform variables
114 CFLAGS
="${CFLAGS:-} -D_XOPEN_SOURCE=500"
117 export PATH
="/opt/csw/bin:/usr/ccs/bin:$PATH"
126 CFLAGS
="${CFLAGS:-} -D_XOPEN_SOURCE=500"
129 export PATH
="$PATH:/usr/perl5/bin"
130 CPPFLAGS
="-I/opt/csw/include"
131 LDFLAGS
="-L/opt/csw/lib"
137 NPROC
="getconf _NPROCESSORS_ONLN"
142 export PATH
="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
143 CPPFLAGS
="-I/opt/local/include"
144 LDFLAGS
="-L/opt/local/lib"
147 cygwin|cygwin64|msys32|msys64
)
169 P2_VERSION
=$
($PYTHON2 -c "import sys;print(sys.version[:3])")
170 P3_VERSION
=$
($PYTHON3 -c "import sys;print(sys.version[:3])")
172 UST_PYTHON2
="$WORKSPACE/deps/lttng-ust/build/lib/python$P2_VERSION/site-packages"
173 UST_PYTHON3
="$WORKSPACE/deps/lttng-ust/build/lib/python$P3_VERSION/site-packages"
179 RUN_TESTS_LONG_REGRESSION
="no"
182 RUN_TESTS_LONG_REGRESSION
="yes"
185 RUN_TESTS_LONG_REGRESSION
="no"
189 # Enter the source directory
192 # Run bootstrap in the source directory prior to configure
195 # Get source version from configure script
196 eval "$(grep '^PACKAGE_VERSION=' ./configure)"
197 PACKAGE_VERSION
=$
(echo "$PACKAGE_VERSION"|
sed 's/\-pre$//')
203 CPPFLAGS
="${CPPFLAGS:-} -I$URCU_INCS"
204 LDFLAGS
="${LDFLAGS:-} -L$URCU_LIBS"
205 export LD_LIBRARY_PATH
="$URCU_LIBS:$BABEL_LIBS:${LD_LIBRARY_PATH:-}"
209 CPPFLAGS
="${CPPFLAGS:-} -I$URCU_INCS -I$UST_INCS"
210 LDFLAGS
="${LDFLAGS:-} -L$URCU_LIBS -L$UST_LIBS"
211 export LD_LIBRARY_PATH
="$URCU_LIBS:$UST_LIBS:$BABEL_LIBS:${LD_LIBRARY_PATH:-}"
215 # The switch to build without UST changed in 2.8
216 if vergte
"$PACKAGE_VERSION" "2.8"; then
217 NO_UST
="--without-lttng-ust"
219 NO_UST
="--disable-lttng-ust"
222 # Most build configs require the python bindings
223 CONF_OPTS
="--enable-python-bindings"
224 export PYTHON
="python3"
225 export PYTHON_CONFIG
="/usr/bin/python3-config"
227 # Set configure options for each build configuration
231 CONF_OPTS
+=" --enable-static --disable-shared"
235 echo "Build without UST support"
236 CONF_OPTS
+=" $NO_UST"
240 echo "Enable Java Agents"
241 export JAVA_HOME
="/usr/lib/jvm/default-java"
242 export CLASSPATH
="$UST_JAVA/*:/usr/share/java/*"
243 CONF_OPTS
+=" --enable-test-java-agent-all"
245 echo "Enable Python agents"
246 export PYTHONPATH
="$UST_PYTHON2:$UST_PYTHON3"
247 CONF_OPTS
+=" --enable-test-python-agent-all"
251 echo "Build relayd only"
252 CONF_OPTS
="--disable-bin-lttng --disable-bin-lttng-consumerd --disable-bin-lttng-crash --disable-bin-lttng-sessiond --disable-extras --disable-man-pages $NO_UST"
256 echo "Enable RCU sanity checks for debugging"
257 CPPFLAGS
="${CPPFLAGS:-} -DDEBUG_RCU"
261 echo "Standard build"
267 # oot : out-of-tree build
268 # dist : build via make dist
269 # oot-dist: build via make dist out-of-tree
270 # * : normal tree build
272 # Make sure to move to the build_path and run configure
277 echo "Out of tree build"
278 BUILD_PATH
=$WORKSPACE/oot
279 mkdir
-p "$BUILD_PATH"
281 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" LDFLAGS
="$LDFLAGS" CPPFLAGS
="$CPPFLAGS" "$SRCDIR/configure" --prefix="$PREFIX" $CONF_OPTS
285 echo "Distribution tarball in-tree build"
287 # Initial configure and generate tarball
288 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" LDFLAGS
="$LDFLAGS" CPPFLAGS
="$CPPFLAGS" "$SRCDIR/configure" $CONF_OPTS --enable-build-man-pages
291 BUILD_PATH
="$(mktemp -d)"
292 cp .
/*.
tar.
* "$BUILD_PATH/"
295 # Ignore level 1 of tar
296 $TAR xvf .
/*.
tar.
* --strip 1
298 # Build in extracted source tree
299 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" LDFLAGS
="$LDFLAGS" CPPFLAGS
="$CPPFLAGS" "$BUILD_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
303 echo "Distribution tarball out of tree build"
304 BUILD_PATH
="$(mktemp -d)"
307 # Initial configure and generate tarball
308 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" LDFLAGS
="$LDFLAGS" CPPFLAGS
="$CPPFLAGS" "$SRCDIR/configure" $CONF_OPTS --enable-build-man-pages
311 NEWSRC_PATH
="$(mktemp -d)"
312 cp .
/*.
tar.
* "$NEWSRC_PATH/"
315 # Ignore level 1 of tar
316 $TAR xvf .
/*.
tar.
* --strip 1
318 BUILD_PATH
="$(mktemp -d)"
321 # Build oot from extracted sources
322 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" LDFLAGS
="$LDFLAGS" CPPFLAGS
="$CPPFLAGS" "$NEWSRC_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
326 echo "Standard tree build"
327 MAKE
=$MAKE BISON
="$BISON" YACC
="$YACC" CFLAGS
="$CFLAGS" LDFLAGS
="$LDFLAGS" CPPFLAGS
="$CPPFLAGS" "$BUILD_PATH/configure" --prefix="$PREFIX" $CONF_OPTS
332 $MAKE -j "$($NPROC)" V
=1
336 if [ "$RUN_TESTS" = "yes" ]; then
342 # Add 'babeltrace' binary to PATH
343 chmod +x
"$BABEL_BINS/babeltrace"
344 export PATH
="$PATH:$BABEL_BINS"
346 # Prepare tap output dirs
349 mkdir
-p "$TAPDIR/unit"
350 mkdir
-p "$TAPDIR/fast_regression"
351 mkdir
-p "$TAPDIR/with_bindings_regression"
352 if [ "$RUN_TESTS_LONG_REGRESSION" = "yes" ]; then
353 mkdir
-p "$TAPDIR/long_regression"
356 # Force the lttng-sessiond path to /bin/true to prevent the spawing of a
357 # lttng-sessiond --daemonize on "lttng create"
358 export LTTNG_SESSIOND_PATH
="/bin/true"
360 # Run 'unit_tests' and 'fast_regression' test suites for all configs except 'no-ust'
361 if [ "$conf" != "no-ust" ]; then
362 # Run 'unit_tests', 2.8 and up has a new test suite
363 if vergte
"$PACKAGE_VERSION" "2.8"; then
364 make --keep-going check
365 rsync
-a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*'" $BUILD_PATH/tests/" "$TAPDIR"
367 prove
--merge -v --exec '' - < "$BUILD_PATH/tests/unit_tests" --archive "$TAPDIR/unit/" || true
368 prove
--merge -v --exec '' - < "$BUILD_PATH/tests/fast_regression" --archive "$TAPDIR/fast_regression/" || true
369 prove
--merge -v --exec '' - < "$BUILD_PATH/tests/with_bindings_regression" --archive "$TAPDIR/with_bindings_regression/" || true
371 if [ "$RUN_TESTS_LONG_REGRESSION" = "yes" ]; then
372 prove
--merge -v --exec '' - < "$BUILD_PATH/tests/long_regression" --archive "$TAPDIR/long_regression/" || true
375 # Regression is disabled for now, we need to adjust the testsuite for no ust builds.
376 echo "Tests disabled for 'no-ust'."
379 # TAP plugin is having a hard time with .yml files.
380 find "$TAPDIR" -name "meta.yml" -exec rm -f {} \
;
382 # And also with files without extension, so rename all result to *.tap
383 find "$TAPDIR/" -type f
-exec mv {} {}.tap \
;
391 # Cleanup rpath in executables and shared libraries
392 find "$PREFIX/bin" -type f
-perm -0500 -exec chrpath
--delete {} \
;
393 find "$PREFIX/lib" -name "*.so" -exec chrpath
--delete {} \
;
395 # Remove libtool .la files
396 find "$PREFIX/lib" -name "*.la" -exec rm -f {} \
;
398 # Clean temp dir for dist build
399 if [ "$build" = "dist" ]; then