Track the source location of packages.
[guix.git] / tests / builders.scm
blob17bae2c7548db81f403d8c2ea165ad9f5fb7fcc7
1 ;;; Guix --- Nix package management from Guile.         -*- coding: utf-8 -*-
2 ;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of Guix.
5 ;;;
6 ;;; Guix is free software; you can redistribute it and/or modify it
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 ;;;
11 ;;; Guix is distributed in the hope that it will be useful, but
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
17 ;;; along with Guix.  If not, see <http://www.gnu.org/licenses/>.
20 (define-module (test-builders)
21   #:use-module (guix http)
22   #:use-module (guix build-system)
23   #:use-module (guix build-system gnu)
24   #:use-module (guix store)
25   #:use-module (guix utils)
26   #:use-module (guix derivations)
27   #:use-module (srfi srfi-1)
28   #:use-module (srfi srfi-64))
30 ;; Test the higher-level builders.
32 (define %store
33   (false-if-exception (open-connection)))
35 (test-begin "builders")
37 (test-assert "http-fetch"
38   (let* ((url      "http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz")
39          (hash     (nix-base32-string->bytevector
40                     "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"))
41          (drv-path (http-fetch %store url 'sha256 hash)))
42     (and (build-derivations %store (list drv-path))
43          (file-exists? (derivation-path->output-path drv-path)))))
45 (test-assert "gnu-build-system"
46   (and (build-system? gnu-build-system)
47        (eq? gnu-build (build-system-builder gnu-build-system))))
49 (test-assert "gnu-build"
50   (let* ((url      "http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz")
51          (hash     (nix-base32-string->bytevector
52                     "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"))
53          (tarball  (http-fetch %store url 'sha256 hash))
54          (build    (gnu-build %store "hello-2.8" tarball
55                               `(("gawk" ,(nixpkgs-derivation "gawk"))))))
56     (and (build-derivations %store (list (pk 'hello-drv build)))
57          (file-exists? (string-append (derivation-path->output-path build)
58                                       "/bin/hello")))))
60 (test-end "builders")
63 (exit (= (test-runner-fail-count (test-runner-current)) 0))
65 ;;; Local Variables:
66 ;;; eval: (put 'test-assert 'scheme-indent-function 1)
67 ;;; End: