Skip to content

Commit 0c9555b

Browse files
Merge pull request #7045 from julek-wolfssl/memcached-retry
Retry memcached tests 3 times on error
2 parents 0ba3646 + 1bf0d8c commit 0c9555b

3 files changed

Lines changed: 43 additions & 3 deletions

File tree

.github/workflows/hostap.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ jobs:
250250
TESTS=$(printf '%s\n' "${ary[@]}" | tr '\n' ' ')
251251
# Retry up to three times
252252
for i in {1..3}; do
253-
HWSIM_RES=0
253+
HWSIM_RES=0 # Not set when command succeeds
254254
# Logs can grow quickly especially in debug mode
255255
sudo rm -rf logs
256256
sudo ./start.sh

.github/workflows/memcached.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
if [ -z "$GITHUB_WORKSPACE" ]; then
4+
echo '$GITHUB_WORKSPACE is not set'
5+
exit 1
6+
fi
7+
8+
if [ -z "$HOST_ROOT" ]; then
9+
echo '$HOST_ROOT is not set'
10+
exit 1
11+
fi
12+
13+
chroot $HOST_ROOT make -C $GITHUB_WORKSPACE/memcached \
14+
-j$(nproc) PARALLEL=$(nproc) test_tls

.github/workflows/memcached.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
configure: --enable-memcached
1717
install: true
1818

19+
- name: Bundle Docker entry point
20+
run: cp wolfssl/.github/workflows/memcached.sh build-dir/bin
21+
1922
- name: Upload built lib
2023
uses: actions/upload-artifact@v3
2124
with:
@@ -77,5 +80,28 @@ jobs:
7780
- name: Run memcached tests
7881
working-directory: ./memcached
7982
run: |
80-
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH
81-
make -j$(nproc) PARALLEL=$(nproc) test_tls
83+
# Retry up to three times
84+
# Using docker because interrupting the tests doesn't close running
85+
# background servers. They can become daemonized and then all re-runs
86+
# will always fail.
87+
chmod +x $GITHUB_WORKSPACE/build-dir/bin/memcached.sh
88+
for i in {1..3}; do
89+
echo "-------- RUNNING TESTS --------"
90+
MEMCACHED_RES=0 # Not set when command succeeds
91+
# Tests should usually take less than 4 minutes. If already taking
92+
# 5 minutes then they are probably stuck. Interrupt and re-run.
93+
time timeout -s SIGKILL 5m docker run -v /:/host \
94+
-v $GITHUB_WORKSPACE/build-dir/bin/memcached.sh:/memcached.sh \
95+
-e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
96+
-e HOST_ROOT=/host \
97+
-e LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH \
98+
alpine:latest /memcached.sh || MEMCACHED_RES=$?
99+
100+
if [ "$MEMCACHED_RES" -eq "0" ]; then
101+
break
102+
fi
103+
done
104+
echo "test ran $i times"
105+
if [ "$MEMCACHED_RES" -ne "0" ]; then
106+
exit $MEMCACHED_RES
107+
fi

0 commit comments

Comments
 (0)