test: delete /swapfile after swapoff
authorLuca Boccassi <luca.boccassi@gmail.com>
Tue, 5 Nov 2024 18:15:36 +0000 (18:15 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 5 Nov 2024 20:02:57 +0000 (05:02 +0900)
[   23.608342] TEST-55-OOMD.sh[689]: + btrfs filesystem mkswapfile -s 64M /swapfile
[   23.651930] TEST-55-OOMD.sh[704]: ERROR: cannot create new swapfile: File exists

test/units/TEST-55-OOMD.sh

index 644a8fcf471cf7a1ef89ac1676a9a8f8cdb6d5c9..3c9b4391a963e7d58872b1608c91ebc44098ed77 100755 (executable)
@@ -24,6 +24,7 @@ fi
 # Activate swap file if we are in a VM
 if systemd-detect-virt --vm --quiet; then
     swapoff --all
+    rm -f /swapfile
     if [[ "$(findmnt -n -o FSTYPE /)" == btrfs ]]; then
         btrfs filesystem mkswapfile -s 64M /swapfile
     else