Commit 99885ce0 authored by Connor Baker's avatar Connor Baker
Browse files

cudaPackages.tensorrt-samples.passthru: tidy expression and expose mkTester

parent 9d42b468
Loading
Loading
Loading
Loading
+30 −30
Original line number Diff line number Diff line
@@ -30,12 +30,6 @@ in
        }
    );

  # TODO(@connorbaker): A number of the tests fail with 10.2:
  # API Usage Error (Unable to load library: libnvinfer_builder_resource_win.so.10.2.0:
  # libnvinfer_builder_resource_win.so.10.2.0: cannot open shared object file: No such file or directory)
  # TODO(@connorbaker): Add tests for trtexec.
  testers =
    let
  mkTester =
    name: cmdArgs:
    writeShellApplication {
@@ -47,23 +41,29 @@ in
        "''${cmdArgs[@]}"
      '';
    };
    in
    lib.packagesFromDirectoryRecursive {
      callPackage =
        path: _:
        import path {
          inherit (finalAttrs.passthru) sample-data;

  # TODO(@connorbaker): Add tests for trtexec.
  testers =
    let
      mkTesters = lib.flip import {
        inherit (finalAttrs.passthru) mkTester sample-data;
        inherit
          atLeast
          backendStdenv
          finalAttrs
          lib
            mkTester
          older
          ;
      };
    in
    # Filter out sets of testers which are completely empty (not available on this architecture, this version, etc.).
    lib.filterAttrs (_: attrs: attrs != { }) (
      # Construct all the testers from the filesystem.
      lib.packagesFromDirectoryRecursive {
        callPackage = path: _: mkTesters path;
        directory = ./testers;
    };
      }
    );

  # Wrap each of the derivations in testers in a runCommand.
  tests = lib.mapAttrsRecursiveCond (as: !(lib.isDerivation as)) (