Skip to content

Commit a0c75b0

Browse files
gojimmypidanielinux
authored andcommitted
Retry with WOLFBOOT_HUGE_STACK=1 as needed
1 parent 3d49027 commit a0c75b0

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

.github/workflows/test-library.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
test-lib:
1111
# If jobs cancel, consider pinning to ubuntu-24.04
1212
# The ubuntu-latest alias can point to different images during migrations (and sometimes be extra busy),
13-
# while ubuntu-24.04 always targets the 24.04 poo
13+
# while ubuntu-24.04 always targets the 24.04 pool
1414
runs-on: ubuntu-latest
1515

1616
# The timeout is run time after a runner starts, not time in queue
@@ -44,17 +44,45 @@ jobs:
4444
4545
- name: Build test-lib
4646
env:
47+
shell: bash
4748
ASYM: ${{ matrix.asym }}
4849
HASH: ${{ matrix.hash }}
4950
MATH: ${{ matrix.math }}
5051
run: |
52+
# Sample build
53+
build_once() {
54+
# Convert asym and hash to upper case, optionally add additional param
55+
make -j test-lib SIGN=${ASYM^^} HASH=${HASH^^} ${MATH} "$@"
56+
}
57+
58+
set -euo pipefail
59+
60+
# Get the reference config
5161
cp config/examples/library.config .config
62+
63+
# Keytools
5264
make keytools
5365
./tools/keytools/keygen --${ASYM} -g wolfboot_signing_private_key.der
66+
67+
# Sign
5468
echo "Test" > test.bin
5569
./tools/keytools/sign --${ASYM} --${HASH} test.bin wolfboot_signing_private_key.der 1
56-
# Convert asym and hash to upper case
57-
make test-lib SIGN=${ASYM^^} HASH=${HASH^^} ${MATH}
70+
71+
# First attempt
72+
if build_once >build.out 2>build.err; then
73+
echo "Success on first attempt"
74+
exit 0
75+
fi
76+
77+
# If it failed due to the TFM huge stack guard, retry with the flag
78+
if grep -q 'TFM will allocate 70\+ KB in the stack' build.err; then
79+
echo "Retrying with WOLFBOOT_HUGE_STACK=1 due to TFM stack requirement"
80+
build_once WOLFBOOT_HUGE_STACK=1
81+
else
82+
echo "Build failed for another reason:"
83+
cat build.err
84+
exit 1
85+
fi
5886
5987
- name: Run test-lib
6088
run: |

0 commit comments

Comments
 (0)