diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-10-05 12:12:18 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-12-01 12:06:43 -0500 |
commit | 30dcc19d1f30fc203be460134c4578509cce704f (patch) | |
tree | 6cc32609b9984a2c4d5ecc0cac5cf30609e208b9 /tests/install-darwin.sh | |
parent | 72425212657d795dc215b334b7c8c8cd36d06b72 (diff) |
Put functional tests in `tests/functional`
I think it is bad for these reasons when `tests/` contains a mix of
functional and integration tests
- Concepts is harder to understand, the documentation makes a good
unit vs functional vs integration distinction, but when the
integration tests are just two subdirs within `tests/` this is not
clear.
- Source filtering in the `flake.nix` is more complex. We need to
filter out some of the dirs from `tests/`, rather than simply pick
the dirs we want and take all of them. This is a good sign the
structure of what we are trying to do is not matching the structure
of the files.
With this change we have a clean:
```shell-session
$ git show 'HEAD:tests'
tree HEAD:tests
functional/
installer/
nixos/
```
(cherry picked from commit 68c81c737571794f7246db53fb4774e94fcf4b7e)
Diffstat (limited to 'tests/install-darwin.sh')
-rwxr-xr-x | tests/install-darwin.sh | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/tests/install-darwin.sh b/tests/install-darwin.sh deleted file mode 100755 index ea2b75323..000000000 --- a/tests/install-darwin.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh - -set -eux - -cleanup() { - PLIST="/Library/LaunchDaemons/org.nixos.nix-daemon.plist" - if sudo launchctl list | grepQuiet nix-daemon; then - sudo launchctl unload "$PLIST" - fi - - if [ -f "$PLIST" ]; then - sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist - fi - - profiles=(/etc/profile /etc/bashrc /etc/zshrc) - for profile in "${profiles[@]}"; do - if [ -f "${profile}.backup-before-nix" ]; then - sudo mv "${profile}.backup-before-nix" "${profile}" - fi - done - - for file in ~/.bash_profile ~/.bash_login ~/.profile ~/.zshenv ~/.zprofile ~/.zshrc ~/.zlogin; do - if [ -e "$file" ]; then - cat "$file" | grep -v nix-profile > "$file.next" - mv "$file.next" "$file" - fi - done - - for i in $(seq 1 $(sysctl -n hw.ncpu)); do - sudo /usr/bin/dscl . -delete "/Users/nixbld$i" || true - done - sudo /usr/bin/dscl . -delete "/Groups/nixbld" || true - - sudo rm -rf /etc/nix \ - /nix \ - /var/root/.nix-profile /var/root/.nix-defexpr /var/root/.nix-channels \ - "$HOME/.nix-profile" "$HOME/.nix-defexpr" "$HOME/.nix-channels" -} - -verify() { - set +e - output=$(echo "nix-shell -p bash --run 'echo toow | rev'" | bash -l) - set -e - - test "$output" = "woot" -} - -scratch=$(mktemp -d -t tmp.XXXXXXXXXX) -function finish { - rm -rf "$scratch" -} -trap finish EXIT - -# First setup Nix -cleanup -curl -L -o install https://nixos.org/nix/install -yes | bash ./install -verify - - -( - set +e - ( - echo "cd $(pwd)" - echo nix-build ./release.nix -A binaryTarball.x86_64-darwin - ) | bash -l - set -e - cp ./result/nix-*.tar.bz2 $scratch/nix.tar.bz2 -) - -( - cd $scratch - tar -xf ./nix.tar.bz2 - - cd nix-* - - set -eux - - cleanup - - yes | ./install - verify - cleanup - - echo -n "" | ./install - verify - cleanup - - sudo mkdir -p /nix/store - sudo touch /nix/store/.silly-hint - echo -n "" | ALLOW_PREEXISTING_INSTALLATION=true ./install - verify - test -e /nix/store/.silly-hint - - cleanup -) |