1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2022 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
4 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu tests base)
22 #:use-module (gnu tests)
23 #:use-module (gnu image)
24 #:use-module (gnu system)
25 #:autoload (gnu system image) (system-image)
26 #:use-module (gnu system shadow)
27 #:use-module (gnu system nss)
28 #:use-module (gnu system vm)
29 #:use-module (gnu services)
30 #:use-module (gnu services base)
31 #:use-module (gnu services dbus)
32 #:use-module (gnu services avahi)
33 #:use-module (gnu services mcron)
34 #:use-module (gnu services shepherd)
35 #:use-module (gnu services networking)
36 #:use-module (gnu packages base)
37 #:use-module (gnu packages bash)
38 #:use-module (gnu packages imagemagick)
39 #:use-module (gnu packages linux)
40 #:use-module (gnu packages ocr)
41 #:use-module (gnu packages package-management)
42 #:use-module (gnu packages tmux)
43 #:use-module (gnu packages virtualization)
44 #:use-module (guix gexp)
45 #:use-module (guix store)
46 #:use-module (guix monads)
47 #:use-module (guix modules)
48 #:use-module (guix packages)
49 #:use-module ((srfi srfi-1) #:hide (partition))
50 #:use-module (ice-9 match)
51 #:export (run-basic-test
60 (simple-operating-system))
63 (define* (run-basic-test os command #:optional (name "basic")
68 "Return a derivation called NAME that tests basic features of the OS started
69 using COMMAND, a gexp that evaluates to a list of strings. Compare some
70 properties of running system to what's declared in OS, an <operating-system>.
72 When INITIALIZATION is true, it must be a one-argument procedure that is
73 passed a gexp denoting the marionette, and it must return gexp that is
74 inserted before the first test. This is used to introduce an extra
75 initialization step, such as entering a LUKS passphrase.
77 When ROOT-PASSWORD is true, enter it as the root password when logging in.
78 Otherwise assume that there is no password for root."
81 (fold-services (operating-system-services os)
82 #:target-type special-files-service-type)))
85 (match (package-transitive-propagated-inputs guix)
86 (((labels packages) ...)
87 (cons guix packages))))
90 (with-imported-modules '((gnu build marionette)
91 (guix build syscalls))
93 (use-modules (gnu build marionette)
102 (make-marionette #$command))
104 (test-runner-current (system-test-runner #$output))
107 #$(and initialization
108 (initialization #~marionette))
111 (match (marionette-eval '(uname) marionette)
112 (#("Linux" host-name version _ architecture)
113 (and (string=? host-name
114 #$(operating-system-host-name os))
115 (string-prefix? #$(package-version
116 (operating-system-kernel os))
118 (string-prefix? architecture %host-type)))))
120 ;; Shepherd reads the config file *before* binding its control
121 ;; socket, so /var/run/shepherd/socket might not exist yet when the
122 ;; 'marionette' service is started.
123 (test-assert "shepherd socket ready"
126 (use-modules (gnu services herd))
128 (cond ((file-exists? (%shepherd-socket-file))
137 (test-eq "stdin is /dev/null"
139 ;; Make sure services can no longer read from stdin once the
140 ;; system has booted.
143 (use-modules (gnu services herd))
144 (start 'user-processes)
145 ((@@ (gnu services herd) eval-there)
146 '(let ((result (read (current-input-port))))
147 (if (eof-object? result)
152 (test-assert "shell and user commands"
153 ;; Is everything in $PATH?
154 (zero? (marionette-eval '(system "
163 (test-equal "special files"
167 (use-modules (ice-9 match))
171 (list file (readlink file))))
175 (test-assert "accounts"
176 (let ((users (marionette-eval '(begin
177 (use-modules (ice-9 match))
178 (let loop ((result '()))
180 (#f (reverse result))
181 (x (loop (cons x result))))))
185 (list (passwd:name user)
189 #$@(map (lambda (account)
190 `(list ,(user-account-name account)
191 ,(user-account-home-directory account)))
192 (operating-system-user-accounts os))))))
194 (test-assert "shepherd services"
195 (let ((services (marionette-eval
197 (use-modules (gnu services herd))
199 (map (compose car live-service-provision)
203 (pk 'services services)
204 '(root #$@(operating-system-shepherd-service-names os)))))
206 (test-equal "libc honors /etc/localtime"
208 ;; Assume OS is configured to have a CEST timezone.
209 (let* ((sept-2021 (time-second
211 (make-date 0 0 00 12 01 09 2021 7200)))))
213 `(tm:gmtoff (localtime ,sept-2021))
216 (test-equal "/var/log/messages is not world-readable"
217 #o640 ;<https://bugs.gnu.org/40405>
219 (wait-for-file "/var/log/messages" marionette
221 (marionette-eval '(stat:perms (lstat "/var/log/messages"))
226 '#$(map user-account-home-directory
227 (filter user-account-create-home-directory?
228 (operating-system-user-accounts os)))))
231 (use-modules (gnu services herd) (srfi srfi-1))
233 ;; Home directories are supposed to exist once 'user-homes'
235 (start-service 'user-homes)
237 (every (lambda (home)
238 (and (file-exists? home)
239 (file-is-directory? home)))
243 (test-assert "skeletons in home directories"
245 '#$(filter-map (lambda (account)
246 (and (user-account-create-home-directory?
248 (not (user-account-system? account))
249 (list (user-account-name account)
250 (user-account-home-directory
252 (operating-system-user-accounts os))))
255 (use-modules (guix build utils) (srfi srfi-1)
256 (ice-9 ftw) (ice-9 match))
260 ;; Make sure HOME has all the skeletons...
261 (and (null? (lset-difference string=?
262 (scandir "/etc/skel/")
265 ;; ... and that everything is user-owned.
266 (let* ((pw (getpwnam user))
267 (uid (passwd:uid pw))
268 (gid (passwd:gid pw))
270 (define (user-owned? file)
271 (= uid (stat:uid (lstat file))))
273 (and (= uid (stat:uid st))
274 (eq? 'directory (stat:type st))
277 #:directories? #t)))))))
281 (test-equal "permissions on /root"
283 (let ((root-home #$(any (lambda (account)
284 (and (zero? (user-account-uid account))
285 (user-account-home-directory
287 (operating-system-user-accounts os))))
288 (stat:perms (marionette-eval `(stat ,root-home) marionette))))
290 (test-equal "ownership and permissions of /var/empty"
292 (let ((st (marionette-eval `(stat "/var/empty") marionette)))
293 (list (stat:uid st) (stat:gid st)
296 (test-equal "no extra home directories"
299 ;; Make sure the home directories that are not supposed to be
300 ;; created are indeed not created.
302 '#$(filter-map (lambda (user)
304 (user-account-create-home-directory?
306 (user-account-home-directory user)))
307 (operating-system-user-accounts os))))
310 (use-modules (srfi srfi-1))
312 ;; Note: Do not flag "/var/empty".
314 ',(remove (cut string-prefix? "/var/" <>)
318 (test-equal "login on tty1"
321 ;; XXX: On desktop, GDM3 will switch to TTY7. If this happens
322 ;; after we switched to TTY1, we won't be able to login. Make
323 ;; sure to wait long enough before switching to TTY1.
327 (marionette-control "sendkey ctrl-alt-f1" marionette)
328 ;; Wait for the 'term-tty1' service to be running (using
329 ;; 'start-service' is the simplest and most reliable way to do
333 (use-modules (gnu services herd))
334 (start-service 'term-tty1))
338 (let ((password #$root-password))
341 (marionette-type "root\n" marionette)
342 (wait-for-screen-text marionette
344 (string-contains text "Password"))
346 #$(file-append ocrad "/bin/ocrad"))
347 (marionette-type (string-append password "\n\n")
349 (marionette-type "root\n\n" marionette)))
350 (marionette-type "id -un > logged-in\n" marionette)
352 ;; It can take a while before the shell commands are executed.
353 (marionette-eval '(use-modules (rnrs io ports)) marionette)
354 (wait-for-file "/root/logged-in" marionette
355 #:read 'get-string-all
358 (test-equal "getlogin on tty1"
361 ;; Assume we logged in in the previous test and type.
362 (marionette-type "guile -c '(write (getlogin))' > /root/login-id.tmp\n"
364 (marionette-type "mv /root/login-id{.tmp,}\n"
367 ;; It can take a while before the shell commands are executed.
368 (marionette-eval '(use-modules (rnrs io ports)) marionette)
369 (wait-for-file "/root/login-id" marionette
370 #:read 'get-string-all
373 ;; There should be one utmpx entry for the user logged in on tty1.
374 (test-equal "utmpx entry"
375 '(("root" "tty1" #f))
378 (use-modules (guix build syscalls)
381 (filter-map (lambda (entry)
382 (and (equal? (login-type USER_PROCESS)
383 (utmpx-login-type entry))
384 (list (utmpx-user entry) (utmpx-line entry)
385 (utmpx-host entry))))
389 ;; Likewise for /var/log/wtmp (used by 'last').
390 (test-assert "wtmp entry"
391 (match (marionette-eval
393 (use-modules (guix build syscalls)
396 (define (entry->list entry)
397 (list (utmpx-user entry) (utmpx-line entry)
398 (utmpx-host entry) (utmpx-login-type entry)))
400 (call-with-input-file "/var/log/wtmp"
402 (let loop ((result '()))
403 (if (eof-object? (peek-char port))
404 (map entry->list (reverse result))
405 (loop (cons (read-utmpx port) result)))))))
407 (((users lines hosts types) ..1)
408 (every (lambda (type)
409 (eqv? type (login-type LOGIN_PROCESS)))
412 (test-assert "host name resolution"
413 (match (marionette-eval
415 ;; Wait for nscd or our requests go through it.
416 (use-modules (gnu services herd))
417 (start-service 'nscd)
419 (list (getaddrinfo "localhost")
420 (getaddrinfo #$(operating-system-host-name os))))
422 ((((? vector?) ..1) ((? vector?) ..1))
425 (pk 'failure x #f))))
427 (test-equal "nscd invalidate action"
429 (marionette-eval '(with-shepherd-action 'nscd ('invalidate "hosts")
434 ;; FIXME: The 'invalidate' action can't reliably obtain the exit
435 ;; code of 'nscd' so skip this test.
437 (test-equal "nscd invalidate action, wrong table"
439 (marionette-eval '(with-shepherd-action 'nscd ('invalidate "xyz")
444 (test-equal "host not found"
447 '(false-if-exception (getaddrinfo "does-not-exist"))
452 (marionette-eval '(let ((before (setlocale LC_ALL "en_US.utf8")))
453 (setlocale LC_ALL before))
456 (test-eq "/run/current-system is a GC root"
458 (marionette-eval '(begin
459 ;; Make sure the (guix …) modules are found.
460 (eval-when (expand load eval)
462 (append (map (lambda (package)
463 (string-append package
465 (effective-version)))
469 (use-modules (srfi srfi-34) (guix store))
471 (let ((system (readlink "/run/current-system")))
472 (guard (c ((store-protocol-error? c)
473 (and (file-exists? system)
476 (delete-paths store (list system))
480 ;; This symlink is currently unused, but better have it point to the
482 ;; <https://lists.gnu.org/archive/html/guix-devel/2016-08/msg01641.html>.
483 (test-equal "/var/guix/gcroots/profiles is a valid symlink"
485 (marionette-eval '(readlink "/var/guix/gcroots/profiles")
488 (test-equal "guix-daemon set-http-proxy action"
490 (marionette-eval '(with-shepherd-action 'guix-daemon
491 ('set-http-proxy "http://localhost:8118")
496 (test-equal "guix-daemon set-http-proxy action, clear"
498 (marionette-eval '(with-shepherd-action 'guix-daemon
504 (test-assert "screendump"
507 (string-append #$output "/tty1.ppm")))
509 (string-append "screendump " capture) marionette)
510 (file-exists? capture))))
512 (test-assert "screen text"
513 (wait-for-screen-text
516 ;; Check whether the welcome message and shell prompt are
517 ;; displayed. Note: OCR confuses "y" and "V" for instance, so
518 ;; we cannot reliably match the whole text.
519 (and (string-contains text "This is the GNU")
520 (string-contains text
523 #$(operating-system-host-name os)))))
524 #:ocr #$(file-append ocrad "/bin/ocrad")))
528 (gexp->derivation name test))
530 (define %test-basic-os
534 "Instrument %SIMPLE-OS, run it in a VM, and run a series of basic
535 functionality tests.")
537 (let* ((os (marionette-operating-system
539 #:imported-modules '((gnu services herd)
540 (guix combinators))))
541 (vm (virtual-machine os)))
542 ;; XXX: Add call to 'virtualized-operating-system' to get the exact same
543 ;; set of services as the OS produced by
544 ;; 'system-qemu-image/shared-store-script'.
545 (run-basic-test (virtualized-operating-system os '())
553 (define (run-halt-test vm)
554 ;; As reported in <http://bugs.gnu.org/26931>, running tmux would previously
555 ;; lead the 'stop' method of 'user-processes' to an infinite loop, with the
556 ;; tmux server process as a zombie that remains in the list of processes.
557 ;; This test reproduces this scenario.
559 (with-imported-modules '((gnu build marionette))
561 (use-modules (gnu build marionette))
564 (make-marionette '(#$vm)))
567 #$(file-append ocrad "/bin/ocrad"))
569 ;; Wait for tty1 and log in.
570 (marionette-eval '(begin
571 (use-modules (gnu services herd))
572 (start-service 'term-tty1))
574 (marionette-type "root\n" marionette)
576 ;; Start tmux and wait for it to be ready.
577 (marionette-type "tmux new-session 'echo 1 > /ready; bash'\n"
579 (wait-for-file "/ready" marionette)
581 ;; Make sure to stop the test after a while.
582 (sigaction SIGALRM (lambda _
583 (format (current-error-port)
584 "FAIL: Time is up, but VM still running.\n")
588 ;; Get debugging info.
589 (marionette-eval '(current-output-port
590 (open-file "/dev/console" "w0"))
592 (marionette-eval '(system* #$(file-append procps "/bin/ps")
593 "-eo" "pid,ppid,stat,comm")
596 ;; See if 'halt' actually works.
597 (marionette-eval '(system* "/run/current-system/profile/sbin/halt")
600 ;; If we reach this line, that means the VM was properly stopped in
603 (call-with-output-file #$output
605 (display "success!" port))))))
607 (gexp->derivation "halt" test))
613 "Use the 'halt' command and make sure it succeeds and does not get stuck
614 in a loop. See <http://bugs.gnu.org/26931>.")
616 (let ((os (marionette-operating-system
619 (packages (cons tmux %base-packages)))
620 #:imported-modules '((gnu services herd)
621 (guix combinators)))))
622 (run-halt-test (virtual-machine os))))))
626 ;;; Root cleanly unmounted.
629 (define (run-root-unmount-test os)
631 (image (operating-system os)
632 (format 'compressed-qcow2)
635 (partition-table-type 'mbr)
639 (offset (* 512 2048)) ;leave room for GRUB
641 (label "root-under-test")))))) ;max 16 characters!
644 (marionette-operating-system
647 (source-module-closure '((guix build syscalls)
648 (gnu build file-systems)))))
651 (with-imported-modules (source-module-closure
652 '((gnu build marionette)
655 (use-modules (gnu build marionette)
661 "/tmp/writable-image.qcow2")
663 (define (test-system-marionette)
664 ;; Return a marionette on a system where we'll run 'halt'.
665 (invoke #$(file-append qemu-minimal "/bin/qemu-img")
666 "create" "-f" "qcow2" image "3G"
667 "-b" #$(system-image test-image) "-F" "qcow2")
669 `(,(string-append #$qemu-minimal "/bin/" (qemu-command))
670 ,@(if (file-exists? "/dev/kvm")
674 "-m" "1024" ;memory size, in MiB
675 "-drive" ,(format #f "file=~a,if=virtio" image))))
678 ;; Size of the /witness file.
681 (test-runner-current (system-test-runner #$output))
682 (test-begin "root-unmount")
684 (let ((marionette (test-system-marionette)))
685 (test-assert "file created"
686 (marionette-eval `(begin
687 (use-modules (guix build utils))
688 (call-with-output-file "/witness"
690 (call-with-input-file "/dev/random"
692 (dump-port input port
697 (marionette-eval '(system* "/run/current-system/profile/sbin/halt")
700 (display "waiting for marionette to complete...")
702 (false-if-exception (waitpid (marionette-pid marionette)))
706 ;; Remove the sockets used by the marionette above to avoid
708 (for-each delete-file
709 (find-files "/tmp" (lambda (file stat)
710 (eq? (stat:type stat) 'socket))))
712 ;; Now boot another system and check whether the root file system of
713 ;; the first one was cleanly unmounted.
716 (make-marionette (list #$(virtual-machine observer-os)
718 (format #f "file=~a,if=virtio" image)))))
719 (test-assert "partitions"
720 (marionette-eval '(begin
721 (use-modules (gnu build file-systems))
725 (test-assert "partition found"
726 (marionette-eval '(find-partition-by-label "root-under-test")
729 (test-assert "root file system is clean"
730 (marionette-eval '(cleanly-unmounted-ext2?
731 (find-partition-by-label "root-under-test"))
734 (test-equal "root file system contains /witness"
736 (let ((files (marionette-eval
738 (use-modules (guix build syscalls)
740 (mount (find-partition-by-label "root-under-test")
741 "/mnt" "ext4" MS_RDONLY)
744 (if (member "witness" files)
745 (marionette-eval '(stat:size (stat "/mnt/witness"))
751 (gexp->derivation "root-unmount" test))
753 (define %test-root-unmount
755 (name "root-unmount")
757 "Make sure the root file system is cleanly unmounted when the system is
760 (let ((os (marionette-operating-system %simple-os)))
761 (run-root-unmount-test os)))))
765 ;;; Cleanup of /tmp, /var/run, etc.
769 (simple-operating-system
770 (simple-service 'dirty-things
772 (let ((script (plain-file
773 "create-utf8-file.sh"
775 "echo $0: dirtying /tmp...\n"
778 "exec touch /tmp/λαμβδα"))))
779 (with-imported-modules '((guix build utils))
782 #$(file-append coreutils "/bin"))
783 (invoke #$(file-append bash "/bin/sh")
786 (define (run-cleanup-test name)
788 (marionette-operating-system %cleanup-os
789 #:imported-modules '((gnu services herd)
790 (guix combinators))))
792 (with-imported-modules '((gnu build marionette))
794 (use-modules (gnu build marionette)
799 (make-marionette (list #$(virtual-machine os))))
801 (test-runner-current (system-test-runner #$output))
802 (test-begin "cleanup")
804 (test-assert "dirty service worked"
805 (marionette-eval '(file-exists? "/witness") marionette))
807 (test-equal "/tmp cleaned up"
809 (marionette-eval '(begin
810 (use-modules (ice-9 ftw))
816 (gexp->derivation "cleanup" test))
818 (define %test-cleanup
819 ;; See <https://bugs.gnu.org/26353>.
822 (description "Make sure the 'cleanup' service can remove files with
823 non-ASCII names from /tmp.")
824 (value (run-cleanup-test name))))
832 ;; System with an mcron service, with one mcron job for "root" and one mcron
833 ;; job for an unprivileged user.
834 (let ((job1 #~(job '(next-second '(0 5 10 15 20 25 30 35 40 45 50 55))
836 (unless (file-exists? "witness")
837 (call-with-output-file "witness"
839 (display (list (getuid) (getgid)) port)))))))
840 (job2 #~(job next-second-from
842 (call-with-output-file "witness"
844 (display (list (getuid) (getgid)) port))))
846 (job3 #~(job next-second-from ;to test $PATH
847 "touch witness-touch")))
848 (simple-operating-system
849 (service mcron-service-type
850 (mcron-configuration (jobs (list job1 job2 job3)))))))
852 (define (run-mcron-test name)
854 (marionette-operating-system
856 #:imported-modules '((gnu services herd)
857 (guix combinators))))
860 (with-imported-modules '((gnu build marionette))
862 (use-modules (gnu build marionette)
867 (make-marionette (list #$(virtual-machine os))))
869 (test-runner-current (system-test-runner #$output))
872 (test-assert "service running"
875 (use-modules (gnu services herd))
876 (start-service 'mcron))
879 ;; Make sure root's mcron job runs, has its cwd set to "/root", and
880 ;; runs with the right UID/GID.
881 (test-equal "root's job"
883 (wait-for-file "/root/witness" marionette))
885 ;; Likewise for Alice's job. We cannot know what its GID is since
886 ;; it's chosen by 'groupadd', but it's strictly positive.
887 (test-assert "alice's job"
888 (match (wait-for-file "/home/alice/witness" marionette)
892 ;; Last, the job that uses a command; allows us to test whether
894 (test-equal "root's job with command"
896 (wait-for-file "/root/witness-touch" marionette
897 #:read '(@ (ice-9 rdelim) read-string)))
899 ;; Make sure the 'schedule' action is accepted.
900 (test-equal "schedule action"
902 (marionette-eval '(with-shepherd-action 'mcron ('schedule) result
908 (gexp->derivation name test))
913 (description "Make sure the mcron service works as advertised.")
914 (value (run-mcron-test name))))
918 ;;; Avahi and NSS-mDNS.
924 (name-service-switch %mdns-host-lookup-nss)
925 (services (cons* (service avahi-service-type
926 (avahi-configuration (debug? #t)))
928 (service dhcp-client-service-type) ;needed for multicast
930 ;; Enable heavyweight debugging output.
931 (modify-services (operating-system-user-services
933 (nscd-service-type config
934 => (nscd-configuration
937 (log-file "/dev/console")))
938 (syslog-service-type config
940 (syslog-configuration
945 "*.* /dev/console\n")))))))))
947 (define (run-nss-mdns-test)
948 ;; Test resolution of '.local' names via libc. Start the marionette service
949 ;; *after* nscd. Failing to do that, libc will try to connect to nscd,
950 ;; fail, then never try again (see '__nss_not_use_nscd_hosts' in libc),
951 ;; leading to '.local' resolution failures.
953 (marionette-operating-system
955 #:requirements '(nscd)
956 #:imported-modules '((gnu services herd)
957 (guix combinators))))
959 (define mdns-host-name
960 (string-append (operating-system-host-name os)
964 (with-imported-modules '((gnu build marionette))
966 (use-modules (gnu build marionette)
972 (make-marionette (list #$(virtual-machine os))))
977 (test-runner-current (system-test-runner))
980 (test-assert "nscd PID file is created"
983 (use-modules (gnu services herd))
984 (start-service 'nscd))
987 (test-assert "nscd is listening on its socket"
989 ;; XXX: Work around a race condition in nscd: nscd creates its
990 ;; PID file before it is listening on its socket.
991 '(let ((sock (socket PF_UNIX SOCK_STREAM 0)))
995 (connect sock AF_UNIX "/var/run/nscd/socket")
997 (format #t "nscd is ready~%")
1000 (format #t "waiting for nscd...~%")
1005 (test-assert "avahi is running"
1008 (use-modules (gnu services herd))
1009 (start-service 'avahi-daemon))
1012 (test-assert "network is up"
1015 (use-modules (gnu services herd))
1016 (start-service 'networking))
1019 (test-equal "avahi-resolve-host-name"
1023 "/run/current-system/profile/bin/avahi-resolve-host-name"
1024 "-v" #$mdns-host-name)
1027 (test-equal "avahi-browse"
1030 '(system* "/run/current-system/profile/bin/avahi-browse" "-avt")
1033 (test-assert "getaddrinfo .local"
1034 ;; Wait for the 'avahi-daemon' service and perform a resolution.
1035 (match (marionette-eval
1036 '(getaddrinfo #$mdns-host-name)
1038 (((? vector? addrinfos) ..1)
1039 (pk 'getaddrinfo addrinfos)
1040 (and (any (lambda (ai)
1041 (= AF_INET (addrinfo:fam ai)))
1044 (= AF_INET6 (addrinfo:fam ai)))
1047 (test-assert "gethostbyname .local"
1048 (match (pk 'gethostbyname
1049 (marionette-eval '(gethostbyname #$mdns-host-name)
1052 (and (string=? (hostent:name result) #$mdns-host-name)
1053 (= (hostent:addrtype result) AF_INET)))))
1058 (gexp->derivation "nss-mdns" test))
1060 (define %test-nss-mdns
1064 "Test Avahi's multicast-DNS implementation, and in particular, test its
1065 glibc name service switch (NSS) module.")
1066 (value (run-nss-mdns-test))))