summaryrefslogtreecommitdiff
path: root/tests/syscalls.scm
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2016-11-23 00:11:30 -0500
committerLeo Famulari <leo@famulari.name>2016-11-23 00:11:30 -0500
commitde76f0a45bad2654cc2561b463e3d6ec4d96c398 (patch)
treee1dcd0a33de2d8dffaa9d4c5068fc1fd0f149734 /tests/syscalls.scm
parentc70047f12d7e9d5138a1a217d0995882a8c5f459 (diff)
parent08b3e4a97066c9baaf39e3df7c2dd9c39e693ead (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'tests/syscalls.scm')
-rw-r--r--tests/syscalls.scm45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/syscalls.scm b/tests/syscalls.scm
index 9eb19f9c80..e4ef32c522 100644
--- a/tests/syscalls.scm
+++ b/tests/syscalls.scm
@@ -326,6 +326,27 @@
;; We get EPERM with Linux 3.18ish and EACCES with 2.6.32.
(memv (system-error-errno args) (list EPERM EACCES))))))
+(test-equal "network-interface-netmask lo"
+ (make-socket-address AF_INET (inet-pton AF_INET "255.0.0.0") 0)
+ (let* ((sock (socket AF_INET SOCK_STREAM 0))
+ (addr (network-interface-netmask sock "lo")))
+ (close-port sock)
+ addr))
+
+(test-skip (if (zero? (getuid)) 1 0))
+(test-assert "set-network-interface-netmask"
+ (let ((sock (socket AF_INET SOCK_STREAM 0)))
+ (catch 'system-error
+ (lambda ()
+ (set-network-interface-netmask sock "nonexistent"
+ (make-socket-address
+ AF_INET
+ (inet-pton AF_INET "255.0.0.0")
+ 0)))
+ (lambda args
+ (close-port sock)
+ (memv (system-error-errno args) (list EPERM EACCES))))))
+
(test-equal "network-interfaces returns one or more interfaces"
'(#t #t #t)
(match (network-interfaces)
@@ -353,6 +374,30 @@
(#f #f)
(lo (interface-address lo)))))))
+(test-skip (if (zero? (getuid)) 1 0))
+(test-assert "add-network-route/gateway"
+ (let ((sock (socket AF_INET SOCK_STREAM 0))
+ (gateway (make-socket-address AF_INET
+ (inet-pton AF_INET "192.168.0.1")
+ 0)))
+ (catch 'system-error
+ (lambda ()
+ (add-network-route/gateway sock gateway))
+ (lambda args
+ (close-port sock)
+ (memv (system-error-errno args) (list EPERM EACCES))))))
+
+(test-skip (if (zero? (getuid)) 1 0))
+(test-assert "delete-network-route"
+ (let ((sock (socket AF_INET SOCK_STREAM 0))
+ (destination (make-socket-address AF_INET INADDR_ANY 0)))
+ (catch 'system-error
+ (lambda ()
+ (delete-network-route sock destination))
+ (lambda args
+ (close-port sock)
+ (memv (system-error-errno args) (list EPERM EACCES))))))
+
(test-equal "tcgetattr ENOTTY"
ENOTTY
(catch 'system-error