]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: disable CoW for swapfile on btrfs
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 14 Feb 2024 10:48:56 +0000 (11:48 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 14 Feb 2024 10:48:56 +0000 (11:48 +0100)
test/TEST-55-OOMD/test.sh

index 64e2360b081a677e2426077f26564e29acb8ad05..ecb04106b190c87b7f48feb4c8275430aef3c324 100755 (executable)
@@ -16,6 +16,11 @@ test_append_files() {
     (
         image_install mkswap swapon swapoff stress
 
+        if [[ "$FSTYPE" == btrfs ]]; then
+            # swapfile must not have CoW set, but the flag can be set/unset only on new or empty files
+            touch "${initdir:?}/swapfile"
+            chattr +C "${initdir:?}/swapfile"
+        fi
         dd if=/dev/zero of="${initdir:?}/swapfile" bs=1M count=48
         chmod 0600 "${initdir:?}/swapfile"