test-name: mount, ENOENT location: /data/paul/sourceCode/guix/tests/syscalls.scm:38 source: + (test-equal + "mount, ENOENT" + ENOENT + (catch 'system-error + (lambda () + (mount "/dev/null" "/does-not-exist" "ext2") + #f) + (compose system-error-errno list))) expected-value: 2 actual-value: 2 result: PASS test-name: umount, ENOENT/EPERM location: /data/paul/sourceCode/guix/tests/syscalls.scm:46 source: + (test-assert + "umount, ENOENT/EPERM" + (catch 'system-error + (lambda () (umount "/does-not-exist") #f) + (lambda args + (memv (system-error-errno args) + (list EPERM ENOENT))))) actual-value: (1 2) result: PASS test-name: mount-points location: /data/paul/sourceCode/guix/tests/syscalls.scm:55 source: + (test-assert + "mount-points" + (any (cute member <> (mount-points)) + '("/" "/proc" "/sys" "/dev"))) actual-value: (/ /sys/kernel/security /dev/shm /run/lock /sys/fs/cgroup /sys/fs/cgroup/systemd /sys/fs/pstore /sys/fs/cgroup/memory /sys/fs/cgroup/net_cls,net_prio /sys/fs/cgroup/pids /sys/fs/cgroup/cpuset /sys/fs/cgroup/cpu,cpuacct /sys/fs/cgroup/blkio /sys/fs/cgroup/devices /sys/fs/cgroup/freezer /sys/fs/cgroup/perf_event /sys/fs/cgroup/hugetlb /proc/sys/fs/binfmt_misc /sys/kernel/debug /dev/mqueue /dev/hugepages /run/rpc_pipefs /sys/fs/fuse/connections /data /run/cgmanager/fs /run/user/1000 /run/user/1000/gvfs) result: PASS test-name: swapon, ENOENT/EPERM location: /data/paul/sourceCode/guix/tests/syscalls.scm:61 source: + (test-assert + "swapon, ENOENT/EPERM" + (catch 'system-error + (lambda () (swapon "/does-not-exist") #f) + (lambda args + (memv (system-error-errno args) + (list EPERM ENOENT))))) actual-value: (1 2) result: PASS test-name: swapoff, ENOENT/EINVAL/EPERM location: /data/paul/sourceCode/guix/tests/syscalls.scm:69 source: + (test-assert + "swapoff, ENOENT/EINVAL/EPERM" + (catch 'system-error + (lambda () (swapoff "/does-not-exist") #f) + (lambda args + (memv (system-error-errno args) + (list EPERM EINVAL ENOENT))))) actual-value: (1 22 2) result: PASS test-name: mkdtemp! location: /data/paul/sourceCode/guix/tests/syscalls.scm:77 source: + (test-assert + "mkdtemp!" + (let* ((tmp (or (getenv "TMPDIR") "/tmp")) + (dir (mkdtemp! + (string-append tmp "/guix-test-XXXXXX")))) + (and (file-exists? dir) (begin (rmdir dir) #t)))) actual-value: #t result: PASS test-name: statfs, ENOENT location: /data/paul/sourceCode/guix/tests/syscalls.scm:85 source: + (test-equal + "statfs, ENOENT" + ENOENT + (catch 'system-error + (lambda () (statfs "/does-not-exist")) + (compose system-error-errno list))) expected-value: 2 actual-value: 2 result: PASS test-name: statfs location: /data/paul/sourceCode/guix/tests/syscalls.scm:92 source: + (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))))) actual-value: #t result: PASS test-name: clone location: /data/paul/sourceCode/guix/tests/syscalls.scm:109 source: + (test-assert + "clone" + (match (clone (logior CLONE_NEWUSER SIGCHLD)) + (0 (primitive-exit 42)) + (pid (and (not (equal? + (readlink (user-namespace pid)) + (readlink (user-namespace (getpid))))) + (match (waitpid pid) + ((_ . status) (= 42 (status:exit-val status)))))))) actual-value: #t result: PASS test-name: setns location: /data/paul/sourceCode/guix/tests/syscalls.scm:122 source: + (test-assert + "setns" + (match (clone (logior CLONE_NEWUSER SIGCHLD)) + (0 (primitive-exit 0)) + (clone-pid + (match (pipe) + ((in . out) + (match (primitive-fork) + (0 + (close in) + (call-with-input-file + (user-namespace clone-pid) + (lambda (port) (setns (port->fdes port) 0))) + (write 'done out) + (close out) + (primitive-exit 0)) + (fork-pid + (close out) + (read in) + (let ((result + (and (equal? + (readlink + (user-namespace clone-pid)) + (readlink + (user-namespace fork-pid)))))) + (waitpid clone-pid) + (waitpid fork-pid) + result)))))))) actual-value: #t result: PASS test-name: pivot-root location: /data/paul/sourceCode/guix/tests/syscalls.scm:154 source: + (test-equal + "pivot-root" + #t + (match (pipe) + ((in . out) + (match (clone (logior CLONE_NEWUSER CLONE_NEWNS SIGCHLD)) + (0 + (dynamic-wind + (const #t) + (lambda () + (close in) + (call-with-temporary-directory + (lambda (root) + (let ((put-old (string-append root "/real-root"))) + (mount "none" root "tmpfs") + (mkdir put-old) + (call-with-output-file + (string-append root "/test") + (lambda (port) (display "testing\n" port))) + (pivot-root root put-old) + (write (file-exists? "/test") out) + (close out))))) + (lambda () (primitive-exit 0)))) + (pid (close out) + (let ((result (read in))) + (close in) + (and (zero? (match (waitpid pid) + ((_ . status) + (status:exit-val status)))) + (eq? #t result)))))))) expected-value: #t actual-value: #f result: FAIL test-name: fcntl-flock wait location: /data/paul/sourceCode/guix/tests/syscalls.scm:188 source: + (test-equal + "fcntl-flock wait" + 42 + (let ((file (open-file temp-file "w0b"))) + (fcntl-flock file 'write-lock) + (match (primitive-fork) + (0 + (dynamic-wind + (const #t) + (lambda () + (let ((file (open-file temp-file "r0b"))) + (fcntl-flock file 'read-lock) + (primitive-exit (read file))) + (primitive-exit 1)) + (lambda () (primitive-exit 2)))) + (pid (display "hello, world!" file) + (force-output file) + (sleep 1) + (seek file 0 SEEK_SET) + (truncate-file file 0) + (write 42 file) + (force-output file) + (fcntl-flock file 'unlock) + (match (waitpid pid) + ((_ . status) + (let ((result (status:exit-val status))) + (close-port file) + result))))))) expected-value: 42 actual-value: 42 result: PASS test-name: fcntl-flock non-blocking location: /data/paul/sourceCode/guix/tests/syscalls.scm:227 source: + (test-equal + "fcntl-flock non-blocking" + EAGAIN + (match (pipe) + ((input . output) + (match (primitive-fork) + (0 + (dynamic-wind + (const #t) + (lambda () + (close-port output) + (read-char input) + (let ((file (open-file temp-file "w0"))) + (catch 'flock-error + (lambda () + (fcntl-flock file 'write-lock #:wait? #f)) + (lambda (key errno) + (primitive-exit (pk 'errno errno))))) + (primitive-exit -1)) + (lambda () (primitive-exit -2)))) + (pid (close-port input) + (let ((file (open-file temp-file "w0"))) + (fcntl-flock file 'write-lock) + (write 'green-light output) + (force-output output) + (match (waitpid pid) + ((_ . status) + (let ((result (status:exit-val status))) + (fcntl-flock file 'unlock) + (close-port file) + result))))))))) ;;; (errno 11) expected-value: 11 actual-value: 11 result: PASS test-name: all-network-interface-names location: /data/paul/sourceCode/guix/tests/syscalls.scm:269 source: + (test-assert + "all-network-interface-names" + (match (all-network-interface-names) + (((? string? names) ..1) (member "lo" names)))) actual-value: (lo wlan0 eth0) result: PASS test-name: network-interface-names location: /data/paul/sourceCode/guix/tests/syscalls.scm:274 source: + (test-assert + "network-interface-names" + (match (network-interface-names) + (((? string? names) ..1) + (lset<= + string=? + names + (all-network-interface-names))))) actual-value: #t result: PASS test-name: network-interface-flags location: /data/paul/sourceCode/guix/tests/syscalls.scm:279 source: + (test-assert + "network-interface-flags" + (let* ((sock (socket AF_INET SOCK_STREAM 0)) + (flags (network-interface-flags sock "lo"))) + (close-port sock) + (and (not (zero? (logand flags IFF_LOOPBACK))) + (not (zero? (logand flags IFF_UP)))))) actual-value: #t result: PASS test-name: loopback-network-interface? location: /data/paul/sourceCode/guix/tests/syscalls.scm:286 source: + (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))))) expected-value: 19 actual-value: 19 result: PASS test-name: set-network-interface-flags location: /data/paul/sourceCode/guix/tests/syscalls.scm:297 source: + (test-assert + "set-network-interface-flags" + (let ((sock (socket AF_INET SOCK_STREAM 0))) + (catch 'system-error + (lambda () + (set-network-interface-flags sock "lo" IFF_UP)) + (lambda args + (close-port sock) + (memv (system-error-errno args) + (list EPERM EACCES)))))) actual-value: (1 13) result: PASS test-name: network-interface-address lo location: /data/paul/sourceCode/guix/tests/syscalls.scm:307 source: + (test-equal + "network-interface-address lo" + (make-socket-address + AF_INET + (inet-pton AF_INET "127.0.0.1") + 0) + (let* ((sock (socket AF_INET SOCK_STREAM 0)) + (addr (network-interface-address sock "lo"))) + (close-port sock) + addr)) expected-value: #(2 2130706433 0) actual-value: #(2 2130706433 0) result: PASS test-name: set-network-interface-address location: /data/paul/sourceCode/guix/tests/syscalls.scm:315 source: + (test-assert + "set-network-interface-address" + (let ((sock (socket AF_INET SOCK_STREAM 0))) + (catch 'system-error + (lambda () + (set-network-interface-address + sock + "nonexistent" + (make-socket-address + AF_INET + (inet-pton AF_INET "127.12.14.15") + 0))) + (lambda args + (close-port sock) + (memv (system-error-errno args) + (list EPERM EACCES)))))) actual-value: (1 13) result: PASS test-name: network-interface-netmask lo location: /data/paul/sourceCode/guix/tests/syscalls.scm:329 source: + (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)) expected-value: #(2 4278190080 0) actual-value: #(2 4278190080 0) result: PASS test-name: set-network-interface-netmask location: /data/paul/sourceCode/guix/tests/syscalls.scm:337 source: + (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)))))) actual-value: (1 13) result: PASS test-name: network-interfaces returns one or more interfaces location: /data/paul/sourceCode/guix/tests/syscalls.scm:350 source: + (test-equal + "network-interfaces returns one or more interfaces" + '(#t #t #t) + (match (network-interfaces) + ((interfaces ..1) + (list (every interface? interfaces) + (every string? (map interface-name interfaces)) + (every (lambda (sockaddr) + (or (vector? sockaddr) (not sockaddr))) + (map interface-address interfaces)))))) expected-value: (#t #t #t) actual-value: (#t #t #t) result: PASS test-name: network-interfaces returns "lo" location: /data/paul/sourceCode/guix/tests/syscalls.scm:362 source: + (test-equal + "network-interfaces returns \"lo\"" + (list #t + (make-socket-address + AF_INET + (inet-pton AF_INET "127.0.0.1") + 0)) + (match (filter + (lambda (interface) + (string=? "lo" (interface-name interface))) + (network-interfaces)) + ((loopbacks ..1) + (list (every (lambda (lo) + (not (zero? (logand + IFF_LOOPBACK + (interface-flags lo))))) + loopbacks) + (match (find (lambda (lo) + (= AF_INET + (sockaddr:fam (interface-address lo)))) + loopbacks) + (#f #f) + (lo (interface-address lo))))))) expected-value: (#t #(2 2130706433 0)) actual-value: (#t #(2 2130706433 0)) result: PASS test-name: add-network-route/gateway location: /data/paul/sourceCode/guix/tests/syscalls.scm:378 source: + (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)))))) actual-value: (1 13) result: PASS test-name: delete-network-route location: /data/paul/sourceCode/guix/tests/syscalls.scm:391 source: + (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)))))) actual-value: (1 13) result: PASS test-name: tcgetattr ENOTTY location: /data/paul/sourceCode/guix/tests/syscalls.scm:401 source: + (test-equal + "tcgetattr ENOTTY" + ENOTTY + (catch 'system-error + (lambda () + (call-with-input-file + "/dev/null" + (lambda (port) (tcgetattr (fileno port))))) + (compose system-error-errno list))) expected-value: 25 actual-value: 25 result: PASS test-name: tcgetattr location: /data/paul/sourceCode/guix/tests/syscalls.scm:415 source: + (test-assert + "tcgetattr" + (let ((termios (tcgetattr 0))) + (and (termios? termios) + (> (termios-input-speed termios) 0) + (> (termios-output-speed termios) 0)))) result: SKIP test-name: tcsetattr location: /data/paul/sourceCode/guix/tests/syscalls.scm:421 source: + (test-assert + "tcsetattr" + (let ((first (tcgetattr 0))) + (tcsetattr 0 (tcsetattr-action TCSANOW) first) + (equal? first (tcgetattr 0)))) result: SKIP test-name: terminal-window-size ENOTTY location: /data/paul/sourceCode/guix/tests/syscalls.scm:426 source: + (test-assert + "terminal-window-size ENOTTY" + (call-with-input-file + "/dev/null" + (lambda (port) + (catch 'system-error + (lambda () (terminal-window-size port)) + (lambda args + (memv (system-error-errno args) + (list ENOTTY EINVAL))))))) actual-value: (25 22) result: PASS test-name: terminal-columns location: /data/paul/sourceCode/guix/tests/syscalls.scm:437 source: + (test-assert + "terminal-columns" + (> (terminal-columns) 0)) actual-value: #t result: PASS test-name: terminal-columns non-file port location: /data/paul/sourceCode/guix/tests/syscalls.scm:440 source: + (test-assert + "terminal-columns non-file port" + (> (terminal-columns + (open-input-string + "Join us now, share the software!")) + 0)) actual-value: #t result: PASS