From e3c322027d1e4b20f057b8b604b3aed84d533e74 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Wed, 25 May 2022 15:55:04 -0400 Subject: [PATCH] jjb: tools: depends-on: support babeltrace Propagate *_RUN_TESTS to babeltrace build script to prevent test during a depends-on gerrit build. Signed-off-by: Jonathan Rajotte Change-Id: Ia0fcd763d2ce15cc6234587e60c306eece19cf63 --- jobs/lttng-tools.yaml | 28 ++++++++++++++++++------ scripts/babeltrace/build.sh | 24 +++++++++++--------- scripts/lttng-tools/gerrit-depends-on.sh | 2 +- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/jobs/lttng-tools.yaml b/jobs/lttng-tools.yaml index 295b383..65b8e08 100644 --- a/jobs/lttng-tools.yaml +++ b/jobs/lttng-tools.yaml @@ -316,13 +316,6 @@ !include-raw-escape: scripts/lttng-tools/gerrit-depends-on.sh - inject: properties-file: gerrit_custom_dependencies.properties - - copyartifact: - project: '{bt_job_prefix}babeltrace_${{babeltrace_version}}_{buildtype}/arch=${{arch}},conf=std,build=std' - which-build: last-successful - stable: false - filter: 'build/**' - target: 'deps' - do-not-fingerprint: true - conditional-step: condition-kind: and on-evaluation-failure: run @@ -352,6 +345,18 @@ filter: 'build/**' target: 'deps' do-not-fingerprint: true + - conditional-step: + condition-kind: shell + on-evaluation-failure: run + condition-command: 'test -z "$GERRIT_DEP_BABELTRACE"' + steps: + - copyartifact: + project: '{bt_job_prefix}babeltrace_${{babeltrace_version}}_{buildtype}/arch=${{arch}},conf=std,build=std' + which-build: last-successful + stable: false + filter: 'build/**' + target: 'deps' + do-not-fingerprint: true - shell: !include-raw-escape: scripts/lttng-tools/clean_processes_coredump.sh - conditional-step: @@ -363,6 +368,15 @@ - scripts/common/override-build-std.sh - scripts/common/print.sh - scripts/liburcu/build.sh + - conditional-step: + condition-kind: shell + condition-command: 'test ! -z "$GERRIT_DEP_BABELTRACE"' + steps: + - shell: + !include-raw-escape: + - scripts/common/override-build-std.sh + - scripts/common/print.sh + - scripts/babeltrace/build.sh - shell: !include-raw-escape: scripts/lttng-tools/gerrit-install-deps.sh - conditional-step: diff --git a/scripts/babeltrace/build.sh b/scripts/babeltrace/build.sh index 2d39c2c..37a593a 100755 --- a/scripts/babeltrace/build.sh +++ b/scripts/babeltrace/build.sh @@ -88,6 +88,8 @@ conf=${conf:-} build=${build:-} cc=${cc:-} +# Controls if the tests are run +BABELTRACE_RUN_TESTS="${BABELTRACE_RUN_TESTS:=yes}" SRCDIR="$WORKSPACE/src/babeltrace" TMPDIR="$WORKSPACE/tmp" @@ -394,16 +396,18 @@ $MAKE install DESTDIR="$WORKSPACE" # Run tests, don't fail now, we want to run the archiving steps failed_tests=0 -$MAKE --keep-going check || failed_tests=1 - -# Copy tap logs for the jenkins tap parser before cleaning the build dir -rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$WORKSPACE/tap" - -# The test suite prior to 1.5 did not produce TAP logs -if verlt "$PACKAGE_VERSION" "1.5"; then - mkdir -p "$WORKSPACE/tap/no-log" - echo "1..1" > "$WORKSPACE/tap/no-log/tests.log" - echo "ok 1 - Test suite doesn't support logging" >> "$WORKSPACE/tap/no-log/tests.log" +if [ "$BABELTRACE_RUN_TESTS" = "yes" ]; then + $MAKE --keep-going check || failed_tests=1 + + # Copy tap logs for the jenkins tap parser before cleaning the build dir + rsync -a --exclude 'test-suite.log' --include '*/' --include '*.log' --exclude='*' tests/ "$WORKSPACE/tap" + + # The test suite prior to 1.5 did not produce TAP logs + if verlt "$PACKAGE_VERSION" "1.5"; then + mkdir -p "$WORKSPACE/tap/no-log" + echo "1..1" > "$WORKSPACE/tap/no-log/tests.log" + echo "ok 1 - Test suite doesn't support logging" >> "$WORKSPACE/tap/no-log/tests.log" + fi fi # Clean the build directory diff --git a/scripts/lttng-tools/gerrit-depends-on.sh b/scripts/lttng-tools/gerrit-depends-on.sh index 33fd9d4..9e607bf 100755 --- a/scripts/lttng-tools/gerrit-depends-on.sh +++ b/scripts/lttng-tools/gerrit-depends-on.sh @@ -28,7 +28,7 @@ gerrit_query="&o=CURRENT_REVISION&o=DOWNLOAD_COMMANDS" gerrit_json_query=".[0].revisions[.[0].current_revision].ref" gerrit_json_query_status=".[0].status" -possible_depends_on="lttng-ust|lttng-modules|userspace-rcu" +possible_depends_on="lttng-ust|lttng-modules|userspace-rcu|babeltrace" re="Depends-on: (${possible_depends_on}): ([^'$'\n'']*)" property_file="${WORKSPACE}/gerrit_custom_dependencies.properties" -- 2.34.1