aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2023 Brian Cully <bjc@spork.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 (tests services pam-mount)
  #:use-module (gnu services pam-mount)
  #:use-module (gnu system pam)
  #:use-module (gnu services)
  #:use-module (gnu services configuration)
  #:use-module (guix derivations)
  #:use-module (guix gexp)
  #:use-module (guix grafts)
  #:use-module (guix store)
  #:use-module (guix tests)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-64))

(define pam-mount-volume-fields (@@ (gnu services pam-mount)
                                    pam-mount-volume-fields))
(define field-name->tag (@@ (gnu services pam-mount)
                            field-name->tag))

(define pam-mount-volume->sxml (@@ (gnu services pam-mount)
                                   pam-mount-volume->sxml))

(test-begin "services-pam-mount")

(test-group "field-name->tag"
  (let ((field-map '((user-name user)
                     (user-id uid)
                     (primary-group pgrp)
                     (group-id gid)
                     (secondary-group sgrp)
                     (file-system-type fstype)
                     (no-mount-as-root? noroot)
                     (server server)
                     (file-name path)
                     (mount-point mountpoint)
                     (options options)
                     (ssh? ssh)
                     (cipher cipher)
                     (file-system-key-cipher fskeycipher)
                     (file-system-key-hash fskeyhash)
                     (file-system-key-file-name fskeypath))))

    (test-equal "all fields accounted for"
      (map car field-map)
      (map configuration-field-name pam-mount-volume-fields))

    (for-each (match-lambda
                ((field-name tag-name)
                 (test-eq (format #f "~a -> ~a" field-name tag-name)
                   (field-name->tag field-name) tag-name)))
              field-map)))

(let ((tmpfs-volume (pam-mount-volume
                     (secondary-group "users")
                     (file-system-type "tmpfs")
                     (mount-point "/run/user/%(USERUID)")
                     (options "someoptions"))))
  (test-equal "tmpfs"
    '(volume (@ (sgrp "users")
                (fstype "tmpfs")
                (mountpoint "/run/user/%(USERUID)")
                (options "someoptions")))
    (pam-mount-volume->sxml tmpfs-volume)))

(test-end "services-pam-mount")
ation, invalid hash size"): New test. Ludovic Courtès 2022-12-18daemon: Make "opening file" error messages distinguishable....* nix/libstore/build.cc (DerivationGoal::openLogFile): Customize "opening file" error message. * nix/libutil/hash.cc (hashFile): Likewise. * nix/libutil/util.cc (readFile, writeFile): Likewise. Ludovic Courtès 2022-10-17Revert "nix: Guard against removing temporary roots of living processes."...This reverts commit bb0beaecdee1a2315a1269b1746d238c8ab0e699. This change broke a number of tests that assumed the previous behavior. Ludovic Courtès 2022-10-07nix: Guard against removing temporary roots of living processes....Fixes <https://issues.guix.gnu.org/25018>. * nix/libstore/gc.cc (readTempRoots): Add a check to guard against removing the temporary roots of a living process. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Ludovic Courtès 2022-09-11daemon: Remove unused function findOutput....* nix/libstore/misc.cc (findOutput): Remove it. * nix/libstore/misc.hh (findOutput): Likewise. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Maxime Devos 2022-09-11daemon: Remove unused function exportPaths....* nix/libstore/store-api.cc (exportPaths): Remove it. * nix/libstore/store-api.hh (exportPaths): Likewise. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Maxime Devos 2022-09-11daemon: Remove unused function openStore....* nix/libstore/store-api.cc (openStore): Remove it. * nix/libstore/store-api.hh (openStore): Likewise. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Maxime Devos 2022-06-05daemon: Quote consistently within a string....* nix/libstore/build.cc (DerivationGoal::registerOutput): ‘’ → `'. Tobias Geerinckx-Rice 2022-05-29daemon: Clarify ‘--check’ error when outputs are missing....Drop the confusing ‘invalid’ jargon and display a hint like we do for ‘--fallback’. * nix/libstore/build.cc (DerivationGoal::outputsSubstituted): Rewrite error message. Tobias Geerinckx-Rice 2022-05-18daemon: runChild() is forbidden to talk during environment set up...DerivationGoal::startBuilder() is waiting for an empty line as a check that the environment set up is fine. Fixes <https://issues.guix.gnu.org/55324>. * nix/libstore/build.cc (DerivationGoal::runChild): Remove 'debug' statement corresponding to bind mounts. Signed-off-by: Ludovic Courtès <ludo@gnu.org> yarl-baudig@mailoo.org 2022-04-14daemon: Support systemd-style socket activation....* nix/nix-daemon/guix-daemon.cc (SD_LISTEN_FDS_START): New macro. (systemd_activation_sockets): New function. (main): Use it. Remove obsolete 'printMsg' call. * doc/guix.texi (Invoking guix-daemon): Document socket activation. Ludovic Courtès