From 41a8bbc3d5c988ae3ad0d7b4d90ee443aa17fec2 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Wed, 29 May 2024 15:43:05 -0400 Subject: [PATCH] jjb: Treat warnings as errors on lttng-modules jobs against RC kernels Change-Id: If96423f71fb697f4f61df8eaab6d405ef07c0bac Signed-off-by: Kienan Stewart --- jobs/lttng-modules.yaml | 10 +++++++++- scripts/lttng-modules/param-build.sh | 24 +++++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/jobs/lttng-modules.yaml b/jobs/lttng-modules.yaml index 744a712..f5ce833 100644 --- a/jobs/lttng-modules.yaml +++ b/jobs/lttng-modules.yaml @@ -685,7 +685,7 @@ - string: name: 'mversion' default: 'master' - description: 'The lttng-modules branch to build.' + description: 'The lttng-modules branch to build. Use `refs/XXX` for a specific ref, or a commit hash.' - string: name: 'mgitrepo' default: 'git://git-mirror.internal.efficios.com/lttng/lttng-modules.git' @@ -710,6 +710,14 @@ name: 'getsrc_version' default: 'main' description: 'The tag or commit to use when cloning the getsrc tool' + - bool: + name: 'DEBUG' + default: false + description: "Enable verbose builds" + - bool: + name: 'FAIL_ON_WARNINGS' + default: false + description: "Fail the lttng-modules build if there are any warnings" concurrent: true diff --git a/scripts/lttng-modules/param-build.sh b/scripts/lttng-modules/param-build.sh index ba93fd4..310e22b 100644 --- a/scripts/lttng-modules/param-build.sh +++ b/scripts/lttng-modules/param-build.sh @@ -27,6 +27,10 @@ mgitrepo=${mgitrepo:-} make_args=() DEBUG=${DEBUG:-} +FAIL_ON_WARNINGS="${FAIL_ON_WARNINGS:-}" +if [[ "${FAIL_ON_WARNINGS}" == "false" ]] ; then + FAIL_ON_WARNINGS='' +fi # Derive arch from label if it isn't set if [ -z "${arch:-}" ] ; then @@ -83,9 +87,10 @@ print_header() { git_clone_modules_sources() { mkdir -p "$MODULES_GIT_DIR" - # If the version starts with "refs/", checkout the specific git ref, otherwise treat it - # as a branch name. - if [ "${mversion:0:5}" = "refs/" ]; then + # If the version starts with "refs/" or looks like a commit hash, + # checkout the specific git ref, otherwise treat it as a branch name. + pattern="^[0-9a-f]{40}$" + if [ "${mversion:0:5}" = "refs/" ] || [[ "${mversion}" =~ $pattern ]]; then git clone --no-tags --depth=1 "${mgitrepo}" "$MODULES_GIT_DIR" (cd "$MODULES_GIT_DIR" && git fetch origin "${mversion}" && git checkout FETCH_HEAD) else @@ -1006,13 +1011,18 @@ build_modules() { kversion=$(make -C "$LINUX_HDROBJ_DIR" -s kernelversion) - # Try to catch some compatibility problems by turning some - # warnings into errors. - #export KCFLAGS="$KCFLAGS -Wall -Werror" - # Enter lttng-modules source dir cd "${MODULES_GIT_DIR}" + # Try to catch some compatibility problems by turning some + # warnings into errors, but only on -rc kernels. + pattern="rc[0-9]+$" + if [[ "${kversion}" =~ ${pattern} ]] || [[ -n "${FAIL_ON_WARNINGS:-}" ]] ; then + export KCFLAGS="${KCFLAGS} -Wall -Werror" + # Without the verbose build, the warnings aren't visible. + export V=1 + fi + # kernels 3.10 to 3.10.13 and 3.11 to 3.11.2 introduce a deadlock in the # timekeeping subsystem. We want those build to fail. if { vergte "$kversion" "3.10" && verlte "$kversion" "3.10.13"; } || \ -- 2.34.1