diff --git a/nix/devtools.nix b/nix/devtools.nix index 2dc43e22b..9b1e820c8 100644 --- a/nix/devtools.nix +++ b/nix/devtools.nix @@ -23,6 +23,7 @@ let postgrest-watch postgrest-test-io ''; + redirectTixFiles = false; # will be done by sub-command inRootDir = true; } '' diff --git a/nix/overlays/checked-shell-script/checked-shell-script.nix b/nix/overlays/checked-shell-script/checked-shell-script.nix index a7fa8c95d..907555983 100644 --- a/nix/overlays/checked-shell-script/checked-shell-script.nix +++ b/nix/overlays/checked-shell-script/checked-shell-script.nix @@ -9,7 +9,7 @@ , stdenv , writeTextFile }: -{ name, docs, inRootDir ? false, withTmpDir ? false }: text: +{ name, docs, inRootDir ? false, redirectTixFiles ? true, withTmpDir ? false }: text: # TODO: do something sensible with docs, e.g. provide automated --help let bin = @@ -22,14 +22,12 @@ let '' #!${runtimeShell} set -euo pipefail - - # make sure that no script creates conflicting tix files - # postgrest-coverage will override HPCTIXFILE to make proper use of it - if test ! -v HPCTIXFILE; then - hpctixdir=$(mktemp -d) - export HPCTIXFILE="$hpctixdir"/postgrest.tix - trap 'rm -rf $hpctixdir' EXIT - fi + '' + + lib.optionalString redirectTixFiles '' + # storing tix files in a temporary throw away directory avoids mix/tix conflicts after changes + hpctixdir=$(mktemp -d) + export HPCTIXFILE="$hpctixdir"/postgrest.tix + trap 'rm -rf $hpctixdir' EXIT '' + lib.optionalString inRootDir '' cd "$(${git}/bin/git rev-parse --show-toplevel)" diff --git a/nix/tests.nix b/nix/tests.nix index 2334bc069..87966ee4d 100644 --- a/nix/tests.nix +++ b/nix/tests.nix @@ -174,6 +174,7 @@ let inherit name; docs = "Run spec and io tests while collecting hpc coverage data."; inRootDir = true; + redirectTixFiles = false; withTmpDir = true; } '' diff --git a/nix/withtmpdb.nix b/nix/withtmpdb.nix index 7d5363e64..8964bb935 100644 --- a/nix/withtmpdb.nix +++ b/nix/withtmpdb.nix @@ -7,6 +7,7 @@ checkedShellScript name = "postgrest-test-withtmpdb-${postgresql.name}"; docs = "Run the given command in a temporary database"; inRootDir = true; + redirectTixFiles = false; } '' # avoid starting multiple layers of with_tmp_db