From 21381b939be7fd08244a7bbe492cf9f2a3979b4d Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Fri, 8 Dec 2023 13:05:37 +0100 Subject: [PATCH 1/2] Retry memcached tests 3 times on error --- .github/workflows/hostap.yml | 2 +- .github/workflows/memcached.sh | 14 ++++++++++++++ .github/workflows/memcached.yml | 30 ++++++++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100755 .github/workflows/memcached.sh diff --git a/.github/workflows/hostap.yml b/.github/workflows/hostap.yml index 92eddd9ec..84ea1009e 100644 --- a/.github/workflows/hostap.yml +++ b/.github/workflows/hostap.yml @@ -250,7 +250,7 @@ jobs: TESTS=$(printf '%s\n' "${ary[@]}" | tr '\n' ' ') # Retry up to three times for i in {1..3}; do - HWSIM_RES=0 + HWSIM_RES=0 # Not set when command succeeds # Logs can grow quickly especially in debug mode sudo rm -rf logs sudo ./start.sh diff --git a/.github/workflows/memcached.sh b/.github/workflows/memcached.sh new file mode 100755 index 000000000..7394c14aa --- /dev/null +++ b/.github/workflows/memcached.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ -z "$GITHUB_WORKSPACE" ]; then + echo '$GITHUB_WORKSPACE is not set' + exit 1 +fi + +if [ -z "$HOST_ROOT" ]; then + echo '$HOST_ROOT is not set' + exit 1 +fi + +chroot $HOST_ROOT make -C $GITHUB_WORKSPACE/memcached \ + -j$(nproc) PARALLEL=$(nproc) test_tls diff --git a/.github/workflows/memcached.yml b/.github/workflows/memcached.yml index 3059487b0..50a4fda69 100644 --- a/.github/workflows/memcached.yml +++ b/.github/workflows/memcached.yml @@ -16,6 +16,9 @@ jobs: configure: --enable-memcached install: true + - name: Bundle Docker entry point + run: cp wolfssl/.github/workflows/memcached.sh build-dir/bin + - name: Upload built lib uses: actions/upload-artifact@v3 with: @@ -77,5 +80,28 @@ jobs: - name: Run memcached tests working-directory: ./memcached run: | - export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH - make -j$(nproc) PARALLEL=$(nproc) test_tls + # Retry up to three times + # Using docker because interrupting the tests doesn't close running + # background servers. They can become daemonized and then all re-runs + # will always fail. + chmod +x $GITHUB_WORKSPACE/build-dir/bin/memcached.sh + for i in {1..3}; do + echo "-------- RUNNING TESTS --------" + MEMCACHED_RES=0 # Not set when command succeeds + # Tests should usually take less than 4 minutes. If already taking + # 5 minutes then they are probably stuck. Interrupt and re-run. + timeout 5m docker run -v /:/host \ + -v $GITHUB_WORKSPACE/build-dir/bin/memcached.sh:/memcached.sh \ + -e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \ + -e HOST_ROOT=/host \ + -e LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH \ + alpine:latest /memcached.sh || MEMCACHED_RES=$? + + if [ "$MEMCACHED_RES" -eq "0" ]; then + break + fi + done + echo "test ran $i times" + if [ "$MEMCACHED_RES" -ne "0" ]; then + exit $MEMCACHED_RES + fi From 1bf0d8c896b2ef408128fc7843b14bc00fb42c7d Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Fri, 8 Dec 2023 16:27:10 +0100 Subject: [PATCH 2/2] Use SIGKILL to actually kill the runner --- .github/workflows/memcached.sh | 10 +++++----- .github/workflows/memcached.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/memcached.sh b/.github/workflows/memcached.sh index 7394c14aa..ee563ebd8 100755 --- a/.github/workflows/memcached.sh +++ b/.github/workflows/memcached.sh @@ -1,14 +1,14 @@ #!/bin/sh if [ -z "$GITHUB_WORKSPACE" ]; then - echo '$GITHUB_WORKSPACE is not set' - exit 1 + echo '$GITHUB_WORKSPACE is not set' + exit 1 fi if [ -z "$HOST_ROOT" ]; then - echo '$HOST_ROOT is not set' - exit 1 + echo '$HOST_ROOT is not set' + exit 1 fi chroot $HOST_ROOT make -C $GITHUB_WORKSPACE/memcached \ - -j$(nproc) PARALLEL=$(nproc) test_tls + -j$(nproc) PARALLEL=$(nproc) test_tls diff --git a/.github/workflows/memcached.yml b/.github/workflows/memcached.yml index 50a4fda69..9a4c81317 100644 --- a/.github/workflows/memcached.yml +++ b/.github/workflows/memcached.yml @@ -90,7 +90,7 @@ jobs: MEMCACHED_RES=0 # Not set when command succeeds # Tests should usually take less than 4 minutes. If already taking # 5 minutes then they are probably stuck. Interrupt and re-run. - timeout 5m docker run -v /:/host \ + time timeout -s SIGKILL 5m docker run -v /:/host \ -v $GITHUB_WORKSPACE/build-dir/bin/memcached.sh:/memcached.sh \ -e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \ -e HOST_ROOT=/host \