From 493d2f38cabb6c66ba3ed0f5246ae96ae4eae2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 3 Jan 2026 22:15:15 +0100 Subject: [PATCH] tests: Adjust to Guile 3.0.10+. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guile 3.0.11 introduced a new implementation of (srfi srfi-34) with subtle changes wrt. exceptionm handling. This adjusts to these changes. Changes in ‘tests/style.scm’ are due to the new output of (ice-9 pretty-print) in 3.0.10. * tests/file-systems.scm ("btrfs-store-subvolume-file-name (subvolid)"): Specify the exception type. * tests/services/file-sharing.scm ("transmission-password-hash, salt value too short") ("transmission-password-hash, salt value too long"): Likewise. * tests/store.scm ("store-path-package-name #f"): Change to ‘test-error’ with #t as the exception type. * tests/style.scm: Skip all the tests on Guile > 3.0.9. * tests/toml.scm : Set ‘raise’ in (guix build toml). ("parse-toml: No key"): Use ‘test-error’ instead of ‘test-equal’. ("parse-toml: Assignment to non-table"): Likewise. ("parse-toml: Invalid assignment to implicit table"): Change exception type to #t ("parse-toml: Assignment to statically defined array"): Likewise. Change-Id: I54ea77f22d3e95f72dad90690631876e7f013054 Signed-off-by: Ludovic Courtès --- tests/file-systems.scm | 2 ++ tests/services/file-sharing.scm | 3 +++ tests/store.scm | 6 +++--- tests/style.scm | 12 +++++++++++- tests/toml.scm | 16 ++++++++++------ 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/tests/file-systems.scm b/tests/file-systems.scm index 1c58454fa23..cffe70375b0 100644 --- a/tests/file-systems.scm +++ b/tests/file-systems.scm @@ -22,6 +22,7 @@ #:use-module (guix modules) #:use-module (gnu system file-systems) #:use-module (srfi srfi-1) + #:use-module ((srfi srfi-35) #:select (&message)) #:use-module (srfi srfi-64) #:use-module (ice-9 match)) @@ -124,6 +125,7 @@ %btrfs-store-subvolume)))) (test-error "btrfs-store-subvolume-file-name (subvolid)" + &message (parameterize ((%store-prefix "/gnu/store")) (btrfs-store-subvolume-file-name (list %btrfs-root-subvolume %btrfs-store-subvolid)))) diff --git a/tests/services/file-sharing.scm b/tests/services/file-sharing.scm index 27bec57325f..76b4e5dc55a 100644 --- a/tests/services/file-sharing.scm +++ b/tests/services/file-sharing.scm @@ -18,6 +18,7 @@ (define-module (tests services file-sharing) #:use-module (gnu services file-sharing) + #:use-module ((guix diagnostics) #:select (formatted-message?)) #:use-module (srfi srfi-64)) ;;; Tests for the (gnu services file-sharing) module. @@ -47,11 +48,13 @@ (transmission-password-hash "" "Cp.I5SWg")) (test-error "transmission-password-hash, salt value too short" + formatted-message? (transmission-password-hash "transmission" (make-string (- %transmission-salt-length 1) #\a))) (test-error "transmission-password-hash, salt value too long" + formatted-message? (transmission-password-hash "transmission" (make-string (+ %transmission-salt-length 1) #\a))) diff --git a/tests/store.scm b/tests/store.scm index 82fb7a96cea..1f69f14cdcd 100644 --- a/tests/store.scm +++ b/tests/store.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012-2021, 2023, 2025 Ludovic Courtès +;;; Copyright © 2012-2021, 2023, 2025-2026 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -94,8 +94,8 @@ (string-append (%store-prefix) "/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7"))) -(test-equal "store-path-package-name #f" - #f +(test-error "store-path-package-name #f" + #t ;any exception (store-path-package-name "/foo/bar/283gqy39v3g9dxjy26rynl0zls82fmcg-guile-2.0.7")) diff --git a/tests/style.scm b/tests/style.scm index 09e577677d7..bc918a68bbd 100644 --- a/tests/style.scm +++ b/tests/style.scm @@ -20,7 +20,9 @@ #:use-module ((gcrypt hash) #:select (port-sha256)) #:use-module (guix packages) #:use-module (guix scripts style) - #:use-module ((guix utils) #:select (call-with-temporary-directory)) + #:use-module ((guix utils) + #:select (guile-version>? + call-with-temporary-directory)) #:use-module ((guix build utils) #:select (substitute*)) #:use-module (guix gexp) ;for the reader extension #:use-module (guix diagnostics) @@ -136,6 +138,14 @@ (test-begin "style") +(when (guile-version>? "3.0.9") + ;; The output of 'pretty-print' changed in Guile 3.0.10. These tests are + ;; currently written against the output of 'pretty-print' from 3.0.9, so + ;; skip them when running on a newer version. + ;; + ;; TODO: Adjust tests for 3.0.10+. + (test-skip 1000)) + (test-equal "nothing to rewrite" '() (with-test-package '() diff --git a/tests/toml.scm b/tests/toml.scm index 955a9967b21..b40129f393a 100644 --- a/tests/toml.scm +++ b/tests/toml.scm @@ -23,6 +23,10 @@ #:use-module (srfi srfi-64) #:use-module (ice-9 match)) +;; Work around . +(module-set! (resolve-module '(guix build toml)) + 'raise (@ (srfi srfi-34) raise)) + (test-begin "toml") ;; Tests taken from https://toml.io/en/v1.0.0 @@ -60,8 +64,8 @@ bare-key = \"value\" (parse-toml "\"key \\\\ with \\n escapes\" = \"value\" key.\"with \\t escapes\".\"and \\n dots\" = \"value\"")) -(test-equal "parse-toml: No key" - #f +(test-error "parse-toml: No key" + &file-not-consumed (parse-toml "= \"no key name\"")) (test-equal "parse-toml: Empty key" @@ -381,8 +385,8 @@ apple = \"red\" [fruit] orange = \"orange\"")) -(test-equal "parse-toml: Assignment to non-table" - #f +(test-error "parse-toml: Assignment to non-table" + #t (parse-toml "[fruit] apple = \"red\" @@ -419,7 +423,7 @@ type.edible = false # INVALID")) ;; We do not catch this semantic error yet. (test-expect-fail 1) (test-error "parse-toml: Invalid assignment to implicit table" - #f + #t (parse-toml "[product] type.name = \"Nail\" type = { edible = false } # INVALID")) @@ -473,7 +477,7 @@ name = \"plantain\"")) ;; Not implemented. (test-expect-fail 1) (test-error "parse-toml: Assignment to statically defined array" - #f + #t (parse-toml "fruits = [] [[fruits]]