[bug#75595,2/4] tests: Make ‘inferior-eval-with-store’ test more robust.
Commit Message
* tests/inferior.scm ("inferior-eval-with-store"): Use ‘random-text’ for
the store item’s body.
Change-Id: Ia39e276955e1836a0272713ff25c4490273c666f
---
tests/inferior.scm | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018-2022, 2025 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,6 +27,8 @@ (define-module (test-inferior)
#:use-module (gnu packages bootstrap)
#:use-module (gnu packages guile)
#:use-module (gnu packages sqlite)
+ #:autoload (gcrypt hash) (sha256)
+ #:autoload (rnrs bytevectors) (string->utf8)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-64)
@@ -220,14 +222,15 @@ (define (manifest-entry->list entry)
(close-inferior inferior)
result))
-(test-equal "inferior-eval-with-store"
- (add-text-to-store %store "foo" "Hello, world!")
+(test-assert "inferior-eval-with-store"
(let* ((inferior (open-inferior %top-builddir
- #:command "scripts/guix")))
- (inferior-eval-with-store inferior %store
- '(lambda (store)
- (add-text-to-store store "foo"
- "Hello, world!")))))
+ #:command "scripts/guix"))
+ (text (random-text)))
+ (string=? (inferior-eval-with-store inferior %store
+ `(lambda (store)
+ (add-text-to-store store "foo"
+ ,text)))
+ (store-path "text" (sha256 (string->utf8 text)) "foo"))))
(test-assert "inferior-eval-with-store, &store-protocol-error"
(let* ((inferior (open-inferior %top-builddir