summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2017-07-04 02:56:02 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2017-07-12 16:15:30 +0200
commit0bc6fe323d34aabc7f51fa80b8872a2c1770d32a (patch)
tree9bdf1dd7363cf0398683faf3d7197bbce4b54fd7 /tests
parent839ee8d5477bf75764afe18d9cb2addc7c0acf05 (diff)
downloadguix-0bc6fe323d34aabc7f51fa80b8872a2c1770d32a.tar.gz
syscalls: Add network-interface-running?
* guix/build/syscalls.scm (network-interface-running?): New variable.
Export it.
* tests/syscalls.scm: Add test.

Co-authored-by: John Darrington <jmd@gnu.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/syscalls.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 8c048e6109..2b5c4c3be1 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -361,6 +361,16 @@
          (lambda args
            (system-error-errno args)))))
 
+(test-equal "loopback-network-interface-running?"
+  ENODEV
+  (and (network-interface-running? "lo")
+       (catch 'system-error
+         (lambda ()
+           (network-interface-running? "nonexistent")
+           #f)
+         (lambda args
+           (system-error-errno args)))))
+
 (test-skip (if (zero? (getuid)) 1 0))
 (test-assert "set-network-interface-flags"
   (let ((sock (socket AF_INET SOCK_STREAM 0)))