gnu: Properly credit Konrad Hinsen.
[jackhill/guix/guix.git] / tests / builders.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
11b4a871 2;;; Copyright © 2012, 2013, 2014, 2015, 2019 Ludovic Courtès <ludo@gnu.org>
3eb98237 3;;;
233e7676 4;;; This file is part of GNU Guix.
3eb98237 5;;;
233e7676 6;;; GNU Guix is free software; you can redistribute it and/or modify it
3eb98237
LC
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
233e7676 11;;; GNU Guix is distributed in the hope that it will be useful, but
3eb98237
LC
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
233e7676 17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
3eb98237
LC
18
19
20(define-module (test-builders)
62cab99c 21 #:use-module (guix download)
208f7cd1
LC
22 #:use-module (guix build-system)
23 #:use-module (guix build-system gnu)
3eb98237
LC
24 #:use-module (guix store)
25 #:use-module (guix utils)
ddc29a78 26 #:use-module (guix base32)
3eb98237 27 #:use-module (guix derivations)
ca719424 28 #:use-module (gcrypt hash)
c1bc358f 29 #:use-module (guix tests)
7a88ad6b 30 #:use-module ((guix packages)
a2b2070b
JN
31 #:select (package?
32 package-derivation package-native-search-paths))
1ffa7090 33 #:use-module (gnu packages bootstrap)
8f3ecbd7 34 #:use-module (ice-9 match)
3eb98237
LC
35 #:use-module (srfi srfi-1)
36 #:use-module (srfi srfi-64))
37
38;; Test the higher-level builders.
39
40(define %store
c1bc358f 41 (open-connection-for-tests))
81dbd783 42
f220a838
LC
43(define url-fetch*
44 (store-lower url-fetch))
45
14da91e2 46\f
3eb98237
LC
47(test-begin "builders")
48
12d720fd 49(unless (network-reachable?) (test-skip 1))
62cab99c
LC
50(test-assert "url-fetch"
51 (let* ((url '("http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz"
52 "ftp://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz"))
53 (hash (nix-base32-string->bytevector
54 "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"))
f220a838
LC
55 (drv (url-fetch* %store url 'sha256 hash
56 #:guile %bootstrap-guile))
59688fc4
LC
57 (out-path (derivation->output-path drv)))
58 (and (build-derivations %store (list drv))
62cab99c
LC
59 (file-exists? out-path)
60 (valid-path? %store out-path))))
3eb98237 61
882383a9
LC
62(test-assert "url-fetch, file"
63 (let* ((file (search-path %load-path "guix.scm"))
64 (hash (call-with-input-file file port-sha256))
f220a838 65 (out (url-fetch* %store file 'sha256 hash)))
882383a9
LC
66 (and (file-exists? out)
67 (valid-path? %store out))))
68
69(test-assert "url-fetch, file URI"
70 (let* ((file (search-path %load-path "guix.scm"))
71 (hash (call-with-input-file file port-sha256))
f220a838
LC
72 (out (url-fetch* %store
73 (string-append "file://" (canonicalize-path file))
74 'sha256 hash)))
882383a9
LC
75 (and (file-exists? out)
76 (valid-path? %store out))))
77
208f7cd1 78(test-assert "gnu-build-system"
0d5a559f 79 (build-system? gnu-build-system))
208f7cd1 80
3eb98237 81(test-end "builders")