From: Scott Worley Date: Fri, 21 Jul 2023 08:09:58 +0000 (-0700) Subject: Reduce repetition in test script X-Git-Url: http://git.scottworley.com/nixos-qemu-vm-isolation/commitdiff_plain/620470ea7a1d5723b01005c0d822f6033aa2fa81?ds=sidebyside Reduce repetition in test script --- diff --git a/checks/mount-grep.nix b/checks/mount-grep.nix index 33478ea..f7eb3a3 100644 --- a/checks/mount-grep.nix +++ b/checks/mount-grep.nix @@ -18,16 +18,14 @@ pkgs: { testScript = '' start_all() - shared.wait_for_unit("multi-user.target") - private.wait_for_unit("multi-user.target") - useNixStoreImage.wait_for_unit("multi-user.target") + for machine in [shared, private, useNixStoreImage]: + machine.wait_for_unit("multi-user.target") shared.succeed("[[ $(mount | grep -c virt) -gt 0 ]]") - private.succeed("[[ $(mount | grep -c virt) -eq 0 ]]") - useNixStoreImage.succeed("[[ $(mount | grep -c virt) -eq 0 ]]") - shared.succeed("[[ -e ${pkgs.pv} ]]") - private.fail("[[ -e ${pkgs.pv} ]]") - useNixStoreImage.fail("[[ -e ${pkgs.pv} ]]") + + for machine in [private, useNixStoreImage]: + machine.succeed("[[ $(mount | grep -c virt) -eq 0 ]]") + machine.fail("[[ -e ${pkgs.pv} ]]") ''; }