[PATCH] tests: Allow passing on systems without support for swap devices.

DoneSubmitted by Simon South.
Details
2 participants
  • Mathieu Othacehe
  • Simon South
Owner
unassigned
Severity
normal
S
S
Simon South wrote on 29 May 20:24 +0200
(address . guix-patches@gnu.org)
87y2palhu9.fsf@mercury.simonsouth.net
The attached patch allows Guix's test suite to pass (and thus, the"guix" package to be built) on systems that lack support for swapdevices; that is, systems that not only do not have a swap deviceenabled but do not have even support for memory paging built into thekernel (e.g. Linux built without CONFIG_SWAP). This might be the casefor a small home server, for example, on which the workload ispredictable but memory is otherwise at a premium.
On these systems the "swapon" and "swapoff" syscalls return ENOSYS("Function not implemented"). The patch modifies the relevant tests intests/syscalls.scm to accept this as a valid return value.
--Simon Southsimon@simonsouth.net
From 39507094be62417f76ebd18a0724966ededc7166 Mon Sep 17 00:00:00 2001From: Simon South <simon@simonsouth.net>Date: Fri, 29 May 2020 13:53:46 -0400Subject: [PATCH] tests: Allow passing on systems without support for swap devices.
* tests/syscalls.scm ("swapon", "swapoff"): Accept ENOSYS as a valid result.--- tests/syscalls.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Toggle diff (32 lines)diff --git a/tests/syscalls.scm b/tests/syscalls.scmindex 3823de7c1e..2dc56b8af9 100644--- a/tests/syscalls.scm+++ b/tests/syscalls.scm@@ -73,21 +73,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"))-- 2.26.2
M
M
Mathieu Othacehe wrote on 2 Jun 10:28 +0200
(name . Simon South)(address . simon@simonsouth.net)(address . 41606-done@debbugs.gnu.org)
878sh5yiqn.fsf@gnu.org
Hello Simon,
Toggle quote (4 lines)> On these systems the "swapon" and "swapoff" syscalls return ENOSYS> ("Function not implemented"). The patch modifies the relevant tests in> tests/syscalls.scm to accept this as a valid return value.
This looks good to me. I added a copyright line for you and pushed.
Thanks,
Mathieu
Closed
?