summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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
+}
+