tests: Move example tests to dedicated folder

This commit is contained in:
Felix Uhl committed 2024-10-31 17:03:52 +01:00
1 parent 389235b63f
commit 737e045f53
40 files changed
+58 -43

No files matched your search

+19 -8
View File
@@ -4,17 +4,28 @@
}:
let
lib = pkgs.lib;
fs = lib.fileset;
diskoLib = import ../src/disko_lib { inherit lib makeTest eval-config; };
allTestFilenames =
builtins.map (lib.removeSuffix ".nix") (
builtins.filter
(x: lib.hasSuffix ".nix" x && x != "default.nix")
(lib.attrNames (builtins.readDir ./.))
);
incompatibleTests = lib.optionals pkgs.buildPlatform.isRiscV64 [ "zfs" "zfs-over-legacy" "cli" "module" "complex" ];
allCompatibleFilenames = lib.subtractLists incompatibleTests allTestFilenames;
allTests = lib.genAttrs allCompatibleFilenames (test: import (./. + "/${test}.nix") { inherit diskoLib pkgs; });
allTestFilenames =
(fs.toList
(fs.difference
(fs.fileFilter
({ name, hasExt, ... }:
hasExt "nix"
&& name != "default.nix"
&& !(lib.elem (lib.removeSuffix ".nix" name) incompatibleTests))
./.)
(fs.fileFilter ({ ... }: true) ./disko-install))
);
allTests = lib.listToAttrs (lib.map
(test: {
name = lib.removeSuffix ".nix" (builtins.baseNameOf test);
value = import test { inherit diskoLib pkgs; };
})
allTestFilenames);
in
allTests