aboutsummaryrefslogtreecommitdiff
path: root/tests/syscalls.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/syscalls.scm')
-rw-r--r--tests/syscalls.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index fa6b67bf39..c3550ac31a 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -48,6 +48,23 @@
(((? string? names) ..1)
(member "lo" names))))
+(test-assert "network-interface-flags"
+ (let* ((sock (socket SOCK_STREAM AF_INET 0))
+ (flags (network-interface-flags sock "lo")))
+ (close-port sock)
+ (and (not (zero? (logand flags IFF_LOOPBACK)))
+ (not (zero? (logand flags IFF_UP))))))
+
+(test-equal "loopback-network-interface?"
+ ENODEV
+ (and (loopback-network-interface? "lo")
+ (catch 'system-error
+ (lambda ()
+ (loopback-network-interface? "nonexistent")
+ #f)
+ (lambda args
+ (system-error-errno args)))))
+
(test-end)