From 43b94dee092a0e62d9336cab834cbe17f6f77545 Mon Sep 17 00:00:00 2001 From: Tobias Happ Date: Sun, 12 Dec 2021 17:16:38 +0100 Subject: [PATCH] tests: only backup ~/.config/nixpkgs Other files/directories are not modified by the general test setup. --- tests/on-device/.run.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/on-device/.run.sh b/tests/on-device/.run.sh index f4ff032..9081e48 100755 --- a/tests/on-device/.run.sh +++ b/tests/on-device/.run.sh @@ -28,12 +28,19 @@ if [[ ! -e "$DEFAULT_ACTIVATE_SCRIPT" ]]; then ln -sn "$(readlink -f "$PROFILE_DIRECTORY/activate")" "$DEFAULT_ACTIVATE_SCRIPT" fi -if [[ ! -d ~/.config.bak ]]; then - mv ~/.config ~/.config.bak - cp -r ~/.config.bak ~/.config +_cleanup() { + rm -rf ~/.config/nixpkgs + mv ~/.config/nixpkgs.bak ~/.config/nixpkgs +} + +trap _cleanup SIGINT SIGTERM SIGKILL + +if [[ ! -d ~/.config/nixpkgs.bak ]]; then + mv ~/.config/nixpkgs ~/.config/nixpkgs.bak fi +mkdir -p ~/.config/nixpkgs + bats "${SCRIPT_DIR}" --verbose-run --timing --pretty -rm -rf ~/.config -mv ~/.config.bak ~/.config +_cleanup