Skip to content

Commit

Permalink
Make init.sh safe to run twice
Browse files Browse the repository at this point in the history
`init.sh` is tested on its own. We used to do that. I deleted it in
4720853 but I am not sure why. Better
to just restore it; at one point working on this every other test
passed, so seems good to check whether `init.sh` can be run twice.

We don't *need* to run `init.sh` twice, but I want to try to make our
tests as robust as possible so that manual debugging (where tests for
better or worse might be run ways that we didn't expect) is less
fragile.
  • Loading branch information
Ericson2314 committed Feb 23, 2023
1 parent 4a921ba commit 5dbbf23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/init.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
set -e -o pipefail

source common.sh

test -n "$TEST_ROOT"
if test -d "$TEST_ROOT"; then
chmod -R u+w "$TEST_ROOT"
# We would delete any daemon socket, so let's stop the daemon first.
if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
killDaemon
fi
rm -rf "$TEST_ROOT"
fi
mkdir "$TEST_ROOT"
Expand Down
1 change: 1 addition & 0 deletions tests/local.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
nix_tests = \
init.sh \
flakes/flakes.sh \
flakes/run.sh \
flakes/mercurial.sh \
Expand Down

0 comments on commit 5dbbf23

Please sign in to comment.