Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions tests/ffi/common/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,33 @@ prepare_test() {

disk_cleanup() {
# Clean large size files created by tests inside qm part
remove_file=$(find /var/qm -size +2G)
exec_cmd "rm -rf $remove_file"
remove_file=$(find /var/qm -size +2G)
if [ -n "${remove_file}" ]; then
exec_cmd "rm -rf ${remove_file}"
fi
Comment thread
pengshanyu marked this conversation as resolved.
# Remove all containers in qm (don't care about stop in clean-up)
exec_cmd "podman exec -it qm /usr/bin/podman rm -af"
exec_cmd "podman exec qm /usr/bin/podman rm -af"
Comment thread
pengshanyu marked this conversation as resolved.
if test -d "${DROP_IN_DIR}"; then
exec_cmd "rm -rf ${DROP_IN_DIR}"
fi
exec_cmd "systemctl daemon-reload"
exec_cmd "systemctl restart qm"
# Clean large size files created by tests inside host part
remove_file=$(find /root -size +1G)
exec_cmd "rm -f $remove_file"
remove_file=$(find /root -size +1G)
if [ -n "${remove_file}" ]; then
exec_cmd "rm -f ${remove_file}"
fi
Comment thread
pengshanyu marked this conversation as resolved.
}

# Remove all containers in host, then disk_cleanup.
# e.g. trap 'cleanup_host_then_qm ffi-asil' EXIT
cleanup_host_then_qm() {
local container_name
for container_name in "$@"; do
[ -n "${container_name}" ] || continue
podman rm -f "${container_name}" >/dev/null 2>&1 || true
done
disk_cleanup
}

reload_config() {
Expand Down
4 changes: 3 additions & 1 deletion tests/ffi/memory/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

. ../common/prepare.sh

trap disk_cleanup EXIT
# Remove ffi-asil to free host RAM, then do disk_cleanup
trap 'cleanup_host_then_qm ffi-asil' EXIT

prepare_test

exec_cmd "podman run -d --rm --replace -d --name ffi-asil \
Expand Down
Loading