Skip to content

Commit

Permalink
Merge pull request systemd#31868 from bluca/test_cleanup
Browse files Browse the repository at this point in the history
test: delete private images on clean-again
  • Loading branch information
bluca committed Mar 21, 2024
2 parents 431f2ff + 437eddc commit 9773f58
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
14 changes: 6 additions & 8 deletions test/run-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,12 @@ if [[ ${#ARGS[@]} -ne 0 ]]; then
RESULTS["$test"]="$result"
TIMES["$test"]="$SECONDS"

[[ "$result" -ne 0 ]] && FAILURES=$((FAILURES + 1))
done
fi

# Run clean-again, if requested, and if no tests failed
if [[ $FAILURES -eq 0 && $CLEAN_AGAIN -eq 1 ]]; then
for test in "${!RESULTS[@]}"; do
test_run "$test" make -C "$test" clean-again
# Run clean-again here to free up space, if requested, and if the test succeeded
if [[ "$result" -ne 0 ]]; then
FAILURES=$((FAILURES + 1))
elif [[ $CLEAN_AGAIN -eq 1 ]]; then
test_run "$test" make -C "$test" clean-again
fi
done
fi

Expand Down
7 changes: 7 additions & 0 deletions test/test-functions
Original file line number Diff line number Diff line change
Expand Up @@ -3338,6 +3338,13 @@ test_cleanup_again() {
[ -n "$TESTDIR" ] || return
rm -rf "$TESTDIR/unprivileged-nspawn-root"
[[ -n "$initdir" ]] && _umount_dir "$initdir"
# Test specific images are not reused, so delete them or we run out of disk space
if [[ -n "$IMAGE_PUBLIC" ]] && [ "$(basename "$IMAGE_PUBLIC")" != "default.img" ]; then
rm -vf "$IMAGE_PUBLIC"
fi
if [[ -n "$IMAGE_PRIVATE" ]] && [ "$(basename "$IMAGE_PRIVATE")" != "default.img" ]; then
rm -vf "$IMAGE_PRIVATE"
fi
}

test_create_image() {
Expand Down

0 comments on commit 9773f58

Please sign in to comment.