about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authornikstur <nikstur@outlook.com>2023-07-04 17:09:00 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2023-07-10 22:02:36 +0200
commit0f9bf615a485302b55e23cec66913e2ee11b8725 (patch)
tree3afecea810a975b7d909b316bde8a0664f29c164 /nixos
parent3b6bc9b536dd09c91de596b3028fe6a468372865 (diff)
downloadnixlib-0f9bf615a485302b55e23cec66913e2ee11b8725.tar
nixlib-0f9bf615a485302b55e23cec66913e2ee11b8725.tar.gz
nixlib-0f9bf615a485302b55e23cec66913e2ee11b8725.tar.bz2
nixlib-0f9bf615a485302b55e23cec66913e2ee11b8725.tar.lz
nixlib-0f9bf615a485302b55e23cec66913e2ee11b8725.tar.xz
nixlib-0f9bf615a485302b55e23cec66913e2ee11b8725.tar.zst
nixlib-0f9bf615a485302b55e23cec66913e2ee11b8725.zip
nixos/tests: add squashfs test
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/non-default-filesystems.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/nixos/tests/non-default-filesystems.nix b/nixos/tests/non-default-filesystems.nix
index 6233e8d265d0..1b19524be1b6 100644
--- a/nixos/tests/non-default-filesystems.nix
+++ b/nixos/tests/non-default-filesystems.nix
@@ -128,4 +128,43 @@ with pkgs.lib;
         assert "erofs" in file_contents
       '';
     };
+
+  squashfs =
+    let
+      fsImage = "/tmp/non-default-filesystem.img";
+    in
+    makeTest {
+      name = "non-default-filesystems-squashfs";
+
+      meta.maintainers = with maintainers; [ nikstur ];
+
+      nodes.machine = {
+        virtualisation.qemu.drives = [{
+          name = "non-default-filesystem";
+          file = fsImage;
+          deviceExtraOpts.serial = "non-default";
+        }];
+
+        virtualisation.fileSystems."/non-default" = {
+          device = "/dev/disk/by-id/virtio-non-default";
+          fsType = "squashfs";
+          neededForBoot = true;
+        };
+      };
+
+      testScript = ''
+        import subprocess
+
+        with open("filesystem", "w") as f:
+          f.write("squashfs")
+
+        subprocess.run([
+          "${pkgs.squashfsTools}/bin/mksquashfs",
+          "filesystem",
+          "${fsImage}",
+        ])
+
+        assert "squashfs" in machine.succeed("cat /non-default/filesystem")
+      '';
+    };
 }