summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-09-20 22:26:53 +0200
committerLudovic Courtès <ludo@gnu.org>2019-09-21 16:48:36 +0200
commit71507435225f10d8d944ba183cbcc77ef953e0e5 (patch)
tree083c80e7362c7039318d961874503f98768a3238 /tests
parenta43e9157ef479e94c19951cc9d228cf153bf78ee (diff)
inferior: Propagate '&store-protocol-error' error conditions.
Until now '&store-protocol-error' conditions raised in the inferior would not be correctly propagated because SRFI-35 records lack a read syntax. Reported at <https://bugs.gnu.org/37449> by Carl Dong <contact@carldong.me>. * guix/inferior.scm (port->inferior): Import (srfi srfi-34) in the inferior. (inferior-eval-with-store): Define 'error?' and 'error-message'. Wrap call to PROC in 'guard'. Check the response of INFERIOR for a 'store-protocol-error' or a 'result' tag. * tests/inferior.scm ("inferior-eval-with-store, &store-protocol-error"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/inferior.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/inferior.scm b/tests/inferior.scm
index 71ebf8f59b..f54b6d6037 100644
--- a/tests/inferior.scm
+++ b/tests/inferior.scm
@@ -27,6 +27,7 @@
#:use-module (gnu packages bootstrap)
#:use-module (gnu packages guile)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-34)
#:use-module (srfi srfi-64)
#:use-module (ice-9 match))
@@ -186,6 +187,18 @@
(add-text-to-store store "foo"
"Hello, world!")))))
+(test-assert "inferior-eval-with-store, &store-protocol-error"
+ (let* ((inferior (open-inferior %top-builddir
+ #:command "scripts/guix")))
+ (guard (c ((store-protocol-error? c)
+ (string-contains (store-protocol-error-message c)
+ "invalid character")))
+ (inferior-eval-with-store inferior %store
+ '(lambda (store)
+ (add-text-to-store store "we|rd/?!@"
+ "uh uh")))
+ #f)))
+
(test-equal "inferior-package-derivation"
(map derivation-file-name
(list (package-derivation %store %bootstrap-guile "x86_64-linux")