Use setResult instead of getExecutor().interrupt to set FAILURE
[lttng-ci.git] / scripts / lttng-modules / build.sh
CommitLineData
f12f1d66 1#!/bin/sh -exu
598af463
MJ
2#
3# Copyright (C) 2015 - Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
4# Michael Jeanson <mjeanson@efficios.com>
5#
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.
10#
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.
15#
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/>.
18
9351982a
MJ
19# Kernel version compare functions
20verlte() {
21 [ "$1" = "`printf '%s\n%s' $1 $2 | sort -V | head -n1`" ]
22}
23
24verlt() {
25 [ "$1" = "$2" ] && return 1 || verlte $1 $2
26}
27
28vergte() {
29 [ "$1" = "`printf '%s\n%s' $1 $2 | sort -V | tail -n1`" ]
30}
31
32vergt() {
33 [ "$1" = "$2" ] && return 1 || vergte $1 $2
34}
35
36
598af463
MJ
37# Use all CPU cores
38NPROC=$(nproc)
39
7e942863 40SRCDIR="${WORKSPACE}/src/lttng-modules"
598af463 41BUILDDIR="${WORKSPACE}/build"
7e942863 42LNXSRCDIR="${WORKSPACE}/src/linux"
598af463
MJ
43LNXBINDIR="${WORKSPACE}/deps/linux/build"
44
45# Create build directory
46rm -rf "${BUILDDIR}"
47mkdir -p "${BUILDDIR}"
48
49# Enter source dir
50cd "${SRCDIR}"
51
9351982a 52# Fix path to linux src in builddir Makefile
598af463
MJ
53sed -i "s#MAKEARGS := -C .*#MAKEARGS := -C ${LNXSRCDIR}#" "${LNXBINDIR}"/Makefile
54
9351982a
MJ
55# Get kernel version from source tree
56cd "${LNXBINDIR}"
57KVERSION=$(make kernelversion)
58cd -
59
60# kernels 3.10 to 3.10.13 and 3.11 to 3.11.2 introduce a deadlock in the
61# timekeeping subsystem. We want those build to fail.
62if { vergte "$KVERSION" "3.10" && verlte "$KVERSION" "3.10.13"; } || \
63 { vergte "$KVERSION" "3.11" && verlte "$KVERSION" "3.11.2"; }; then
64
65 set +e
66
67 # Build modules
2c1d386a 68 KERNELDIR="${LNXBINDIR}" make -j${NPROC} V=1 CONFIG_LTTNG=m
9351982a
MJ
69
70 # We expect this build to fail, if it doesn't, fail the job.
71 if [ "$?" -eq 0 ]; then
72 exit 1
73 fi
74
75 # We have to publish at least one file or the build will fail
76 echo "This kernel is broken, there is a deadlock in the timekeeping subsystem." > "${BUILDDIR}/BROKEN.txt"
77
78 set -e
79
80else # Regular build
81
82 # Build modules
2c1d386a 83 KERNELDIR="${LNXBINDIR}" make -j${NPROC} V=1 CONFIG_LTTNG=m
598af463 84
9351982a 85 # Install modules to build dir
2c1d386a 86 KERNELDIR="${LNXBINDIR}" make INSTALL_MOD_PATH="${BUILDDIR}" modules_install
9351982a 87fi
598af463
MJ
88
89# EOF
This page took 0.026293 seconds and 4 git commands to generate.