From f7537e30b892cef09d91902547c00e5fa9b66f3b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 10 Mar 2020 16:45:57 +0100 Subject: inferior: Distinguish inferior exceptions. This avoids ambiguities when looking at a backtrace where the exception was actually thrown by an inferior in a very different context. * guix/inferior.scm (&inferior-exception): New condition type. (read-repl-response): Add optional 'inferior' parameter. Raise '&inferior-exception' instead of rethrowing to KEY when receiving an 'exception' message. (read-inferior-response): Pass INFERIOR to 'read-repl-response'. * tests/inferior.scm ("&inferior-exception"): New test. --- tests/inferior.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/inferior.scm b/tests/inferior.scm index f54b6d6037..b4417d8629 100644 --- a/tests/inferior.scm +++ b/tests/inferior.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018, 2019 Ludovic Courtès +;;; Copyright © 2018, 2019, 2020 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -61,6 +61,17 @@ (close-inferior inferior) (list a (inferior-object? b)))))) +(test-equal "&inferior-exception" + '(a b c d) + (let ((inferior (open-inferior %top-builddir + #:command "scripts/guix"))) + (guard (c ((inferior-exception? c) + (close-inferior inferior) + (and (eq? inferior (inferior-exception-inferior c)) + (inferior-exception-arguments c)))) + (inferior-eval '(throw 'a 'b 'c 'd) inferior) + 'badness))) + (test-equal "inferior-packages" (take (sort (fold-packages (lambda (package lst) (cons (list (package-name package) -- cgit v1.2.3