tests: only backup ~/.config/nixpkgs

Other files/directories are not modified by the general test setup.
This commit is contained in:
Tobias Happ 2021-12-12 17:16:38 +01:00
parent e687e46e2f
commit 0c2f293502

View file

@ -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