diff options
Diffstat (limited to 'extras/hs-test/script')
-rwxr-xr-x | extras/hs-test/script/build_boringssl.sh | 2 | ||||
-rwxr-xr-x | extras/hs-test/script/build_hst.sh | 49 | ||||
-rwxr-xr-x | extras/hs-test/script/build_nginx.sh | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | extras/hs-test/script/compress.sh | 55 | ||||
-rwxr-xr-x | extras/hs-test/script/nginx_ldp.sh | 3 |
5 files changed, 66 insertions, 45 deletions
diff --git a/extras/hs-test/script/build_boringssl.sh b/extras/hs-test/script/build_boringssl.sh index 441878a77ca..cca4e4a31d1 100755 --- a/extras/hs-test/script/build_boringssl.sh +++ b/extras/hs-test/script/build_boringssl.sh @@ -1,4 +1,4 @@ #!/bin/bash -cd boringssl +cd boringssl || exit 1 cmake -GNinja -B build ninja -C build diff --git a/extras/hs-test/script/build_hst.sh b/extras/hs-test/script/build_hst.sh index 33a8393b8b5..0f5c0a43630 100755 --- a/extras/hs-test/script/build_hst.sh +++ b/extras/hs-test/script/build_hst.sh @@ -1,37 +1,51 @@ #!/usr/bin/env bash -if [ $(lsb_release -is) != Ubuntu ]; then +if [ "$(lsb_release -is)" != Ubuntu ]; then echo "Host stack test framework is supported only on Ubuntu" exit 1 fi -if [ -z $(which ab) ]; then +if [ -z "$(which ab)" ]; then echo "Host stack test framework requires apache2-utils to be installed" echo "It is recommended to run 'sudo make install-dep'" exit 1 fi -if [ -z $(which wrk) ]; then +if [ -z "$(which wrk)" ]; then echo "Host stack test framework requires wrk to be installed" echo "It is recommended to run 'sudo make install-dep'" exit 1 fi export VPP_WS=../.. +OS_ARCH="$(uname -m)" +DOCKER_BUILD_DIR="/scratch/docker-build" +DOCKER_CACHE_DIR="${DOCKER_BUILD_DIR}/docker_cache" + +if [ -d "${DOCKER_BUILD_DIR}" ] ; then + mkdir -p "${DOCKER_CACHE_DIR}" + DOCKER_HST_BUILDER="hst_builder" + set -x + if ! docker buildx ls --format "{{.Name}}" | grep -q "${DOCKER_HST_BUILDER}"; then + docker buildx create --name=${DOCKER_HST_BUILDER} --driver=docker-container --use --bootstrap || true + fi + set -x + DOCKER_CACHE_ARGS="--builder=${DOCKER_HST_BUILDER} --load --cache-to type=local,dest=${DOCKER_CACHE_DIR},mode=max --cache-from type=local,src=${DOCKER_CACHE_DIR}" +fi if [ "$1" == "debug" ]; then VPP_BUILD_ROOT=${VPP_WS}/build-root/build-vpp_debug-native/vpp +elif [ "$1" == "gcov" ]; then + VPP_BUILD_ROOT=${VPP_WS}/build-root/build-vpp_gcov-native/vpp else VPP_BUILD_ROOT=${VPP_WS}/build-root/build-vpp-native/vpp fi echo "Taking build objects from ${VPP_BUILD_ROOT}" -if [ -z "$UBUNTU_VERSION" ] ; then - export UBUNTU_VERSION=$(lsb_release -rs) -fi +export UBUNTU_VERSION=${UBUNTU_VERSION:-"$(lsb_release -rs)"} echo "Ubuntu version is set to ${UBUNTU_VERSION}" -export HST_LDPRELOAD=${VPP_BUILD_ROOT}/lib/x86_64-linux-gnu/libvcl_ldpreload.so +export HST_LDPRELOAD=${VPP_BUILD_ROOT}/lib/${OS_ARCH}-linux-gnu/libvcl_ldpreload.so echo "HST_LDPRELOAD is set to ${HST_LDPRELOAD}" export PATH=${VPP_BUILD_ROOT}/bin:$PATH @@ -45,7 +59,7 @@ rm -rf vpp-data/lib/* || true cp ${VPP_BUILD_ROOT}/bin/* ${bin} res+=$? -cp -r ${VPP_BUILD_ROOT}/lib/x86_64-linux-gnu/* ${lib} +cp -r ${VPP_BUILD_ROOT}/lib/"${OS_ARCH}"-linux-gnu/* ${lib} res+=$? if [ $res -ne 0 ]; then echo "Failed to copy VPP files. Is VPP built? Try running 'make build' in VPP directory." @@ -55,25 +69,30 @@ fi docker_build () { tag=$1 dockername=$2 - docker build --build-arg UBUNTU_VERSION \ - --build-arg http_proxy=$HTTP_PROXY \ - --build-arg https_proxy=$HTTP_PROXY \ - --build-arg HTTP_PROXY=$HTTP_PROXY \ - --build-arg HTTPS_PROXY=$HTTP_PROXY \ - -t $tag -f docker/Dockerfile.$dockername . + set -x + # shellcheck disable=2086 + docker buildx build ${DOCKER_CACHE_ARGS} \ + --build-arg UBUNTU_VERSION \ + --build-arg http_proxy="$HTTP_PROXY" \ + --build-arg https_proxy="$HTTP_PROXY" \ + --build-arg HTTP_PROXY="$HTTP_PROXY" \ + --build-arg HTTPS_PROXY="$HTTP_PROXY" \ + -t "$tag" -f docker/Dockerfile."$dockername" . + set +x } docker_build hs-test/vpp vpp docker_build hs-test/nginx-ldp nginx docker_build hs-test/nginx-server nginx-server docker_build hs-test/build build -docker_build hs-test/curl curl if [ "$HST_EXTENDED_TESTS" = true ] ; then docker_build hs-test/nginx-http3 nginx-http3 + docker_build hs-test/curl curl fi # cleanup detached images images=$(docker images --filter "dangling=true" -q --no-trunc) if [ "$images" != "" ]; then + # shellcheck disable=SC2086 docker rmi $images fi diff --git a/extras/hs-test/script/build_nginx.sh b/extras/hs-test/script/build_nginx.sh index 69d366aab0e..f21201c4297 100755 --- a/extras/hs-test/script/build_nginx.sh +++ b/extras/hs-test/script/build_nginx.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd nginx +cd nginx || exit 1 ./auto/configure --with-debug --with-http_v3_module --with-cc-opt="-I../boringssl/include" --with-ld-opt="-L../boringssl/build/ssl -L../boringssl/build/crypto" --without-http_rewrite_module --without-http_gzip_module make make install diff --git a/extras/hs-test/script/compress.sh b/extras/hs-test/script/compress.sh index 92a2fbd6789..c6b23cf9bdd 100644..100755 --- a/extras/hs-test/script/compress.sh +++ b/extras/hs-test/script/compress.sh @@ -1,34 +1,35 @@ #!/usr/bin/env bash -if [ "${COMPRESS_FAILED_TEST_LOGS}" == "yes" -a -s "${HS_SUMMARY}/failed-summary.log" ] +# if failed-summary.log is not empty, exit status = 1 +if [ -s "${HS_ROOT}/summary/failed-summary.log" ] then - echo -n "Copying docker logs..." - dirs=$(jq -r '.[0] | .SpecReports[] | select(.State == "failed") | .LeafNodeText' ${HS_SUMMARY}/report.json) - for dirName in $dirs; do - logDir=/tmp/hs-test/$dirName - if [ -d "$logDir" ]; then - mkdir -p $WORKSPACE/archives/summary - cp -r $logDir $WORKSPACE/archives/summary/ - fi - done - echo "Done." - - if [ -n "$WORKSPACE" ] + if [ -n "${WORKSPACE}" ] then - echo -n "Copying failed test logs into build log archive directory ($WORKSPACE/archives)... " - mkdir -p $WORKSPACE/archives/summary - cp -a ${HS_SUMMARY}/* $WORKSPACE/archives/summary - echo "Done." - fi + echo -n "Copying docker logs..." + dirs=$(jq -r '.[0] | .SpecReports[] | select(.State == "failed") | .LeafNodeText' ${HS_ROOT}/summary/report.json) + for dirName in $dirs; do + logDir=/tmp/hs-test/$dirName + if [ -d "$logDir" ]; then + mkdir -p ${WORKSPACE}/archives/summary + cp -r $logDir ${WORKSPACE}/archives/summary/ + fi + done + echo "Done." - echo -n "Compressing files in $WORKSPACE/archives from test runs... " - cd $WORKSPACE/archives - find . -type f \( -name "*.json" -o -name "*.log" \) -exec gzip {} \; - echo "Done." + echo -n "Copying failed test logs into build log archive directory (${WORKSPACE}/archives)... " + mkdir -p ${WORKSPACE}/archives/summary + cp -a ${HS_ROOT}/summary/* ${WORKSPACE}/archives/summary + echo "Done." -else - echo "Not compressing files in temporary directories from test runs." - exit 0 -fi + echo -n "Compressing files in ${WORKSPACE}/archives from test runs... " + cd ${WORKSPACE}/archives + find . -type f \( -name "*.json" -o -name "*.log" \) -exec gzip {} \; + echo "Done." -exit 1
\ No newline at end of file + else + echo "Not compressing files in temporary directories from test runs." + fi + echo "*************************** SUMMARY ***************************" + cat "${HS_ROOT}/summary/failed-summary.log" + exit 1 +fi diff --git a/extras/hs-test/script/nginx_ldp.sh b/extras/hs-test/script/nginx_ldp.sh index 4a22e14aaf7..416aa5499af 100755 --- a/extras/hs-test/script/nginx_ldp.sh +++ b/extras/hs-test/script/nginx_ldp.sh @@ -1,3 +1,4 @@ #!/usr/bin/env bash -LD_PRELOAD=$LDP $@ 2>&1 > /proc/1/fd/1 +# shellcheck disable=SC2068 +$1 -v && LD_PRELOAD=$LDP $@ > /proc/1/fd/1 2>&1 |