Skip to content

Commit 3d681ce

Browse files
committed
Fix shellcheck errors in run_test.sh
Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
1 parent ceb3d16 commit 3d681ce

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

run_test.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ MYPY_PROTOBUF_VENV=venv_$PY_VER_MYPY_PROTOBUF
142142
fi
143143
)
144144

145-
ERRORS=()
145+
ERROR_FILE=$(mktemp)
146+
trap 'rm -f "$ERROR_FILE"' EXIT
146147

147148
for PY_VER in $PY_VER_UNIT_TESTS; do
148149
UNIT_TESTS_VENV=venv_$PY_VER
@@ -202,7 +203,7 @@ for PY_VER in $PY_VER_UNIT_TESTS; do
202203
cp "$MYPY_OUTPUT/mypy_output.omit_linenos" "test_negative/output.expected.$PY_VER_MYPY_TARGET.omit_linenos"
203204

204205
# Record error instead of echoing and exiting
205-
ERRORS+=("test_negative/output.expected.$PY_VER_MYPY_TARGET didnt match. Copying over for you.")
206+
echo "test_negative/output.expected.$PY_VER_MYPY_TARGET didnt match. Copying over for you." >> "$ERROR_FILE"
206207
fi
207208
)
208209

@@ -214,11 +215,11 @@ for PY_VER in $PY_VER_UNIT_TESTS; do
214215
done
215216

216217
# Report all errors at the end
217-
if [ ${#ERRORS[@]} -gt 0 ]; then
218+
if [ -s "$ERROR_FILE" ]; then
218219
echo -e "\n${RED}===============================================${NC}"
219-
for error in "${ERRORS[@]}"; do
220+
while IFS= read -r error; do
220221
echo -e "${RED}$error${NC}"
221-
done
222+
done < "$ERROR_FILE"
222223
echo -e "${RED}Now rerun${NC}"
223224
exit 1
224225
fi

0 commit comments

Comments
 (0)