mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
tests: restore the initial generation before each test
When developing it can happen to break the nix-on-droid script. If so, this fix will ensure that each test has a working nix-on-droid script available.
This commit is contained in:
parent
9477418fe6
commit
726f74d9ec
2 changed files with 10 additions and 0 deletions
|
|
@ -6,8 +6,11 @@
|
|||
set -ueo pipefail
|
||||
|
||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||
PROFILE_DIRECTORY="/nix/var/nix/profiles/nix-on-droid"
|
||||
|
||||
SELF_TEST_DIR="$HOME/.cache/nix-on-droid-self-test"
|
||||
CONFIRMATION_FILE="$SELF_TEST_DIR/confirmation-granted"
|
||||
DEFAULT_ACTIVATE_SCRIPT="$SELF_TEST_DIR/default-activate"
|
||||
mkdir -p "$SELF_TEST_DIR"
|
||||
|
||||
if [[ ! -e "$CONFIRMATION_FILE" ]]; then
|
||||
|
|
@ -21,6 +24,10 @@ if [[ ! -e "$CONFIRMATION_FILE" ]]; then
|
|||
touch "$CONFIRMATION_FILE"
|
||||
fi
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ setup() {
|
|||
|
||||
ON_DEVICE_TESTS_SETUP=1
|
||||
fi
|
||||
|
||||
# restore to pre-testing generation before the start of each test
|
||||
$DEFAULT_ACTIVATE_SCRIPT
|
||||
}
|
||||
|
||||
assert_command() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue