unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon South <simon@simonsouth.net>
To: 41606@debbugs.gnu.org
Subject: [bug#41606] [PATCH] tests: Allow passing on systems without support for swap devices.
Date: Fri, 29 May 2020 14:24:46 -0400	[thread overview]
Message-ID: <87y2palhu9.fsf@mercury.simonsouth.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

The attached patch allows Guix's test suite to pass (and thus, the
"guix" package to be built) on systems that lack support for swap
devices; that is, systems that not only do not have a swap device
enabled but do not have even support for memory paging built into the
kernel (e.g. Linux built without CONFIG_SWAP). This might be the case
for a small home server, for example, on which the workload is
predictable 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 in
tests/syscalls.scm to accept this as a valid return value.

--
Simon South
simon@simonsouth.net


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-tests-Allow-passing-on-systems-without-support-for-s.patch --]
[-- Type: text/x-patch, Size: 1414 bytes --]

From 39507094be62417f76ebd18a0724966ededc7166 Mon Sep 17 00:00:00 2001
From: Simon South <simon@simonsouth.net>
Date: Fri, 29 May 2020 13:53:46 -0400
Subject: [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(-)

diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 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


             reply	other threads:[~2020-05-29 18:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 18:24 Simon South [this message]
2020-06-02  8:28 ` bug#41606: [PATCH] tests: Allow passing on systems without support for swap devices Mathieu Othacehe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2palhu9.fsf@mercury.simonsouth.net \
    --to=simon@simonsouth.net \
    --cc=41606@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).