@@ -13,7 +13,25 @@ let
1313
1414 forAllSystems = genAttrs supportedSystems;
1515
16− callTest = fn: args: forAllSystems (system: hydraJob (import fn ({ inherit system; } // args)));
16+ importTest = fn: args: system: import fn ({
17+ inherit system;
18+ } // args);
19+
20+ callTest = fn: args: forAllSystems (system: hydraJob (importTest fn args system));
21+
22+ callSubTests = fn: args: let
23+ discover = attrs: let
24+ subTests = filterAttrs (const (hasAttr "test")) attrs;
25+ in mapAttrs (const (t: hydraJob t.test)) subTests;
26+
27+ discoverForSystem = system: mapAttrs (_: test: {
28+ ${system} = test;
29+ }) (discover (importTest fn args system));
30+
31+ # If the test is only for a particular system, use only the specified
32+ # system instead of generating attributes for all available systems.
33+ in if args ? system then discover (import fn args)
34+ else foldAttrs (a: b: a // b) {} (map discoverForSystem supportedSystems);
1735
1836 pkgs = import nixpkgs { system = "x86_64-linux"; };
1937