| 1 | #!/bin/bash |
| 2 | # shellcheck disable=SC2103 |
| 3 | # |
| 4 | # Copyright (C) 2022 Jonathan Rajotte-Julien <jonathan.rajotte-julien@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 | |
| 19 | set -eux |
| 20 | |
| 21 | BASEDIR_64="$WORKSPACE/deps-64/build" |
| 22 | BASEDIR_32="$WORKSPACE/deps-32/build" |
| 23 | export CPPFLAGS="-I$BASEDIR_64/include" |
| 24 | export LDFLAGS="-L$BASEDIR_64/lib" |
| 25 | export CFLAGS="-g -O0" |
| 26 | export CXXFLAGS="-g -O0" |
| 27 | export PKG_CONFIG_PATH="$BASEDIR_64/lib/pkgconfig" |
| 28 | export LD_LIBRARY_PATH="$BASEDIR_64/lib:$BASEDIR_32/lib" |
| 29 | export PATH="$PATH:$BASEDIR_64/bin" |
| 30 | export BABELTRACE_PLUGIN_PATH="$BASEDIR_64/lib/babeltrace2/plugins/" |
| 31 | export LIBBABELTRACE2_PLUGIN_PROVIDER_DIR="$BASEDIR_64/lib/babeltrace2/plugin-providers/" |
| 32 | PREFIX="/build" |
| 33 | export JAVA_HOME="/usr/lib/jvm/default-java" |
| 34 | DEPS_JAVA="$WORKSPACE/deps-64/build/share/java" |
| 35 | 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" |
| 36 | export PYTHON2="python2" |
| 37 | export PYTHON3="python3" |
| 38 | P2_VERSION=$($PYTHON2 -c "import sys;print(sys.version[:3])") |
| 39 | P3_VERSION=$($PYTHON3 -c "import sys;print(sys.version[:3])") |
| 40 | DEPS_PYTHON2="$WORKSPACE/deps-64/build/lib/python$P2_VERSION/site-packages" |
| 41 | DEPS_PYTHON3="$WORKSPACE/deps-64/build/lib/python$P3_VERSION/site-packages" |
| 42 | export PYTHONPATH="$DEPS_PYTHON2:$DEPS_PYTHON3" |
| 43 | export LTTNG_CONSUMERD32_BIN="$BASEDIR_32/lib/lttng/libexec/lttng-consumerd" |
| 44 | export LTTNG_CONSUMERD32_LIBDIR="$BASEDIR_32/lib" |
| 45 | export LTTNG_CONSUMERD64_BIN="$BASEDIR_64/lib/lttng/libexec/lttng-consumerd" |
| 46 | export LTTNG_CONSUMERD64_LIBDIR="$BASEDIR_64/lib/" |
| 47 | |
| 48 | # Stable 2.12 and 2.13 still look for "babeltrace" |
| 49 | ln -s "$BASEDIR_64/bin/babeltrace2" "$BASEDIR_64/bin/babeltrace" |
| 50 | |
| 51 | echo "# Setup endpoint |
| 52 | host_base = obj.internal.efficios.com |
| 53 | host_bucket = obj.internal.efficios.com |
| 54 | bucket_location = us-east-1 |
| 55 | use_https = True |
| 56 | |
| 57 | # Setup access keys |
| 58 | access_key = jenkins |
| 59 | secret_key = echo123456 |
| 60 | |
| 61 | # Enable S3 v4 signature APIs |
| 62 | signature_v2 = False" > "$WORKSPACE/.s3cfg" |
| 63 | |
| 64 | |
| 65 | mkdir artefact |
| 66 | pushd artefact |
| 67 | s3cmd -c "$WORKSPACE/.s3cfg" get "s3://jenkins/32-64-bit-integration/$ARTIFACT_ID" |
| 68 | tar -xvf "$ARTIFACT_ID" |
| 69 | popd |
| 70 | |
| 71 | cp -r artefact/sources/* ./ |
| 72 | cp -r artefact/deps/* ./ |
| 73 | |
| 74 | pushd src/lttng-modules |
| 75 | make -j"$(nproc)" V=1 |
| 76 | make modules_install |
| 77 | depmod -a |
| 78 | popd |
| 79 | |
| 80 | pushd src/lttng-tools |
| 81 | |
| 82 | ./bootstrap |
| 83 | ./configure --prefix="$PREFIX" --enable-test-java-agent-all --enable-test-python-agent-all |
| 84 | popd |
| 85 | |
| 86 | # Deativate health test, simply because there is little value for this integration testing |
| 87 | # and because de ld_preloaded object is for both lttng-sessiond/consumer leading to difficult ld_preloading |
| 88 | # Deactivate clock plugin test since the app must load the correct biness so and the sessiond its bitness so, |
| 89 | # this is simply not feasible from outside the script. There is little value for this test in this testing context. |
| 90 | pushd src/lttng-tools/tests/regression |
| 91 | sed -i '/tools\/health\/test_thread_ok/d' Makefile.am |
| 92 | sed -i '/ust\/clock-override\/test_clock_override/d' Makefile.am |
| 93 | popd |
| 94 | |
| 95 | pushd src/lttng-tools/ |
| 96 | make -j"$(nproc)" V=1 |
| 97 | popd |
| 98 | |
| 99 | case "$TEST_TYPE" in |
| 100 | "canary") |
| 101 | ;; |
| 102 | "32bit-sessiond") |
| 103 | pushd src/lttng-tools/src/bin/lttng-sessiond |
| 104 | rm lttng-sessiond |
| 105 | ln -s "$BASEDIR_32/bin/lttng-sessiond" lttng-sessiond |
| 106 | popd |
| 107 | |
| 108 | cp -rv "$WORKSPACE/artefact/testing-overlay/sessiond/"* ./ |
| 109 | ;; |
| 110 | "32bit-relayd") |
| 111 | pushd src/lttng-tools/src/bin/lttng-relayd |
| 112 | rm lttng-relayd |
| 113 | ln -s "$BASEDIR_32/bin/lttng-relayd" lttng-relayd |
| 114 | popd |
| 115 | ;; |
| 116 | "32bit-cli") |
| 117 | pushd src/lttng-tools/src/bin/lttng |
| 118 | rm lttng |
| 119 | ln -s "$BASEDIR_32/bin/lttng" lttng |
| 120 | popd |
| 121 | ;; |
| 122 | *) |
| 123 | exit 1 |
| 124 | esac |
| 125 | failed_test=0 |
| 126 | pushd src/lttng-tools/tests |
| 127 | make --keep-going check || failed_test=1 |
| 128 | popd |
| 129 | |
| 130 | exit $failed_test |