aboutsummaryrefslogtreecommitdiff
path: root/tests/syscalls.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-04-25 17:18:58 +0200
committerLudovic Courtès <ludo@gnu.org>2016-04-25 23:27:09 +0200
commita1f708787d08e567da6118bacc481219884296ca (patch)
treef52aae575d806926e1349fc4f268ac9d5bd78618 /tests/syscalls.scm
parent785cfa8791b0d683830245f119ee6fd42e5356d3 (diff)
downloadpatches-a1f708787d08e567da6118bacc481219884296ca.tar
patches-a1f708787d08e567da6118bacc481219884296ca.tar.gz
syscalls: Add 'statfs'.
* guix/build/syscalls.scm (<file-system>): New record type. (fsword): New macro. (%statfs): New C struct. (statfs): New procedure.
Diffstat (limited to 'tests/syscalls.scm')
-rw-r--r--tests/syscalls.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 24ea8f5e60..895f90f4d8 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -78,6 +78,21 @@
(rmdir dir)
#t))))
+(test-equal "statfs, ENOENT"
+ ENOENT
+ (catch 'system-error
+ (lambda ()
+ (statfs "/does-not-exist"))
+ (compose system-error-errno list)))
+
+(test-assert "statfs"
+ (let ((fs (statfs "/")))
+ (and (file-system? fs)
+ (> (file-system-block-size fs) 0)
+ (>= (file-system-blocks-available fs) 0)
+ (>= (file-system-blocks-free fs)
+ (file-system-blocks-available fs)))))
+
(define (user-namespace pid)
(string-append "/proc/" (number->string pid) "/ns/user"))