summaryrefslogtreecommitdiff
path: root/tests/syscalls.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/syscalls.scm')
-rw-r--r--tests/syscalls.scm23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index e4ef32c522..8db45b41b6 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;;
;;; This file is part of GNU Guix.
@@ -441,6 +441,27 @@
(> (terminal-columns (open-input-string "Join us now, share the software!"))
0))
+(test-assert "utmpx-entries"
+ (match (utmpx-entries)
+ (((? utmpx? entries) ...)
+ (every (lambda (entry)
+ (match (utmpx-user entry)
+ ((? string?)
+ (or (eqv? (login-type BOOT_TIME) (utmpx-login-type entry))
+ (> (utmpx-pid entry) 0)))
+ (#f ;might be DEAD_PROCESS
+ #t)))
+ entries))))
+
+(test-assert "read-utmpx, EOF"
+ (eof-object? (read-utmpx (%make-void-port "r"))))
+
+(unless (access? "/var/run/utmpx" O_RDONLY)
+ (test-skip 1))
+(test-assert "read-utmpx"
+ (let ((result (call-with-input-file "/var/run/utmpx" read-utmpx)))
+ (or (utmpx? result) (eof-object? result))))
+
(test-end)
(false-if-exception (delete-file temp-file))