diff --git a/pkgs/development/interpreters/bats/default.nix b/pkgs/development/interpreters/bats/default.nix index da12e7a3e65..03984f9779f 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