file-systems.scm 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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/>.
  18. (define-module (test-file-systems)
  19. #:use-module (guix store)
  20. #:use-module (guix modules)
  21. #:use-module (gnu system file-systems)
  22. #:use-module (srfi srfi-1)
  23. #:use-module (srfi srfi-64)
  24. #:use-module (ice-9 match))
  25. ;; Test the (gnu system file-systems) module.
  26. (test-begin "file-systems")
  27. (test-assert "file-system-needed-for-boot?"
  28. (let-syntax ((dummy-fs (syntax-rules ()
  29. ((_ directory)
  30. (file-system
  31. (device "foo")
  32. (mount-point directory)
  33. (type "ext4"))))))
  34. (parameterize ((%store-prefix "/gnu/guix/store"))
  35. (and (file-system-needed-for-boot? (dummy-fs "/"))
  36. (file-system-needed-for-boot? (dummy-fs "/gnu"))
  37. (file-system-needed-for-boot? (dummy-fs "/gnu/guix"))
  38. (file-system-needed-for-boot? (dummy-fs "/gnu/guix/store"))
  39. (not (file-system-needed-for-boot?
  40. (dummy-fs "/gnu/guix/store/foo")))
  41. (not (file-system-needed-for-boot? (dummy-fs "/gn")))
  42. (not (file-system-needed-for-boot?
  43. (file-system
  44. (inherit (dummy-fs (%store-prefix)))
  45. (device "/foo")
  46. (flags '(bind-mount read-only)))))))))
  47. (test-assert "does not pull (guix config)"
  48. ;; This module is meant both for the host side and "build side", so make
  49. ;; sure it doesn't pull in (guix config), which depends on the user's
  50. ;; config.
  51. (not (member '(guix config)
  52. (source-module-closure '((gnu system file-systems))))))
  53. (test-equal "does not pull (gnu packages …)"
  54. ;; Same story: (gnu packages …) should not be pulled.
  55. #f
  56. (find (match-lambda
  57. (('gnu 'packages _ ..1) #t)
  58. (_ #f))
  59. (source-module-closure '((gnu system file-systems)))))
  60. (test-end)