Skip to content

Commit

Permalink
Pass -f to rm in cleanup handlers
Browse files Browse the repository at this point in the history
When a test fails, some of the files the cleanup handler needs to remove
may not have been created, so pass -f to rm to ignore nonexistent files.
  • Loading branch information
wantehchang committed Mar 19, 2024
1 parent 2a4b6b1 commit 556dc53
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/test_cmd_animation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ERROR_MSG="avif_test_cmd_animation_error_msg.txt"

cleanup() {
pushd ${TMP_DIR}
rm -- "${ENCODED_FILE}" "${DECODED_FILE}" "${ERROR_MSG}"
rm -f -- "${ENCODED_FILE}" "${DECODED_FILE}" "${ERROR_MSG}"
popd
}
trap cleanup EXIT
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cmd_grid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ DECODED_FILE_7x5="avif_test_cmd_grid_7x5_decoded.png"
# Cleanup
cleanup() {
pushd ${TMP_DIR}
rm -- "${ENCODED_FILE}" "${DECODED_FILE}" \
"${ENCODED_FILE_2x2}" "${DECODED_FILE_2x2}" \
"${ENCODED_FILE_7x5}" "${DECODED_FILE_7x5}"
rm -f -- "${ENCODED_FILE}" "${DECODED_FILE}" \
"${ENCODED_FILE_2x2}" "${DECODED_FILE_2x2}" \
"${ENCODED_FILE_7x5}" "${DECODED_FILE_7x5}"
popd
}
trap cleanup EXIT
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmd_icc_profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CORRECTED_FILE="avif_test_cmd_icc_profile_corrected.png"
# Cleanup
cleanup() {
pushd ${TMP_DIR}
rm -- "${ENCODED_FILE}" "${DECODED_FILE}" "${CORRECTED_FILE}"
rm -f -- "${ENCODED_FILE}" "${DECODED_FILE}" "${CORRECTED_FILE}"
popd
}
trap cleanup EXIT
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmd_lossless.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ DECODED_FILE_LOSSLESS="avif_test_cmd_lossless_decoded_lossless.png"
# Cleanup
cleanup() {
pushd ${TMP_DIR}
rm -- "${ENCODED_FILE}" "${DECODED_FILE}" "${DECODED_FILE_LOSSLESS}"
rm -f -- "${ENCODED_FILE}" "${DECODED_FILE}" "${DECODED_FILE_LOSSLESS}"
popd
}
trap cleanup EXIT
Expand Down
5 changes: 3 additions & 2 deletions tests/test_cmd_metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ DECODED_FILE_CHANGED_ICC="avif_test_cmd_metadata_decoded_changed_icc.png"
# Cleanup
cleanup() {
pushd ${TMP_DIR}
rm -- "${ENCODED_FILE}" "${ENCODED_FILE_NO_METADATA}" "${ENCODED_FILE_MORE_METADATA}" \
"${DECODED_FILE}" "${DECODED_FILE_CHANGED_ICC}"
rm -f -- "${ENCODED_FILE}" "${ENCODED_FILE_NO_METADATA}" \
"${ENCODED_FILE_MORE_METADATA}" \
"${DECODED_FILE}" "${DECODED_FILE_CHANGED_ICC}"
popd
}
trap cleanup EXIT
Expand Down
3 changes: 2 additions & 1 deletion tests/test_cmd_targetsize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ DECODED_BIGGEST_FILE="avif_test_cmd_targetsize_decoded_biggest.png"
# Cleanup
cleanup() {
pushd ${TMP_DIR}
rm -- "${ENCODED_FILE}" "${DECODED_SMALLEST_FILE}" "${DECODED_BIGGEST_FILE}"
rm -f -- "${ENCODED_FILE}" "${DECODED_SMALLEST_FILE}" \
"${DECODED_BIGGEST_FILE}"
popd
}
trap cleanup EXIT
Expand Down

0 comments on commit 556dc53

Please sign in to comment.