Skip to content

Commit b8f03ec

Browse files
sbryngelsonclaude
andcommitted
Fix stale failed_uuids.txt on abort, guard empty retry, quote nproc
- Clean up failed_uuids.txt on early abort path so CI doesn't retry stale UUIDs from a previous run - Guard retry condition with NUM_FAILED > 0 to prevent full-suite rerun when the file exists but is empty - Quote $(nproc) to silence shellcheck SC2046 warnings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bc0f282 commit b8f03ec

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- name: Check Formatting
3030
run: |
31-
./mfc.sh format -j $(nproc)
31+
./mfc.sh format -j "$(nproc)"
3232
git diff --exit-code || (echo "::error::Code is not formatted. Run './mfc.sh format' locally." && exit 1)
3333
3434
- name: Spell Check
@@ -138,25 +138,25 @@ jobs:
138138

139139
- name: Build
140140
run: |
141-
/bin/bash mfc.sh test -v --dry-run -j $(nproc) --${{ matrix.debug }} --${{ matrix.mpi }} --${{ matrix.precision }} $TEST_ALL
141+
/bin/bash mfc.sh test -v --dry-run -j "$(nproc)" --${{ matrix.debug }} --${{ matrix.mpi }} --${{ matrix.precision }} $TEST_ALL
142142
env:
143143
TEST_ALL: ${{ matrix.mpi == 'mpi' && '--test-all' || '' }}
144144

145145
- name: Test
146146
run: |
147147
rm -f tests/failed_uuids.txt
148148
TEST_EXIT=0
149-
/bin/bash mfc.sh test -v --max-attempts 3 -j $(nproc) $TEST_ALL $TEST_PCT || TEST_EXIT=$?
149+
/bin/bash mfc.sh test -v --max-attempts 3 -j "$(nproc)" $TEST_ALL $TEST_PCT || TEST_EXIT=$?
150150
151151
# Retry only if a small number of tests failed (sporadic failures)
152152
if [ -f tests/failed_uuids.txt ]; then
153153
NUM_FAILED=$(wc -l < tests/failed_uuids.txt)
154-
if [ "$NUM_FAILED" -le 5 ]; then
154+
if [ "$NUM_FAILED" -gt 0 ] && [ "$NUM_FAILED" -le 5 ]; then
155155
FAILED=$(cat tests/failed_uuids.txt | tr '\n' ' ')
156156
echo ""
157157
echo "=== Retrying $NUM_FAILED failed test(s): $FAILED ==="
158158
echo ""
159-
/bin/bash mfc.sh test -v --max-attempts 3 -j $(nproc) --only $FAILED $TEST_ALL || exit $?
159+
/bin/bash mfc.sh test -v --max-attempts 3 -j "$(nproc)" --only $FAILED $TEST_ALL || exit $?
160160
else
161161
echo "Too many failures ($NUM_FAILED) to retry — likely a real issue."
162162
exit 1

toolchain/mfc/test/test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@ def test():
190190

191191
# Check if we aborted due to high failure rate
192192
if abort_tests.is_set():
193+
# Clean up stale failed_uuids.txt so CI doesn't retry wrong tests
194+
failed_uuids_path = os.path.join(common.MFC_TEST_DIR, "failed_uuids.txt")
195+
if os.path.exists(failed_uuids_path):
196+
os.remove(failed_uuids_path)
197+
193198
total_completed = nFAIL + nPASS
194199
cons.print()
195200
cons.unindent()

0 commit comments

Comments
 (0)