From 7acdecec9992b81485814f153effdcb097c1e7c4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 18 May 2018 15:23:57 +0200 Subject: tests: Adjust to new "unbound variable" messages. This is a followup to 2d2f98efb36db3f003d950a004806234962b4f4d. * tests/guix-system.sh: Adjust regexps to match "error:". --- tests/guix-system.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/guix-system.sh b/tests/guix-system.sh index ff9114ab74..2b94bc0516 100644 --- a/tests/guix-system.sh +++ b/tests/guix-system.sh @@ -125,9 +125,9 @@ else then # FIXME: With Guile 2.2.0 the error is reported on line 4. # See . - grep "$tmpfile:[49]:[0-9]\+: GRUB-config.*[Uu]nbound variable" "$errorfile" + grep "$tmpfile:[49]:[0-9]\+:.*GRUB-config.*[Uu]nbound variable" "$errorfile" else - grep "$tmpfile:9:[0-9]\+: GRUB-config.*[Uu]nbound variable" "$errorfile" + grep "$tmpfile:9:[0-9]\+:.*GRUB-config.*[Uu]nbound variable" "$errorfile" fi fi -- cgit v1.2.3 From ce9e684b8395fdd0c8217a2e4a1d2776f8ff5ea4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 18 May 2018 17:18:33 +0200 Subject: tests: Skip 'tests/guix-pack.sh' when networking is missing. The test could fail because "static-binaries.tar.xz" is missing, for instance. * tests/guix-pack.sh: Require a network connection to be on the safe side. This reverts part of 47a60325ca650e8fc1a291c8655b4297f4de8deb. --- tests/guix-pack.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/guix-pack.sh b/tests/guix-pack.sh index 130389a7ad..917d52451c 100644 --- a/tests/guix-pack.sh +++ b/tests/guix-pack.sh @@ -20,9 +20,9 @@ # Test the `guix pack' command-line utility. # -# The bootstrap binaries are needed to run these tests, which usually requires -# a network connection. -if ! guix build -q guile-bootstrap; then +# A network connection is required to build %bootstrap-coreutils&co, +# which is required to run these tests with the --bootstrap option. +if ! guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null; then exit 77 fi -- cgit v1.2.3 From 263c9941a1e523b360ca9f42d1ed6b11e6e6e285 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 18 May 2018 22:20:33 +0200 Subject: uuid: 'uuid' returns #f when 'string->uuid' returns #f. * gnu/system/uuid.scm (uuid): When STR is not a literal, return #f when 'string->uuid' returns #f. * tests/uuid.scm ("uuid, dynamic value"): New test. --- gnu/system/uuid.scm | 11 +++++++---- tests/uuid.scm | 9 ++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/gnu/system/uuid.scm b/gnu/system/uuid.scm index 73695ddeb8..f13960c3e9 100644 --- a/gnu/system/uuid.scm +++ b/gnu/system/uuid.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017 Ludovic Courtès +;;; Copyright © 2016, 2017, 2018 Ludovic Courtès ;;; Copyright © 2017 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. @@ -251,7 +251,8 @@ (define* (bytevector->uuid bv #:optional (type 'dce)) (define-syntax uuid (lambda (s) - "Return the UUID object corresponding to the given UUID representation." + "Return the UUID object corresponding to the given UUID representation or +#f if the string could not be parsed." (syntax-case s (quote) ((_ str (quote type)) (and (string? (syntax->datum #'str)) @@ -266,9 +267,11 @@ (define-syntax uuid (string? (syntax->datum #'str)) #'(uuid str 'dce)) ((_ str) - #'(make-uuid 'dce (string->uuid str 'dce))) + #'(let ((bv (string->uuid str 'dce))) + (and bv (make-uuid 'dce bv)))) ((_ str type) - #'(make-uuid type (string->uuid str type)))))) + #'(let ((bv (string->uuid str type))) + (and bv (make-uuid type bv))))))) (define uuid->string ;; Convert the given bytevector or UUID object, to the corresponding UUID diff --git a/tests/uuid.scm b/tests/uuid.scm index 91a3482490..260614f079 100644 --- a/tests/uuid.scm +++ b/tests/uuid.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2017 Ludovic Courtès +;;; Copyright © 2015, 2017, 2018 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -57,6 +57,13 @@ (define-module (test-uuid) "1234-ABCD" (uuid->string (uuid "1234-abcd" 'fat32))) +(test-assert "uuid, dynamic value" + (let* ((good "4dab5feb-d176-45de-b287-9b0a6e4c01cb") + (bad (string-drop good 3))) + (and (uuid? (uuid good)) + (string=? good (uuid->string (uuid good))) + (not (uuid bad))))) + (test-assert "uuid=?" (and (uuid=? (uuid-bytevector (uuid "1234-abcd" 'fat32)) (uuid "1234-abcd" 'fat32)) -- cgit v1.2.3