nix: properly throw away tix files for postgrest-watch, resolves #1807

This commit is contained in:
Wolfgang Walther
2021-04-12 19:03:16 +02:00
committed by Wolfgang Walther
parent fc791a6320
commit 67ca814d0b
4 changed files with 10 additions and 9 deletions
+1
View File
@@ -23,6 +23,7 @@ let
postgrest-watch postgrest-test-io
'';
redirectTixFiles = false; # will be done by sub-command
inRootDir = true;
}
''
@@ -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)"
+1
View File
@@ -174,6 +174,7 @@ let
inherit name;
docs = "Run spec and io tests while collecting hpc coverage data.";
inRootDir = true;
redirectTixFiles = false;
withTmpDir = true;
}
''
+1
View File
@@ -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