summaryrefslogtreecommitdiff
path: root/tests/syscalls.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-02-22 15:20:41 +0100
committerLudovic Courtès <ludo@gnu.org>2021-02-25 11:29:35 +0100
commit7e9d9f28e997e7faad28cdd1c416be174d6986e7 (patch)
tree9b617a48137c287e6a6c96834dc5b55a13472226 /tests/syscalls.scm
parent46bb1a41aebf82a1f7cc57d22cccea8eafc4de0d (diff)
syscalls: Add 'mounts' and the <mount> record type.
* guix/build/syscalls.scm (<mount>): New record type. (option-string->mount-flags, mount-flags) (octal-decode, mounts): New procedures. (mount-points): Rewrite in terms of 'mount'. * tests/syscalls.scm ("mounts"): New test.
Diffstat (limited to 'tests/syscalls.scm')
-rw-r--r--tests/syscalls.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 09aa228e8e5..706dd4177fc 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2015 David Thompson <davet@gnu.org> 3;;; Copyright © 2015 David Thompson <davet@gnu.org>
4;;; Copyright © 2020 Simon South <simon@simonsouth.net> 4;;; Copyright © 2020 Simon South <simon@simonsouth.net>
5;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com> 5;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
@@ -56,6 +56,20 @@
56 ;; Both return values have been encountered in the wild. 56 ;; Both return values have been encountered in the wild.
57 (memv (system-error-errno args) (list EPERM ENOENT))))) 57 (memv (system-error-errno args) (list EPERM ENOENT)))))
58 58
59(test-assert "mounts"
60 ;; Check for one of the common mount points.
61 (let ((mounts (mounts)))
62 (any (match-lambda
63 ((point . type)
64 (let ((mount (find (lambda (mount)
65 (string=? (mount-point mount) point))
66 mounts)))
67 (and mount
68 (string=? (mount-type mount) type)))))
69 '(("/proc" . "proc")
70 ("/sys" . "sysfs")
71 ("/dev/shm" . "tmpfs")))))
72
59(test-assert "mount-points" 73(test-assert "mount-points"
60 ;; Reportedly "/" is not always listed as a mount point, so check a few 74 ;; Reportedly "/" is not always listed as a mount point, so check a few
61 ;; others (see <http://bugs.gnu.org/20261>.) 75 ;; others (see <http://bugs.gnu.org/20261>.)