mirror of
https://github.com/systemd/systemd.git
synced 2024-12-02 23:03:50 +08:00
test: use btrfs' mkswapfile on btrfs
So it's created automagically with proper attributes.
This commit is contained in:
parent
e073c1d8ed
commit
1b0cf03668
@ -15,9 +15,7 @@ test_append_files() {
|
||||
# Create a swap file
|
||||
(
|
||||
image_install mkswap swapon swapoff stress
|
||||
|
||||
dd if=/dev/zero of="${initdir:?}/swapfile" bs=1M count=48
|
||||
chmod 0600 "${initdir:?}/swapfile"
|
||||
image_install -o btrfs
|
||||
|
||||
mkdir -p "${initdir:?}/etc/systemd/system/init.scope.d/"
|
||||
cat >>"${initdir:?}/etc/systemd/system/init.scope.d/test-55-oomd.conf" <<EOF
|
||||
|
@ -23,7 +23,14 @@ rm -rf /run/systemd/system/testsuite-55-testbloat.service.d
|
||||
|
||||
# Activate swap file if we are in a VM
|
||||
if systemd-detect-virt --vm --quiet; then
|
||||
mkswap /swapfile
|
||||
if [[ "$(findmnt -n -o FSTYPE /)" == btrfs ]]; then
|
||||
btrfs filesystem mkswapfile -s 64M /swapfile
|
||||
else
|
||||
dd if=/dev/zero of=/swapfile bs=1M count=64
|
||||
chmod 0600 /swapfile
|
||||
mkswap /swapfile
|
||||
fi
|
||||
|
||||
swapon /swapfile
|
||||
swapon --show
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user