From cb21c14b0ae1f4c9fcad4927e3b2eb0c06d7b018 Mon Sep 17 00:00:00 2001 From: Simon South Date: Fri, 29 May 2020 13:53:46 -0400 Subject: tests: Allow passing on systems without support for swap devices. * tests/syscalls.scm ("swapon", "swapoff"): Accept ENOSYS as a valid result. Signed-off-by: Mathieu Othacehe --- tests/syscalls.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tests/syscalls.scm') diff --git a/tests/syscalls.scm b/tests/syscalls.scm index 3823de7c1e..6098a09437 100644 --- a/tests/syscalls.scm +++ b/tests/syscalls.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2015 David Thompson +;;; Copyright © 2020 Simon South ;;; ;;; This file is part of GNU Guix. ;;; @@ -73,21 +74,21 @@ ;; Note: 'utimensat' does not change 'ctime'. (list (stat:mtime st) (stat:atime st))))) -(test-assert "swapon, ENOENT/EPERM" +(test-assert "swapon, ENOSYS/ENOENT/EPERM" (catch 'system-error (lambda () (swapon "/does-not-exist") #f) (lambda args - (memv (system-error-errno args) (list EPERM ENOENT))))) + (memv (system-error-errno args) (list EPERM ENOENT ENOSYS))))) -(test-assert "swapoff, ENOENT/EINVAL/EPERM" +(test-assert "swapoff, ENOSYS/ENOENT/EINVAL/EPERM" (catch 'system-error (lambda () (swapoff "/does-not-exist") #f) (lambda args - (memv (system-error-errno args) (list EPERM EINVAL ENOENT))))) + (memv (system-error-errno args) (list EPERM EINVAL ENOENT ENOSYS))))) (test-assert "mkdtemp!" (let* ((tmp (or (getenv "TMPDIR") "/tmp")) -- cgit 1.4.1 From ea924134f819eef072ba7df9080d39de97fd73e6 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 5 Jun 2020 12:28:12 +0200 Subject: tests: syscall: Support file-systems without extended attributes. * tests/syscalls.scm (setxattr): Catch ENOTSUP that can be raised if the file-system does not support extended user attributes. --- tests/syscalls.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests/syscalls.scm') diff --git a/tests/syscalls.scm b/tests/syscalls.scm index 6098a09437..6acaa0b131 100644 --- a/tests/syscalls.scm +++ b/tests/syscalls.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2015 David Thompson ;;; Copyright © 2020 Simon South +;;; Copyright © 2020 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -276,8 +277,14 @@ (let ((key "user.translator") (value "/hurd/pfinet\0") (file (open-file temp-file "w0"))) - (setxattr temp-file key value) - (string=? (getxattr temp-file key) value))) + (catch 'system-error + (lambda () + (setxattr temp-file key value) + (string=? (getxattr temp-file key) value)) + (lambda args + ;; Accept ENOTSUP, if the file-system does not support extended user + ;; attributes. + (memv (system-error-errno args) (list ENOTSUP)))))) (false-if-exception (delete-file temp-file)) (test-equal "fcntl-flock wait" -- cgit 1.4.1