summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMagnus Sandin <magnus.sandin@valitron.se>2023-01-30 14:32:53 +0100
committerMagnus Sandin <magnus.sandin@valitron.se>2023-01-30 19:24:39 +0100
commitb527b1b2eea9a9ed11a11dcb8c50fb0a28d36120 (patch)
tree87e09ded9c38df4c2be0f7429337ad14958c0dff /tests
parent3c563344e98c9ac187d56d2600de0a37b3967373 (diff)
downloadalpine-conf-b527b1b2eea9a9ed11a11dcb8c50fb0a28d36120.zip
setup-disk: Add support for booting zfs (in grub)
Diffstat (limited to 'tests')
-rwxr-xr-xtests/bin/zpool18
-rwxr-xr-xtests/setup_disk_test25
2 files changed, 42 insertions, 1 deletions
diff --git a/tests/bin/zpool b/tests/bin/zpool
new file mode 100755
index 0000000..be65e56
--- /dev/null
+++ b/tests/bin/zpool
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+
+case "$1" in
+ list)
+ cat << EOF
+NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
+bpool 2.75G 54.4M 2.70G - - 0% 1% 1.00x ONLINE -
+ nvme0n1p2 3G 54.4M 2.70G - - 0% 1.93% - ONLINE
+rpool 3.62T 419M 3.62T - - 0% 0% 1.00x ONLINE -
+ nvme0n1p3 3.64T 419M 3.62T - - 0% 0.01% - ONLINE
+EOF
+ ;;
+ *)
+ echo "usage: zpool command args ..." >&2
+ ;;
+esac
+
diff --git a/tests/setup_disk_test b/tests/setup_disk_test
index 7418c89..028d28e 100755
--- a/tests/setup_disk_test
+++ b/tests/setup_disk_test
@@ -13,7 +13,8 @@ init_tests \
setup_disk_non_existing_block_dev \
setup_disk_install_mounted_root_nvme \
setup_disk_install_mounted_root_efi_boot \
- setup_disk_install_mounted_root_bootloader_none
+ setup_disk_install_mounted_root_bootloader_none \
+ setup_disk_install_mounted_root_zfs
setup_disk_usage_body() {
test_usage setup-disk
@@ -302,3 +303,25 @@ setup_disk_install_mounted_root_bootloader_none_body() {
atf_fail "etc/default/grub should not exist"
fi
}
+
+setup_disk_install_mounted_root_zfs_body() {
+ init_env
+ mkdir -p target/boot \
+ sys/firmware/efi
+
+ fake_mount "rpool/root-a $PWD/target zfs rw,noatime,data=ordered 0 0"
+
+ atf_check -s exit:0 \
+ -o match:"grub" \
+ -e not-match:"zfs is not supported" \
+ setup-disk -v target
+ atf_check \
+ -o match:"GRUB_CMDLINE_LINUX_DEFAULT=.*zfs" \
+ -o match:"GRUB_FS=zfs" \
+ cat target/etc/default/grub
+ atf_check \
+ -o match:'features=.*nvme' \
+ -o match:'features=.*zfs' \
+ cat target/etc/mkinitfs/mkinitfs.conf
+}
+