diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-11-23 10:24:56 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-11-23 10:25:15 +0100 |
commit | 55b3baa54a9b5253a3de90f1917808582cd5fa94 (patch) | |
tree | 132b997514bfb50668c92d3e5d72f45e01dfee27 /tests/infrastructure/run.nix | |
parent | build(flake): Update (diff) | |
download | nixos-config-55b3baa54a9b5253a3de90f1917808582cd5fa94.tar.gz nixos-config-55b3baa54a9b5253a3de90f1917808582cd5fa94.zip |
tests(tests): Initialize infrastructure and documentation for it
Diffstat (limited to '')
-rw-r--r-- | tests/infrastructure/run.nix | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/infrastructure/run.nix b/tests/infrastructure/run.nix new file mode 100644 index 00000000..91120ef4 --- /dev/null +++ b/tests/infrastructure/run.nix @@ -0,0 +1,34 @@ +{ + pkgs, + lib, +}: +pkgs.writeShellScript "run_test_description" '' + set -e + + [ "$#" -ne 1 ] && { + echo "Usage: $0 <Test description file>"; + exit 2 + } + description="$1" + + __TEST_TMUX="${lib.getExe pkgs.tmux}" + __TEST_TMUX_PANE="__TEST_TMUX_PANE" + __TEST_AWK_CLEAN_FILE="${./clean.awk}" + + . ${./driver.sh} + + echo "Setting up a session.." + if "$__TEST_TMUX" has-session -t "$__TEST_TMUX_PANE"; then + echo "Killing old '$__TEST_TMUX_PANE'" + "$__TEST_TMUX" kill-session -t "$__TEST_TMUX_PANE" + fi + "$__TEST_TMUX" new-session -d -s "$__TEST_TMUX_PANE" + + echo "Initializing pipe.." + "$__TEST_TMUX" pipe-pane -t "$__TEST_TMUX_PANE" -o 'cat >>./test.golden' + + echo "Evaluating description.." + __test_eval "$description" + + "$__TEST_TMUX" pipe-pane -t "$__TEST_TMUX_PANE" +'' |