From 5768f3afa2b36fcb12d5ec1aba3a3de6fb4c80ef Mon Sep 17 00:00:00 2001 From: Zach Dykstra Date: Tue, 1 Dec 2020 22:06:51 -0600 Subject: [PATCH] Record basic test script for space handling --- testing/validation/.gitignore | 3 + .../validation/out-of-space-error-handling.sh | 160 ++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 testing/validation/.gitignore create mode 100755 testing/validation/out-of-space-error-handling.sh diff --git a/testing/validation/.gitignore b/testing/validation/.gitignore new file mode 100644 index 0000000..b271604 --- /dev/null +++ b/testing/validation/.gitignore @@ -0,0 +1,3 @@ +*.yaml +*.yml +*.log diff --git a/testing/validation/out-of-space-error-handling.sh b/testing/validation/out-of-space-error-handling.sh new file mode 100755 index 0000000..54db06d --- /dev/null +++ b/testing/validation/out-of-space-error-handling.sh @@ -0,0 +1,160 @@ +#!/bin/bash +TMP="$( mktemp -d )" +# shellcheck disable=SC2064 +trap "sudo umount '${TMP}'" EXIT + +cp ../../etc/zfsbootmenu/config.yaml spaced.yaml +yq-go w -i spaced.yaml Global.ManageImages true +yq-go w -i spaced.yaml Global.BootMountPoint "${TMP}" +yq-go w -i spaced.yaml Components.ImageDir "${TMP}" +yq-go w -i spaced.yaml Components.Versions false +yq-go w -i spaced.yaml EFI.ImageDir "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=10M "${TMP}" +echo "" +echo "Unversioned component build, not enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=60M "${TMP}" +echo "" +echo "Unversioned component build, enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=60M "${TMP}" +echo "" +echo "Unversioned component build, with backup, not enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=120M "${TMP}" +echo "" +echo "Unversioned component build, with backup, enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +yq-go w -i spaced.yaml Components.Versions 2 +sudo mount tmpfs -t tmpfs -o size=10M "${TMP}" +echo "" +echo "Versioned component build, not enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=60M "${TMP}" +echo "" +echo "Versioned component build, enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=60M "${TMP}" +echo "" +echo "Versioned component build, twice, not enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=120M "${TMP}" +echo "" +echo "Versioned component build, twice, enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +yq-go w -i spaced.yaml Components.Enabled false +yq-go w -i spaced.yaml EFI.Enabled true + +sudo mount tmpfs -t tmpfs -o size=10M "${TMP}" +echo "" +echo "Unversioned UEFI build, not enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=60M "${TMP}" +echo "" +echo "Unversioned UEFI build, enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=60M "${TMP}" +echo "" +echo "Unversioned UEFI build, with backup, not enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=120M "${TMP}" +echo "" +echo "Unversioned UEFI build, with backup, enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +yq-go w -i spaced.yaml EFI.Versions 2 +sudo mount tmpfs -t tmpfs -o size=10M "${TMP}" +echo "" +echo "Versioned UEFI build, not enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=60M "${TMP}" +echo "" +echo "Versioned UEFI build, enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=60M "${TMP}" +echo "" +echo "Versioned UEFI build, twice, not enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}" + +sudo mount tmpfs -t tmpfs -o size=120M "${TMP}" +echo "" +echo "Versioned UEFI build, twice, enough space" +echo "" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +../../bin/generate-zbm -c spaced.yaml +ls -lah "${TMP}" +sudo umount "${TMP}"