diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2015-04-06 21:52:40 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2015-04-06 21:52:40 +0200 |
| commit | 57b8623754fdd10b2cc194db09772f60010928af (patch) | |
| tree | 273d4591f096d8ddf0f54feb5c23b104a8edd0db /tests/guix-package.sh | |
| parent | 250bc998ac9d456f70c675579020d7173f87f3c3 (diff) | |
tests: Move 'guix package' tests that require networking to a separate file.
* tests/guix-package.sh (shebang_not_too_long): Remove.
Move everything below "if [networking + shebang_not_too_long]" to...
* tests/guix-package-net.sh: ... here. New file.
* Makefile.am (SH_TESTS): Add it.
Diffstat (limited to 'tests/guix-package.sh')
| -rw-r--r-- | tests/guix-package.sh | 138 |
1 files changed, 6 insertions, 132 deletions
diff --git a/tests/guix-package.sh b/tests/guix-package.sh index a4c04255bad..6cfd50b5e5b 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh | |||
| @@ -28,14 +28,6 @@ readlink_base () | |||
| 28 | basename `readlink "$1"` | 28 | basename `readlink "$1"` |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | # Return true if a typical shebang in the store would not exceed Linux's | ||
| 32 | # default static limit. | ||
| 33 | shebang_not_too_long () | ||
| 34 | { | ||
| 35 | test `echo $NIX_STORE_DIR/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-bootstrap-binaries-0/bin/bash | wc -c` \ | ||
| 36 | -lt 128 | ||
| 37 | } | ||
| 38 | |||
| 39 | module_dir="t-guix-package-$$" | 31 | module_dir="t-guix-package-$$" |
| 40 | profile="t-profile-$$" | 32 | profile="t-profile-$$" |
| 41 | rm -f "$profile" | 33 | rm -f "$profile" |
| @@ -63,118 +55,12 @@ test -f "$profile/bin/guile" | |||
| 63 | guix package --search-paths -p "$profile" | 55 | guix package --search-paths -p "$profile" |
| 64 | test "`guix package --search-paths -p "$profile" | wc -l`" = 0 | 56 | test "`guix package --search-paths -p "$profile" | wc -l`" = 0 |
| 65 | 57 | ||
| 66 | # Check whether we have network access and an acceptable shebang length. | 58 | # Exit with 1 when a generation does not exist. |
| 67 | if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null \ | 59 | if guix package -p "$profile" --delete-generations=42; |
| 68 | && shebang_not_too_long | 60 | then false; else true; fi |
| 69 | then | 61 | |
| 70 | boot_make="(@@ (gnu packages commencement) gnu-make-boot0)" | 62 | # Exit with 0 when trying to delete the zeroth generation. |
| 71 | boot_make_drv="`guix build -e "$boot_make" | grep -v -e -debug`" | 63 | guix package -p "$profile" --delete-generations=0 |
| 72 | guix package --bootstrap -p "$profile" -i "$boot_make_drv" | ||
| 73 | test -L "$profile-2-link" | ||
| 74 | test -f "$profile/bin/make" && test -f "$profile/bin/guile" | ||
| 75 | |||
| 76 | |||
| 77 | # Check whether `--list-installed' works. | ||
| 78 | # XXX: Change the tests when `--install' properly extracts the package | ||
| 79 | # name and version string. | ||
| 80 | installed="`guix package -p "$profile" --list-installed | cut -f1 | xargs echo | sort`" | ||
| 81 | case "x$installed" in | ||
| 82 | "guile-bootstrap make-boot0") | ||
| 83 | true;; | ||
| 84 | "make-boot0 guile-bootstrap") | ||
| 85 | true;; | ||
| 86 | "*") | ||
| 87 | false;; | ||
| 88 | esac | ||
| 89 | |||
| 90 | test "`guix package -p "$profile" -I 'g.*e' | cut -f1`" = "guile-bootstrap" | ||
| 91 | |||
| 92 | # List generations. | ||
| 93 | test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \ | ||
| 94 | = " guile-bootstrap" | ||
| 95 | |||
| 96 | # Exit with 1 when a generation does not exist. | ||
| 97 | if guix package -p "$profile" --list-generations=42; | ||
| 98 | then false; else true; fi | ||
| 99 | if guix package -p "$profile" --switch-generation=99; | ||
| 100 | then false; else true; fi | ||
| 101 | |||
| 102 | # Remove a package. | ||
| 103 | guix package --bootstrap -p "$profile" -r "guile-bootstrap" | ||
| 104 | test -L "$profile-3-link" | ||
| 105 | test -f "$profile/bin/make" && ! test -f "$profile/bin/guile" | ||
| 106 | |||
| 107 | # Roll back. | ||
| 108 | guix package --roll-back -p "$profile" | ||
| 109 | test "`readlink_base "$profile"`" = "$profile-2-link" | ||
| 110 | test -x "$profile/bin/guile" && test -x "$profile/bin/make" | ||
| 111 | guix package --roll-back -p "$profile" | ||
| 112 | test "`readlink_base "$profile"`" = "$profile-1-link" | ||
| 113 | test -x "$profile/bin/guile" && ! test -x "$profile/bin/make" | ||
| 114 | |||
| 115 | # Switch to the rolled generation and switch back. | ||
| 116 | guix package -p "$profile" --switch-generation=2 | ||
| 117 | test "`readlink_base "$profile"`" = "$profile-2-link" | ||
| 118 | guix package -p "$profile" --switch-generation=-1 | ||
| 119 | test "`readlink_base "$profile"`" = "$profile-1-link" | ||
| 120 | |||
| 121 | # Move to the empty profile. | ||
| 122 | for i in `seq 1 3` | ||
| 123 | do | ||
| 124 | guix package --bootstrap --roll-back -p "$profile" | ||
| 125 | ! test -f "$profile/bin" | ||
| 126 | ! test -f "$profile/lib" | ||
| 127 | test "`readlink_base "$profile"`" = "$profile-0-link" | ||
| 128 | done | ||
| 129 | |||
| 130 | # Test that '--list-generations' does not output the zeroth generation. | ||
| 131 | test -z "`guix package -p "$profile" -l 0`" | ||
| 132 | |||
| 133 | # Reinstall after roll-back to the empty profile. | ||
| 134 | guix package --bootstrap -p "$profile" -e "$boot_make" | ||
| 135 | test "`readlink_base "$profile"`" = "$profile-1-link" | ||
| 136 | test -x "$profile/bin/guile" && ! test -x "$profile/bin/make" | ||
| 137 | |||
| 138 | # Check that the first generation is the current one. | ||
| 139 | test "`guix package -p "$profile" -l 1 | cut -f3 | head -n1`" = "(current)" | ||
| 140 | |||
| 141 | # Roll-back to generation 0, and install---all at once. | ||
| 142 | guix package --bootstrap -p "$profile" --roll-back -i guile-bootstrap | ||
| 143 | test "`readlink_base "$profile"`" = "$profile-1-link" | ||
| 144 | test -x "$profile/bin/guile" && ! test -x "$profile/bin/make" | ||
| 145 | |||
| 146 | # Install Make. | ||
| 147 | guix package --bootstrap -p "$profile" -e "$boot_make" | ||
| 148 | test "`readlink_base "$profile"`" = "$profile-2-link" | ||
| 149 | test -x "$profile/bin/guile" && test -x "$profile/bin/make" | ||
| 150 | grep "`guix build -e "$boot_make"`" "$profile/manifest" | ||
| 151 | |||
| 152 | # Make a "hole" in the list of generations, and make sure we can | ||
| 153 | # roll back and switch "over" it. | ||
| 154 | rm "$profile-1-link" | ||
| 155 | guix package --bootstrap -p "$profile" --roll-back | ||
| 156 | test "`readlink_base "$profile"`" = "$profile-0-link" | ||
| 157 | guix package -p "$profile" --switch-generation=+1 | ||
| 158 | test "`readlink_base "$profile"`" = "$profile-2-link" | ||
| 159 | |||
| 160 | # Make sure LIBRARY_PATH gets listed by `--search-paths'. | ||
| 161 | guix package --bootstrap -p "$profile" -i guile-bootstrap -i gcc-bootstrap | ||
| 162 | guix package --search-paths -p "$profile" | grep LIBRARY_PATH | ||
| 163 | |||
| 164 | # Roll back so we can delete #3 below. | ||
| 165 | guix package -p "$profile" --switch-generation=2 | ||
| 166 | |||
| 167 | # Delete the third generation and check that it was actually deleted. | ||
| 168 | guix package -p "$profile" --delete-generations=3 | ||
| 169 | test -z "`guix package -p "$profile" -l 3`" | ||
| 170 | |||
| 171 | # Exit with 1 when a generation does not exist. | ||
| 172 | if guix package -p "$profile" --delete-generations=42; | ||
| 173 | then false; else true; fi | ||
| 174 | |||
| 175 | # Exit with 0 when trying to delete the zeroth generation. | ||
| 176 | guix package -p "$profile" --delete-generations=0 | ||
| 177 | fi | ||
| 178 | 64 | ||
| 179 | # Make sure multiple arguments to -i works. | 65 | # Make sure multiple arguments to -i works. |
| 180 | guix package --bootstrap -i guile gcc -p "$profile" -n | 66 | guix package --bootstrap -i guile gcc -p "$profile" -n |
| @@ -253,18 +139,6 @@ guix package --bootstrap -i guile-bootstrap | |||
| 253 | test -L "$HOME/.guix-profile" | 139 | test -L "$HOME/.guix-profile" |
| 254 | test -f "$HOME/.guix-profile/bin/guile" | 140 | test -f "$HOME/.guix-profile/bin/guile" |
| 255 | 141 | ||
| 256 | if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null | ||
| 257 | then | ||
| 258 | guix package --bootstrap -e "$boot_make" | ||
| 259 | test -f "$HOME/.guix-profile/bin/make" | ||
| 260 | first_environment="`cd $HOME/.guix-profile ; pwd`" | ||
| 261 | |||
| 262 | guix package --bootstrap --roll-back | ||
| 263 | test -f "$HOME/.guix-profile/bin/guile" | ||
| 264 | ! test -f "$HOME/.guix-profile/bin/make" | ||
| 265 | test "`cd $HOME/.guix-profile ; pwd`" = "$first_environment" | ||
| 266 | fi | ||
| 267 | |||
| 268 | # Move to the empty profile. | 142 | # Move to the empty profile. |
| 269 | default_profile="`readlink "$HOME/.guix-profile"`" | 143 | default_profile="`readlink "$HOME/.guix-profile"`" |
| 270 | for i in `seq 1 3` | 144 | for i in `seq 1 3` |
