summary refs log tree commit diff
path: root/tests/syscalls.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-18 20:19:56 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-18 20:19:56 +0200
commit715fc9d44d284a0c5e1ded45091eaf979aa5ecd4 (patch)
treeb13a651a1a624043348cc0d411aca5fbbe42c19a /tests/syscalls.scm
parent510f9d8624fb3440e0ec310826258d13e4f58c32 (diff)
downloadguix-715fc9d44d284a0c5e1ded45091eaf979aa5ecd4.tar.gz
syscalls: Add 'swapon' and 'swapoff'.
* guix/build/syscalls.scm (swapon, swapoff): New procedures.
* tests/syscalls.scm ("swapon, ENOENT/EPERM", "swapoff, EINVAL/EPERM"):
  New tests.
Diffstat (limited to 'tests/syscalls.scm')
-rw-r--r--tests/syscalls.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index b1dc298a14..51846d3c36 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -44,6 +44,22 @@
       ;; Both return values have been encountered in the wild.
       (memv (system-error-errno args) (list EPERM ENOENT)))))
 
+(test-assert "swapon, ENOENT/EPERM"
+  (catch 'system-error
+    (lambda ()
+      (swapon "/does-not-exist")
+      #f)
+    (lambda args
+      (memv (system-error-errno args) (list EPERM ENOENT)))))
+
+(test-assert "swapoff, EINVAL/EPERM"
+  (catch 'system-error
+    (lambda ()
+      (swapoff "/does-not-exist")
+      #f)
+    (lambda args
+      (memv (system-error-errno args) (list EPERM EINVAL)))))
+
 (test-assert "all-network-interfaces"
   (match (all-network-interfaces)
     (((? string? names) ..1)