diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-11-30 23:09:01 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-11-30 23:09:01 +0100 |
commit | fd9250e6a20f244bae99d29f7f051c8bde0a69bd (patch) | |
tree | 863823f8a2f6ed3b68ef38867e526cc298183b65 /tests/infrastructure | |
parent | tests(infrastructure/driver): Support executing commands (diff) | |
download | nixos-config-fd9250e6a20f244bae99d29f7f051c8bde0a69bd.tar.gz nixos-config-fd9250e6a20f244bae99d29f7f051c8bde0a69bd.zip |
tests(infrastructure/run.nix): Bring up-to-date with the `default.nix`
Diffstat (limited to '')
-rw-r--r-- | tests/infrastructure/run.nix | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/infrastructure/run.nix b/tests/infrastructure/run.nix index 91120ef4..5bab3dc4 100644 --- a/tests/infrastructure/run.nix +++ b/tests/infrastructure/run.nix @@ -2,24 +2,33 @@ pkgs, lib, }: -pkgs.writeShellScript "run_test_description" '' - set -e +pkgs.writeShellScriptBin "run_test_description" '' + set -eu [ "$#" -ne 1 ] && { echo "Usage: $0 <Test description file>"; exit 2 } - description="$1" + description="$(realpath "$1")" + + base="$(mktemp -d)" + cd "$base" __TEST_TMUX="${lib.getExe pkgs.tmux}" + __TEST_SHELL="${lib.getExe pkgs.dash}" __TEST_TMUX_PANE="__TEST_TMUX_PANE" - __TEST_AWK_CLEAN_FILE="${./clean.awk}" + + __TEST_EVAL_USE_ALTERNATE_SCREEN="false" + __TEST_EVAL_AWK_CLEAN_FILE="${./clean.awk}" + __TEST_EVAL_LOG_FILE="__test_log" + __TEST_EVAL_GOLDEN_FILE="$(mktemp)" + printf "%s" "__test_golden" >"$__TEST_EVAL_GOLDEN_FILE" . ${./driver.sh} echo "Setting up a session.." if "$__TEST_TMUX" has-session -t "$__TEST_TMUX_PANE"; then - echo "Killing old '$__TEST_TMUX_PANE'" + echo "Killing old '$__TEST_TMUX_PANE' session." "$__TEST_TMUX" kill-session -t "$__TEST_TMUX_PANE" fi "$__TEST_TMUX" new-session -d -s "$__TEST_TMUX_PANE" @@ -31,4 +40,6 @@ pkgs.writeShellScript "run_test_description" '' __test_eval "$description" "$__TEST_TMUX" pipe-pane -t "$__TEST_TMUX_PANE" + + echo "Base dir: $base" '' |