aboutsummaryrefslogtreecommitdiff
path: root/tests/syscalls.scm
blob: 51846d3c36ca16466c70494f8292c32869d7ce5b (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-syscalls)
  #:use-module (guix build syscalls)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-64)
  #:use-module (ice-9 match))

;; Test the (guix build syscalls) module, although there's not much that can
;; actually be tested without being root.

(test-begin "syscalls")

(test-equal "mount, ENOENT"
  ENOENT
  (catch 'system-error
    (lambda ()
      (mount "/dev/null" "/does-not-exist" "ext2")
      #f)
    (compose system-error-errno list)))

(test-assert "umount, ENOENT/EPERM"
  (catch 'system-error
    (lambda ()
      (umount "/does-not-exist")
      #f)
    (lambda args
      ;; Both return values have been encountered in the wild.
      (memv (system-error-errno args) (list EPERM ENOENT)))))

(test-assert "swapon, ENOENT/EPERM"
  (catch 'system-error
    (lambda ()
      (swapon "/does-not-exist")
      #f)
    (lambda args
      (memv (system-error-errno args) (list EPERM ENOENT)))))

(test-assert "swapoff, EINVAL/EPERM"
  (catch 'system-error
    (lambda ()
      (swapoff "/does-not-exist")
      #f)
    (lambda args
      (memv (system-error-errno args) (list EPERM EINVAL)))))

(test-assert "all-network-interfaces"
  (match (all-network-interfaces)
    (((? string? names) ..1)
     (member "lo" names))))

(test-assert "network-interfaces"
  (match (network-interfaces)
    (((? string? names) ..1)
     (lset<= string=? names (all-network-interfaces)))))

(test-assert "network-interface-flags"
  (let* ((sock  (socket SOCK_STREAM AF_INET 0))
         (flags (network-interface-flags sock "lo")))
    (close-port sock)
    (and (not (zero? (logand flags IFF_LOOPBACK)))
         (not (zero? (logand flags IFF_UP))))))

(test-equal "loopback-network-interface?"
  ENODEV
  (and (loopback-network-interface? "lo")
       (catch 'system-error
         (lambda ()
           (loopback-network-interface? "nonexistent")
           #f)
         (lambda args
           (system-error-errno args)))))

(test-end)


(exit (= (test-runner-fail-count (test-runner-current)) 0))
<me@tobias.gr> 2020-09-01gnu: Add opensmtpd-filter-dkimsign.Tobias Geerinckx-Rice * gnu/packages/mail.scm (libopensmtpd): New variable. opensmtpd-filter-dkimsign): New public variable. 2020-09-01gnu: Add caveman.Pierre Neidhardt * gnu/packages/lisp-xyz.scm (cl-caveman, ecl-caveman, sbcl-caveman): New variables. 2020-09-01gnu: Add cl-project.Pierre Neidhardt * gnu/packages/lisp-xyz.scm (cl-project, ecl-cl-project, sbcl-cl-project): New variables. 2020-09-01gnu: Add cl-emb.Pierre Neidhardt * gnu/packages/lisp-xyz.scm (cl-emb, ecl-emb, sbcl-emb): New variables. 2020-09-01gnu: Add do-urlencode.Pierre Neidhardt * gnu/packages/lisp-xyz.scm (cl-do-urlencode, ecl-do-urlencode, sbcl-do-urlencode): New variables. 2020-09-01gnu: Add datafly.Pierre Neidhardt * gnu/packages/lisp-xyz.scm (cl-datafly, ecl-datafly, sbcl-datafly): New variables. 2020-09-01gnu: Add kebab.Pierre Neidhardt * gnu/packages/lisp-xyz.scm (cl-kebab, ecl-kebab, sbcl-kebab): New variables. 2020-09-01gnu: Add mito.Pierre Neidhardt * gnu/packages/lisp-xyz.scm (cl-mito, sbcl-mito): New variables. 2020-09-01gnu: Add ecl-cl-postgres.Pierre Neidhardt * gnu/packages/lisp-xyz.scm (ecl-cl-postgres): New variable. 2020-09-01gnu: Add ecl-md5.Pierre Neidhardt * gnu/packages/lisp-xyz.scm (ecl-md5): New variable. 2020-09-01gnu: Add envy.Pierre Neidhardt * gnu/packages/lisp-xyz.scm (cl-envy, ecl-envy, sbcl-envy): New variables. 2020-09-01gnu: manuskript: Use make-deskop-entry-file.Efraim Flashner * gnu/packages/text-editors.scm (manuskript)[arguments]: Adjust custom 'install phase to use make-desktop-entry-file. 2020-09-01services: childhurd: Support installing secrets from the host.Jan (janneke) Nieuwenhuizen * gnu/services/virtualization.scm (%hurd-vm-operating-system): Add secret-service. (hurd-vm-shepherd-service): Use it to install secrets. * doc/guix.texi (The Hurd in a Virtual Machine): Document it. 2020-09-01services: Add secret-service-type.Jan (janneke) Nieuwenhuizen This adds a "secret-service" that can be added to a Childhurd VM to receive out-of-band secrets (keys) sent from the host. Co-authored-by: Ludovic Courtès <ludo@gnu.org> * gnu/services/virtualization.scm (secret-service-activation): New procedure. (secret-service-type): New variable. * gnu/build/secret-service.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. 2020-09-01gnu: childsplay: Fix .desktop file.Prafulla Giri * gnu/packages/education.scm (childsplay)[arguments]: In phase 'create-desktop-file, fix Exec to point to out/bin/childsplay. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> 2020-09-01gnu: gajim-omemo: Update to 2.7.7.Mason Hock * gnu/packages/messaging.scm (gajim-omemo): Update to 2.7.7. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> 2020-09-01gnu: knot: Update to 2.9.6.Tobias Geerinckx-Rice * gnu/packages/dns.scm (knot): Update to 2.9.6. 2020-09-01gnu: xtl: Update to 0.6.17.Tobias Geerinckx-Rice * gnu/packages/cpp.scm (xtl): Update to 0.6.17. 2020-09-01gnu: enlightenment-wayland: Deprecate package.Efraim Flashner * gnu/packages/enlightenment.scm (enlightenment-wayland): Deprecate package in favor of enlightenment. 2020-09-01gnu: enlightenment: Build with wayland support.Efraim Flashner * gnu/packages/enlightenment.scm (enlightenment)[arguments]: Add configure-flag to build with wayland support. [inputs]: Add wayland-protocols, xorg-server-xwayland. 2020-09-01gnu: python-efl: Use regex to delete cythonized files.Efraim Flashner * gnu/packages/enlightenment.scm (python-efl)[source]: Adjust snippet to delete cythonized files based on a regex pattern. 2020-09-01gnu: enlightenment: Use system eject.Efraim Flashner * gnu/packages/enlightenment.scm (enlightenment)[arguments]: Adjust 'set-system-actions phase to refer to eject in /run/current-system. [native-inputs]: Remove util-linux. 2020-09-01gnu: enlightenment.scm: Remove unneeded module import.Efraim Flashner * gnu/packages/enlightenment.scm: Remove unneeded module import. 2020-09-01gnu: gap: Update to 4.11.0.Andreas Enge * gnu/packages/algebra.scm (gap)[source]: Update to 4.11.0. Identify kept packages by name prefix, dropping version number comparisons. [inputs]: Add readline. [arguments]: Use make targets instead of file copying where possible. 2020-09-01Revert "system: image: Do not offload image files."Maxim Cournoyer This reverts commit 6a9581741e4ee81226aeb2f1c997df76670a6aab, which is obsoleted by the previous commit. 2020-09-01gnu: editorconfig-core-c: Delete static library.Tobias Geerinckx-Rice * gnu/packages/text-editors.scm (editorconfig-core-c)[arguments]: Add a ‘delete-static-library’ phase. 2020-09-01gnu: editorconfig-core-c: Update to 0.12.4.Tobias Geerinckx-Rice * gnu/packages/text-editors.scm (editorconfig-core-c): Update to 0.12.4. 2020-09-01gnu: youtube-viewer: Update to 3.7.8.Tobias Geerinckx-Rice * gnu/packages/video.scm (youtube-viewer): Update to 3.7.8. 2020-09-01gnu: libwacom: Update to 1.5.Tobias Geerinckx-Rice * gnu/packages/xdisorg.scm (libwacom): Update to 1.5. 2020-09-01gnu: wgetpaste: Update bpaste URL & regular expressions.Tobias Geerinckx-Rice * gnu/packages/wget.scm (wgetpaste)[source]: Add patch. * gnu/packages/patches/wgetpaste-update-bpaste.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. 2020-09-01gnu: wgetpaste: Update to 2.30.Tobias Geerinckx-Rice * gnu/packages/wget.scm (wgetpaste): Update to 2.30. 2020-09-01gnu: wgetpaste: Use HTTPS home page.Tobias Geerinckx-Rice * gnu/packages/wget.scm (wgetpaste)[source, home-page]: Use HTTPS. 2020-09-01gnu: wgetpaste: Fix historical confusion.Tobias Geerinckx-Rice * gnu/packages/wget.scm (wgetpaste)[arguments]: Fix the reversed substitution and clarify its purpose. 2020-09-01gnu: uchardet: Update to 0.0.7.Tobias Geerinckx-Rice * gnu/packages/freedesktop.scm (uchardet): Update to 0.0.7. 2020-09-01gnu: fetchmail: Update to 6.4.11.Tobias Geerinckx-Rice * gnu/packages/mail.scm (fetchmail): Update to 6.4.11. 2020-09-01gnu: python-jeepney: Update to 0.4.3.Tobias Geerinckx-Rice * gnu/packages/python-crypto.scm (python-jeepney): Update to 0.4.3.