From 4d54785c69602b0714b3f9021b9bf6a5d619d40c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 14 Sep 2014 22:56:12 +0200 Subject: syscalls: Add 'all-network-interfaces'. * guix/build/syscalls.scm (network-interfaces): Update docstring. (%interface-line): New variable. (all-network-interfaces): New procedure. * tests/syscalls.scm ("all-network-interfaces"): New test. ("network-interfaces"): Change to make sure the result is a subset of (all-network-interfaces). --- tests/syscalls.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/syscalls.scm') diff --git a/tests/syscalls.scm b/tests/syscalls.scm index c3550ac31a..b1dc298a14 100644 --- a/tests/syscalls.scm +++ b/tests/syscalls.scm @@ -18,6 +18,7 @@ (define-module (test-syscalls) #:use-module (guix build syscalls) + #:use-module (srfi srfi-1) #:use-module (srfi srfi-64) #:use-module (ice-9 match)) @@ -43,10 +44,15 @@ ;; Both return values have been encountered in the wild. (memv (system-error-errno args) (list EPERM ENOENT))))) +(test-assert "all-network-interfaces" + (match (all-network-interfaces) + (((? string? names) ..1) + (member "lo" names)))) + (test-assert "network-interfaces" (match (network-interfaces) (((? string? names) ..1) - (member "lo" names)))) + (lset<= string=? names (all-network-interfaces))))) (test-assert "network-interface-flags" (let* ((sock (socket SOCK_STREAM AF_INET 0)) -- cgit 1.4.1