diff --git a/build-scripts/cassandra-artifacts_s390x.sh b/build-scripts/cassandra-artifacts_s390x.sh new file mode 100644 index 00000000..5954cf3d --- /dev/null +++ b/build-scripts/cassandra-artifacts_s390x.sh @@ -0,0 +1,110 @@ +#!/bin/bash -xe + +################################ +# +# Prep +# +################################ + +# variables, with defaults +[ "x${cassandra_builds_dir}" != "x" ] || cassandra_builds_dir="cassandra-builds" + +# pre-conditions +command -v ant >/dev/null 2>&1 || { echo >&2 "ant needs to be installed"; exit 1; } +command -v pip >/dev/null 2>&1 || { echo >&2 "pip needs to be installed"; exit 1; } +command -v virtualenv >/dev/null 2>&1 || { echo >&2 "virtualenv needs to be installed"; exit 1; } +command -v docker >/dev/null 2>&1 || { echo >&2 "docker needs to be installed"; exit 1; } +(docker info >/dev/null 2>&1) || { echo >&2 "docker needs to running"; exit 1; } +[ -f "build.xml" ] || { echo >&2 "build.xml must exist"; exit 1; } +[ -d "${cassandra_builds_dir}" ] || { echo >&2 "cassandra-builds directory must exist"; exit 1; } + +# print debug information on versions +ant -version +pip --version +virtualenv --version +docker --version + +# Sphinx is needed for the gen-doc target +virtualenv venv +source venv/bin/activate +# setuptools 45.0.0 requires python 3.5+ +python -m pip install "setuptools<45" Sphinx sphinx_rtd_theme + +################################ +# +# Main +# +################################ + +# Setup JDK +java_version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F. '{print $1}') +if [ "$java_version" -ge 11 ]; then + java_version="11" + export CASSANDRA_USE_JDK11=true + if ! grep -q CASSANDRA_USE_JDK11 build.xml ; then + echo "Skipping build. JDK11 not supported against $(grep 'property\s*name=\"base.version\"' build.xml |sed -ne 's/.*value=\"\([^"]*\)\".*/\1/p')" + exit 0 + fi +fi + +# Loop to prevent failure due to maven-ant-tasks not downloading a jar.. +set +e # disable immediate exit from this point + +ARTIFACTS_BUILD_RUN=0 +ECLIPSE_WARNINGS_RUN=0 +HAS_DEPENDENCY_CHECK_TARGET=0 +# versions starting from 6.4.1 contain "rate limiter" functionality to make builds more stable +# https://github.com/jeremylong/DependencyCheck/pull/3725 +DEPENDENCY_CHECK_VERSION=6.4.1 + +for x in $(seq 1 3); do + if [ "${ARTIFACTS_BUILD_RUN}" -eq "0" ]; then + ant clean artifacts + RETURN="$?" + fi + if [ "${RETURN}" -eq "0" ]; then + ARTIFACTS_BUILD_RUN=1 + if [ "${ECLIPSE_WARNINGS_RUN}" -eq "0" ]; then + # Run eclipse-warnings if build was successful + ant eclipse-warnings + RETURN="$?" + fi + if [ "${RETURN}" -eq "0" ]; then + ECLIPSE_WARNINGS_RUN=1 + if [ "${HAS_DEPENDENCY_CHECK_TARGET}" -eq "1" ]; then + ant -Ddependency-check.version=${DEPENDENCY_CHECK_VERSION} -Ddependency-check.home=/tmp/dependency-check-${DEPENDENCY_CHECK_VERSION} dependency-check + RETURN="$?" + else + RETURN="0" + fi + if [ ! "${RETURN}" -eq "0" ]; then + if [ -f /tmp/dependency-check-${DEPENDENCY_CHECK_VERSION}/dependency-check-ant/dependency-check-ant.jar ]; then + # Break the build here only in case dep zip was downloaded (hence JAR was extracted) just fine + # but the check itself has failed. If JAR does not exist, it is probably + # because the network was down so the ant target did not download the zip in the first place. + echo "Failing the build on OWASP dependency check. Run 'ant dependency-check' locally and consult build/dependency-check-report.html to see the details." + break + else + # sleep here to give the net the chance to resume after probable partition + sleep 10 + continue + fi + fi + set -e + fi + break + fi + # sleep here to give the net the chance to resume after probable partition + sleep 10 +done + +################################ +# +# Clean +# +################################ + +# /virtualenv +deactivate + +exit "${RETURN}" diff --git a/build-scripts/cassandra-test.sh b/build-scripts/cassandra-test.sh index eac7274e..104de916 100755 --- a/build-scripts/cassandra-test.sh +++ b/build-scripts/cassandra-test.sh @@ -14,6 +14,9 @@ command -v git >/dev/null 2>&1 || { echo >&2 "git needs to be installed"; exit 1 ant -version git --version +# check arch +arch=`uname -m` + # lists all tests for the specific test type _list_tests() { local -r classlistprefix="$1" @@ -102,7 +105,30 @@ _main() { export TMP_DIR="$(pwd)/tmp" mkdir -p ${TMP_DIR} - + + if [ "$arch" == "s390x" ] + then + case $target in + "stress-test") + # hard fail on test compilation, but dont fail the test run as unstable test reports are processed + ant clean jar stress-build-test + ant $target -Dtmp.dir="$(pwd)/tmp" || echo "failed $target" + ;; + "test") + _run_testlist "unit" "testclasslist-s390x" "${split_chunk}" "$(_timeout_for 'test.timeout')" + ;; + "test-cdc") + _run_testlist "unit" "testclasslist-cdc-s390x" "${split_chunk}" "$(_timeout_for 'test.timeout')" + ;; + "test-compression") + _run_testlist "unit" "testclasslist-compression-s390x" "${split_chunk}" "$(_timeout_for 'test.timeout')" + ;; + *) + echo "unregconised \"$target\"" + exit 1 + ;; + esac +else case $target in "stress-test") # hard fail on test compilation, but dont fail the test run as unstable test reports are processed @@ -160,6 +186,7 @@ _main() { exit 1 ;; esac + fi } _main "$@"