test: delete /swapfile after swapoff
authorLuca Boccassi <luca.boccassi@gmail.com>
Tue, 5 Nov 2024 18:15:36 +0000 (18:15 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 13 Nov 2024 19:48:10 +0000 (19:48 +0000)
[   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

(cherry picked from commit 78b032d727e8f9e925c10c6617a1e409307ffc24)

test/units/TEST-55-OOMD.sh

index 92780165e24a906eaeac6f5750c6b1f458737a69..f48c2156f76ff6b0272f012d6c7e66ce6a37033b 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