ui: Present 'use-modules' hints with a question mark.
[guix.git] / tests / file-systems.scm
blob4c28d0ebc5b2527928357aa59c1b72b09a3469f5
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU 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 ;;; GNU 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 GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
19 (define-module (test-file-systems)
20   #:use-module (guix store)
21   #:use-module (guix modules)
22   #:use-module (gnu system file-systems)
23   #:use-module (srfi srfi-1)
24   #:use-module (srfi srfi-64)
25   #:use-module (ice-9 match))
27 ;; Test the (gnu system file-systems) module.
29 (test-begin "file-systems")
31 (test-assert "file-system-needed-for-boot?"
32   (let-syntax ((dummy-fs (syntax-rules ()
33                            ((_ directory)
34                             (file-system
35                               (device "foo")
36                               (mount-point directory)
37                               (type "ext4"))))))
38     (parameterize ((%store-prefix "/gnu/guix/store"))
39       (and (file-system-needed-for-boot? (dummy-fs "/"))
40            (file-system-needed-for-boot? (dummy-fs "/gnu"))
41            (file-system-needed-for-boot? (dummy-fs "/gnu/guix"))
42            (file-system-needed-for-boot? (dummy-fs "/gnu/guix/store"))
43            (not (file-system-needed-for-boot?
44                  (dummy-fs "/gnu/guix/store/foo")))
45            (not (file-system-needed-for-boot? (dummy-fs "/gn")))
46            (not (file-system-needed-for-boot?
47                  (file-system
48                    (inherit (dummy-fs (%store-prefix)))
49                    (device "/foo")
50                    (flags '(bind-mount read-only)))))))))
52 (test-assert "does not pull (guix config)"
53   ;; This module is meant both for the host side and "build side", so make
54   ;; sure it doesn't pull in (guix config), which depends on the user's
55   ;; config.
56   (not (member '(guix config)
57                (source-module-closure '((gnu system file-systems))))))
59 (test-equal "does not pull (gnu packages …)"
60   ;; Same story: (gnu packages …) should not be pulled.
61   #f
62   (find (match-lambda
63           (('gnu 'packages _ ..1) #t)
64           (_ #f))
65         (source-module-closure '((gnu system file-systems)))))
67 (test-end)