From 0bc6fe323d34aabc7f51fa80b8872a2c1770d32a Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Tue, 4 Jul 2017 02:56:02 +0200 Subject: 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 --- tests/syscalls.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') 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))) -- cgit 1.4.1 From 578dfbe07bcd1bdef9129c6ce8529332a0abcba6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 17 Jul 2017 23:21:55 +0200 Subject: gexp: 'ungexp-splicing' properly accounts for nested native inputs. Previously, (gexp-native-inputs #~#$@(list #~#+foo)) would return '(). This is a followup to 5b14a7902c58d9fb7923f9e16871f549fbe59b6e. * guix/gexp.scm (gexp-inputs)[add-reference-inputs]: In the list case, remove 'if' around 'fold-right'. In 'map' lambda, always inherit N?. * tests/gexp.scm ("gexp list splicing + ungexp-splicing"): New test. --- guix/gexp.scm | 20 +++++++++++--------- tests/gexp.scm | 8 ++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/guix/gexp.scm b/guix/gexp.scm index d9c4cb461e..2094c495d6 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -706,15 +706,17 @@ references; otherwise, return only non-native references." (cons `(,thing ,output) result) result)) (($ (lst ...) output n?) - (if (eqv? native? n?) - (fold-right add-reference-inputs result - ;; XXX: For now, automatically convert LST to a list of - ;; gexp-inputs. - (map (match-lambda - ((? gexp-input? x) x) - (x (%gexp-input x "out" (or n? native?)))) - lst)) - result)) + (fold-right add-reference-inputs result + ;; XXX: For now, automatically convert LST to a list of + ;; gexp-inputs. Inherit N?. + (map (match-lambda + ((? gexp-input? x) + (%gexp-input (gexp-input-thing x) + (gexp-input-output x) + n?)) + (x + (%gexp-input x "out" n?))) + lst))) (_ ;; Ignore references to other kinds of objects. result))) diff --git a/tests/gexp.scm b/tests/gexp.scm index cf88a9db80..5873abdd41 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -355,6 +355,14 @@ (equal? (gexp->sexp* exp) ;native (gexp->sexp* exp "mips64el-linux"))))) +(test-assert "gexp list splicing + ungexp-splicing" + (let* ((inner (gexp (ungexp-native glibc))) + (exp (gexp (list (ungexp-splicing (list inner)))))) + (and (equal? `((,glibc "out")) (gexp-native-inputs exp)) + (null? (gexp-inputs exp)) + (equal? (gexp->sexp* exp) ;native + (gexp->sexp* exp "mips64el-linux"))))) + (test-equal "output list" 2 (let ((exp (gexp (begin (mkdir (ungexp output)) -- cgit 1.4.1