jjb: Add dev_review jobs for lttng-ust-java-tests
authorKienan Stewart <kstewart@efficios.com>
Fri, 2 Feb 2024 16:03:28 +0000 (11:03 -0500)
committerKienan Stewart <kstewart@efficios.com>
Fri, 2 Feb 2024 19:17:34 +0000 (14:17 -0500)
Change-Id: I294802750dd560c56690751bb279f78270030ed2
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
jobs/lttng-ust.yaml
scripts/lttng-ust/lttng-ust-java-tests.sh [new file with mode: 0644]

index 1be87f3324b37e9e933ec998cf27edfb9545db5c..34e3797f1e4cc86325cc09949d7f497396ac006d 100644 (file)
       - archive: *lttng-ust_publisher_archive_defaults
       - workspace-cleanup: *lttng-ust_publisher_workspace-cleanup_defaults
 
-
 ## Templates
 - job-template:
     name: '{job_prefix}lttng-ust_{version}_{buildtype}'
       - workspace-cleanup: *lttng-ust_publisher_workspace-cleanup_defaults
       - ircbot: *lttng-ust_publisher_ircbot_defaults
 
+- job-template:
+    name: dev_review_lttng-ust-java-tests_{version}_{buildtype}
+    defaults: lttng-ust
+    description: |
+      Review tests for LTTng-UST's Java agent.
+      <p>Job is managed by Jenkins Job Builder.</p>
+    project-type: matrix
+    axes:
+      - axis:
+          <<: *lttng-ust_matrix_axis_platform
+    concurrent: true
+    scm:
+      - git:
+          url: https://review.lttng.org/lttng-ust-java-tests
+          refspec: 'refs/changes/*:refs/changes/*'
+          branches:
+            - '$GERRIT_REFSPEC'
+          basedir: 'src/lttng-ust-java-tests'
+          skip-tag: true
+    triggers:
+      - gerrit:
+          <<: *lttng-ust_trigger_gerrit_defaults
+          projects:
+            - project-compare-type: 'PLAIN'
+              project-pattern: 'lttng-ust-java-tests'
+              branches:
+                - branch-compare-type: 'PLAIN'
+                  branch-pattern: '{version}'
+    builders:
+      - copyartifact:
+          <<: *lttng-ust_steps_copyartifact_defaults
+          project: 'liburcu_{liburcu_versions[0]}_{buildtype}/platform=${{platform}},conf=std,build=std'
+      - copyartifact:
+          <<: *lttng-ust_steps_copyartifact_defaults
+          project: 'lttng-ust_{lttngust_versions[0]}_{buildtype}/liburcu_version={liburcu_versions[0]},platform=${{platform}},conf=agents,build=std'
+      - copyartifact:
+          <<: *lttng-ust_steps_copyartifact_defaults
+          project: 'lttng-tools_{lttngtools_versions[0]}_{buildtype}/babeltrace_version={babeltrace_versions[0]},liburcu_version={liburcu_versions[0]},platform=${{platform}},conf=agents,build=std'
+      - copyartifact:
+          <<: *lttng-ust_steps_copyartifact_defaults
+          project: 'babeltrace_{babeltrace_versions[0]}_{buildtype}/platform=${{platform}},conf=std,build=std'
+      - shell:
+          !include-raw-escape scripts/lttng-ust/lttng-ust-java-tests.sh
+    properties:
+      - inject:
+          properties-content: |
+            PROJECT_NAME=lttng-ust-java-tests
+      - build-discarder:
+          days-to-keep: 1
+      - throttle:
+          option: 'category'
+          categories:
+            - 'gerrit-{buildtype}'
+    publishers:
+      - archive:
+          artifacts: 'log/lttng-sessiond.log'
+          allow-empty: false
+      - junit:
+          results: 'src/lttng-ust-java-tests/**/target/failsafe-reports/*.xml'
+      - workspace-cleanup
 
 ## Views
 - view-template:
     github_user: lttng
     github_name: lttng-ust
     jobs:
-    ## master ##
+      ## master ##
       - 'dev_review_lttng-ust_{version}_{buildtype}':
           version: master
           buildtype: linuxbuild
           filter: ''
           touchstone: '(platform == "deb12-i386")'
 
+- project:
+    name: review-lttng-ust-java
+    job_prefix: ''
+    github_user: lttng
+    github_name: lttng-ust-java-tests
+    #
+    filter: ''
+    groups: '!domain:log4j2'
+    java_versions: !!python/tuple [java-11-openjdk]
+    touchstone: ''
+    version: master
+    #
+    babeltrace_versions: !!python/tuple [stable-2.0]
+    liburcu_versions: !!python/tuple [master]
+    lttngtools_versions: !!python/tuple [master]
+    lttngust_versions: !!python/tuple [master]
+    #
+    jobs:
+      - 'dev_review_lttng-ust-java-tests_{version}_{buildtype}':
+          buildtype: linuxbuild
+          platforms: !!python/tuple [deb12-amd64]
+      - 'dev_review_lttng-ust-java-tests_{version}_{buildtype}':
+          buildtype: slesbuild
+          platforms: !!python/tuple [sles12sp5-amd64, sles15sp4-amd64]
+
 - project:
     name: lttng-ust-views
     views:
diff --git a/scripts/lttng-ust/lttng-ust-java-tests.sh b/scripts/lttng-ust/lttng-ust-java-tests.sh
new file mode 100644 (file)
index 0000000..9b1242c
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/bash
+#
+# SPDX-FileCopyrightText: 2024 Kienan Stewart <kstewart@efficios.com>
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+set -exu
+
+# shellcheck disable=SC2317
+function cleanup
+{
+    killall lttng-sessiond
+}
+
+trap cleanup EXIT SIGINT SIGTERM
+
+LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}"
+LIBDIR="lib"
+LIBDIR_ARCH="$LIBDIR"
+
+# RHEL and SLES both use lib64 but don't bother shipping a default autoconf
+# site config that matches this.
+if [[ ( -f /etc/redhat-release || -f /etc/products.d/SLES.prod || -f /etc/yocto-release ) ]]; then
+    # Detect the userspace bitness in a distro agnostic way
+    if file -L /bin/bash | grep '64-bit' >/dev/null 2>&1; then
+        LIBDIR_ARCH="${LIBDIR}64"
+    fi
+fi
+
+# Work-around for the sles12sp5, sles15sp4 where the last successful builds were
+# completed before 'followSymlinks' was set to try, and is thus missing the
+# links for all the libraries.
+if [[ -f /etc/products.d/SLES.prod ]] ; then
+    pushd "${WORKSPACE}/deps/build/${LIBDIR_ARCH}"
+    while read -r LIB ; do
+        LIB_ANY=$(echo "${LIB}" | rev | cut -d'.' -f4- | rev)
+        LIB_MAJOR=$(echo "${LIB}" | rev | cut -d'.' -f3- | rev)
+        if [[ ! -f "${LIB_ANY}" ]]; then
+            ln -s "$(realpath "${LIB}")" "${LIB_ANY}"
+        fi
+        if [[ ! -f "${LIB_MAJOR}" ]] ; then
+            ln -s "$(realpath "${LIB}")" "${LIB_MAJOR}"
+        fi
+    done < <(find . -type f -iregex '.*\.so\.[0-9]+\.[0-9]+\.[0-9]+')
+    popd
+fi
+
+if [[ -z "${JAVA_HOME:-}" ]] ; then
+    export JAVA_HOME="/usr/lib/jvm/default-java"
+fi
+
+DEPS_JAVA="${WORKSPACE/deps/build/share/java}"
+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"
+
+LTTNG_UST_JAVA_TESTS_ENV=(
+    # Some ci nodes (eg. SLES12) don't have maven distributed by their
+    # package manager. As a result, the maven binary is deployed in
+    # '/opt/apache/maven/bin'.
+    PATH="${WORKSPACE}/deps/build/bin/:$PATH:/opt/apache/maven/bin/"
+    LD_LIBRARY_PATH="${WORKSPACE}/deps/build/${LIBDIR}/:${WORKSPACE}/deps/build/${LIBDIR_ARCH}:$LD_LIBRARY_PATH"
+    LTTNG_UST_DEBUG=1
+    LTTNG_CONSUMERD32_BIN="${WORKSPACE}/deps/build/${LIBDIR_ARCH}/lttng/libexec/lttng-consumerd"
+    LTTNG_CONSUMERD64_BIN="${WORKSPACE}/deps/build/${LIBDIR_ARCH}/lttng/libexec/lttng-consumerd"
+    LTTNG_SESSION_CONFIG_XSD_PATH="${WORKSPACE}/deps/build/share/xml/lttng"
+    BABELTRACE_PLUGIN_PATH="${WORKSPACE}/deps/build/${LIBDIR_ARCH}/babeltrace2/plugins"
+    LIBBABELTRACE2_PLUGIN_PROVIDER_DIR="${WORKSPACE}/deps/build/${LIBDIR_ARCH}/babeltrace2/plugin-providers"
+)
+LTTNG_UST_JAVA_TESTS_MAVEN_OPTS=(
+    "-Dmaven.test.failure.ignore=true"
+    "-Dcommon-jar-location=${WORKSPACE}/deps/build/share/java/lttng-ust-agent-common.jar"
+    "-Djul-jar-location=${WORKSPACE}/deps/build/share/java/lttng-ust-agent-jul.jar"
+    "-Dlog4j-jar-location=${WORKSPACE}/deps/build/share/java/lttng-ust-agent-log4j.jar"
+    "-Dlog4j2-jar-location=${WORKSPACE}/deps/build/share/java/lttng-ust-agent-log4j2.jar"
+    "-DargLine=-Djava.library.path=${WORKSPACE}/deps/build/${LIBDIR_ARCH}"
+    '-Dgroups=!domain:log4j2'
+)
+
+# Start the lttng-sessiond
+mkdir -p "${WORKSPACE}/log"
+env "${LTTNG_UST_JAVA_TESTS_ENV[@]}" lttng-sessiond -b -vvv > "${WORKSPACE}/log/lttng-sessiond.log" 2>&1
+
+cd src/lttng-ust-java-tests
+env "${LTTNG_UST_JAVA_TESTS_ENV[@]}" mvn -version
+env "${LTTNG_UST_JAVA_TESTS_ENV[@]}" mvn "${LTTNG_UST_JAVA_TESTS_MAVEN_OPTS[@]}" clean verify
+exit "${?}"
This page took 0.025225 seconds and 4 git commands to generate.