about summary refs log tree commit diff
path: root/pkgs/development/interpreters/bats
diff options
context:
space:
mode:
authorTravis A. Everett <travis.a.everett@gmail.com>2022-04-23 15:41:43 -0500
committerTravis A. Everett <travis.a.everett@gmail.com>2022-04-23 16:02:19 -0500
commit749b97bb2345395e4f7d947c71ac603dbce01d72 (patch)
tree1524222c8737911f6d656213abf0fa22b6cc593e /pkgs/development/interpreters/bats
parent28916313007aa31621c14dafc470368a5da217eb (diff)
bats: improve package w/ new resholve features
The resholve 0.8.0 release includes better support for intra-package
references, making it possible to also resholve files in lib/libexec.

This process helped shake loose 5 more unnoticed package dependencies,
and enable bats' parallel execution support.
Diffstat (limited to 'pkgs/development/interpreters/bats')
-rw-r--r--pkgs/development/interpreters/bats/default.nix70
1 files changed, 66 insertions, 4 deletions
diff --git a/pkgs/development/interpreters/bats/default.nix b/pkgs/development/interpreters/bats/default.nix
index da12e7a3e65f4..03984f9779fe1 100644
--- a/pkgs/development/interpreters/bats/default.nix
+++ b/pkgs/development/interpreters/bats/default.nix
@@ -6,6 +6,12 @@
 , coreutils
 , gnugrep
 , ncurses
+, findutils
+, hostname
+, parallel
+, flock
+, ps
+, bats
 , lsof
 , doInstallCheck ? true
 }:
@@ -31,23 +37,79 @@ resholve.mkDerivation rec {
 
   solutions = {
     bats = {
-      scripts = [ "bin/bats" ];
+      scripts = [
+        "bin/bats"
+        "libexec/bats-core/*"
+        "lib/bats-core/*"
+      ];
       interpreter = "${bash}/bin/bash";
-      inputs = [ bash coreutils gnugrep ];
+      inputs = [
+        bash
+        coreutils
+        gnugrep
+        ncurses
+        findutils
+        hostname
+        parallel
+        flock
+        "lib/bats-core"
+        "libexec/bats-core"
+      ];
       fake = {
-        external = [ "greadlink" ];
+        external = [
+          "greadlink"
+          "shlock"
+        ];
       };
       fix = {
         "$BATS_ROOT" = [ "${placeholder "out"}" ];
+        "$BATS_LIBEXEC" = [ "${placeholder "out"}/libexec/bats-core" ];
       };
       keep = {
         "${placeholder "out"}/libexec/bats-core/bats" = true;
+        source = [
+          "${placeholder "out"}/lib/bats-core/validator.bash"
+          "${placeholder "out"}/lib/bats-core/preprocessing.bash"
+          "$BATS_TEST_SOURCE"
+          "${placeholder "out"}/lib/bats-core/tracing.bash"
+          "${placeholder "out"}/lib/bats-core/test_functions.bash"
+          "$library_load_path"
+          "${placeholder "out"}/lib/bats-core/common.bash"
+          "${placeholder "out"}/lib/bats-core/semaphore.bash"
+          "${placeholder "out"}/lib/bats-core/formatter.bash"
+        ];
+        "$report_formatter" = true;
+        "$formatter" = true;
+        "$pre_command" = true;
+        "$BATS_TEST_NAME" = true;
+        "${placeholder "out"}/libexec/bats-core/bats-exec-test" = true;
       };
+      execer = [
+        /*
+        both blatant lies for expedience; these can certainly exec args
+        they may be safe here, because they may always run things that
+        are ultimately in libexec?
+        TODO: handle parallel and flock in binlore/resholve
+        */
+        "cannot:${parallel}/bin/parallel"
+        "cannot:${flock}/bin/flock"
+
+        "cannot:libexec/bats-core/bats-preprocess"
+
+        # these do exec, but other internal files
+        "cannot:libexec/bats-core/bats-exec-file"
+        "cannot:libexec/bats-core/bats-exec-suite"
+      ];
     };
   };
 
   inherit doInstallCheck;
-  installCheckInputs = [ ncurses ] ++ lib.optionals stdenv.isDarwin [ lsof ];
+  installCheckInputs = [
+    ncurses
+    parallel # skips some tests if it can't detect
+    flock # skips some tests if it can't detect
+    ps
+  ] ++ lib.optionals stdenv.isDarwin [ lsof ];
   installCheckPhase = ''
     # TODO: cut if https://github.com/bats-core/bats-core/issues/418 allows
     sed -i '/test works even if PATH is reset/a skip' test/bats.bats