diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2014-10-03 11:02:11 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2014-10-03 18:03:09 +0200 |
| commit | 882383a9aa5fbeef6f29d359a786a6db7c9e03db (patch) | |
| tree | 323b5cffbe95c01b070064f1c89f3f968ba95ba2 /tests | |
| parent | b497a85be8490f0f91279119904fd76ae13cbea5 (diff) | |
download: Allow raw file names or file:// URLs.
* guix/download.scm (url-fetch): When URL is a string, if it's not a URI
or if it's a URI with 'file' or #f scheme, use 'add-to-store'.
* tests/builders.scm ("url-fetch, file", "url-fetch, file URI"): New
tests.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/builders.scm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/builders.scm b/tests/builders.scm index ce1f3852d70..a2f500a94d9 100644 --- a/tests/builders.scm +++ b/tests/builders.scm | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #:use-module (guix utils) | 25 | #:use-module (guix utils) |
| 26 | #:use-module (guix base32) | 26 | #:use-module (guix base32) |
| 27 | #:use-module (guix derivations) | 27 | #:use-module (guix derivations) |
| 28 | #:use-module (guix hash) | ||
| 28 | #:use-module (guix tests) | 29 | #:use-module (guix tests) |
| 29 | #:use-module ((guix packages) | 30 | #:use-module ((guix packages) |
| 30 | #:select (package-derivation package-native-search-paths)) | 31 | #:select (package-derivation package-native-search-paths)) |
| @@ -74,6 +75,22 @@ | |||
| 74 | (file-exists? out-path) | 75 | (file-exists? out-path) |
| 75 | (valid-path? %store out-path)))) | 76 | (valid-path? %store out-path)))) |
| 76 | 77 | ||
| 78 | (test-assert "url-fetch, file" | ||
| 79 | (let* ((file (search-path %load-path "guix.scm")) | ||
| 80 | (hash (call-with-input-file file port-sha256)) | ||
| 81 | (out (url-fetch %store file 'sha256 hash))) | ||
| 82 | (and (file-exists? out) | ||
| 83 | (valid-path? %store out)))) | ||
| 84 | |||
| 85 | (test-assert "url-fetch, file URI" | ||
| 86 | (let* ((file (search-path %load-path "guix.scm")) | ||
| 87 | (hash (call-with-input-file file port-sha256)) | ||
| 88 | (out (url-fetch %store | ||
| 89 | (string-append "file://" (canonicalize-path file)) | ||
| 90 | 'sha256 hash))) | ||
| 91 | (and (file-exists? out) | ||
| 92 | (valid-path? %store out)))) | ||
| 93 | |||
| 77 | (test-assert "gnu-build-system" | 94 | (test-assert "gnu-build-system" |
| 78 | (and (build-system? gnu-build-system) | 95 | (and (build-system? gnu-build-system) |
| 79 | (eq? gnu-build (build-system-builder gnu-build-system)))) | 96 | (eq? gnu-build (build-system-builder gnu-build-system)))) |
