From aff4e3d1bb7db06b8970e31efa2f5a56486355f7 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Mon, 27 Sep 2021 17:25:45 -0400 Subject: [PATCH] jjb: depends-on: do not run tests of dependencies The important part is how lttng-tools behave. Running the tests of the dependencies is redundant and only leads to wasted time and CPU time. The RUN_TESTS flag is now "namespaced" to ensure that we can turn on and off tests for each projects if necessary. LTTNG_TOOLS_RUN_TESTS LTTNG_TOOLS_RUN_TESTS_LONG_REGRESSION LTTNG_UST_RUN_TESTS USERSPACE_RCU_RUN_TESTS For now only `LTTNG_UST_RUN_TESTS` and `USERSPACE_RCU_RUN_TESTS` can be manipulated via environment injection. The lttng-tools build script is a bit more complex and manipulates the value themselves. More work will be required if we want to control the flags of the lttng-tools build script. Signed-off-by: Jonathan Rajotte --- scripts/liburcu/build.sh | 28 ++++++++++++++---------- scripts/lttng-tools/build.sh | 18 +++++++-------- scripts/lttng-tools/gerrit-depends-on.sh | 2 ++ scripts/lttng-ust/build.sh | 20 ++++++++++------- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/scripts/liburcu/build.sh b/scripts/liburcu/build.sh index edf4795..1fd0e95 100755 --- a/scripts/liburcu/build.sh +++ b/scripts/liburcu/build.sh @@ -89,6 +89,8 @@ conf=${conf:-} build=${build:-} cc=${cc:-} +# Controls if the tests are run +USERSPACE_RCU_RUN_TESTS="${USERSPACE_RCU_RUN_TESTS:=yes}" SRCDIR="$WORKSPACE/src/liburcu" TMPDIR="$WORKSPACE/tmp" @@ -349,20 +351,22 @@ $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 -# Only run regtest for 0.9 and up -if vergte "$PACKAGE_VERSION" "0.9"; then - $MAKE --keep-going regtest || failed_tests=1 -fi +if [ "$USERSPACE_RCU_RUN_TESTS" = "yes" ]; then + $MAKE --keep-going check || failed_tests=1 + # Only run regtest for 0.9 and up + if vergte "$PACKAGE_VERSION" "0.9"; then + $MAKE --keep-going regtest || failed_tests=1 + fi -# 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" + # 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 0.11 did not produce TAP logs -if verlt "$PACKAGE_VERSION" "0.11"; 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" + # The test suite prior to 0.11 did not produce TAP logs + if verlt "$PACKAGE_VERSION" "0.11"; 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/build.sh b/scripts/lttng-tools/build.sh index 3d0be52..e4a85ac 100755 --- a/scripts/lttng-tools/build.sh +++ b/scripts/lttng-tools/build.sh @@ -227,7 +227,7 @@ sol10-i386) export PYTHON="python3" export PYTHON_CONFIG="python3-config" - RUN_TESTS="no" + LTTNG_TOOLS_RUN_TESTS="no" ;; sol11-i386) @@ -240,7 +240,7 @@ sol11-i386) export PYTHON_CONFIG="python3-config" export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/pkgconfig" - RUN_TESTS="no" + LTTNG_TOOLS_RUN_TESTS="no" ;; macos*) @@ -253,7 +253,7 @@ macos*) export PYTHON="python3.9" export PYTHON_CONFIG="python3.9-config" - RUN_TESTS="no" + LTTNG_TOOLS_RUN_TESTS="no" ;; cygwin|cygwin64|msys32|msys64) @@ -261,7 +261,7 @@ cygwin|cygwin64|msys32|msys64) export TAR=tar export NPROC=nproc - RUN_TESTS="no" + LTTNG_TOOLS_RUN_TESTS="no" ;; *) @@ -269,7 +269,7 @@ cygwin|cygwin64|msys32|msys64) export TAR=tar export NPROC=nproc - RUN_TESTS="yes" + LTTNG_TOOLS_RUN_TESTS="yes" PYTHON2=python2 PYTHON3=python3 @@ -284,10 +284,10 @@ esac case "$test_type" in full) - RUN_TESTS_LONG_REGRESSION="yes" + LTTNG_TOOLS_RUN_TESTS_LONG_REGRESSION="yes" ;; *) - RUN_TESTS_LONG_REGRESSION="no" + LTTNG_TOOLS_RUN_TESTS_LONG_REGRESSION="no" ;; esac @@ -450,7 +450,7 @@ $MAKE install DESTDIR="$WORKSPACE" # Run tests for all configs except 'no-ust' failed_tests=0 -if [ "$RUN_TESTS" = "yes" ] && [ "$conf" != "no-ust" ]; then +if [ "$LTTNG_TOOLS_RUN_TESTS" = "yes" ] && [ "$conf" != "no-ust" ]; then # Allow core dumps ulimit -c unlimited @@ -488,7 +488,7 @@ if [ "$RUN_TESTS" = "yes" ] && [ "$conf" != "no-ust" ]; then cd .. fi - if [ "$RUN_TESTS_LONG_REGRESSION" = "yes" ]; then + if [ "$LTTNG_TOOLS_RUN_TESTS_LONG_REGRESSION" = "yes" ]; then cd tests mkdir -p "$TAPDIR/long_regression" prove --merge -v --exec '' - < long_regression --archive "$TAPDIR/long_regression/" || failed_tests=1 diff --git a/scripts/lttng-tools/gerrit-depends-on.sh b/scripts/lttng-tools/gerrit-depends-on.sh index 42b6225..b917c23 100755 --- a/scripts/lttng-tools/gerrit-depends-on.sh +++ b/scripts/lttng-tools/gerrit-depends-on.sh @@ -71,6 +71,8 @@ git rev-list --format=%B --max-count=1 HEAD | while read -r line; do # Export the GERRIT_DEP_... into the property file for further jenkins usage echo "GERRIT_DEP_${project_sanitize^^}=${gerrit_id}" >> "$property_file" + # Deactivate tests for the project + echo "${project_sanitize^^}_RUN_TESTS=no" >> "$property_file" # Get the change latest ref ref=$(curl "${gerrit_url}/changes/${gerrit_id}${gerrit_query}" | tail -n+2 | jq -r "$gerrit_json_query") diff --git a/scripts/lttng-ust/build.sh b/scripts/lttng-ust/build.sh index a3a33e8..37763e6 100755 --- a/scripts/lttng-ust/build.sh +++ b/scripts/lttng-ust/build.sh @@ -89,6 +89,8 @@ conf=${conf:-} build=${build:-} cc=${cc:-} +# Controls if the tests are run +LTTNG_UST_RUN_TESTS="${LTTNG_UST_RUN_TESTS:=yes}" DEPS_INC="$WORKSPACE/deps/build/include" DEPS_LIB="$WORKSPACE/deps/build/lib" @@ -323,16 +325,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 +if [ "$LTTNG_UST_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" + # 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 2.8 did not produce TAP logs -if verlt "$PACKAGE_VERSION" "2.8"; 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" + # The test suite prior to 2.8 did not produce TAP logs + if verlt "$PACKAGE_VERSION" "2.8"; 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 -- 2.34.1