[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Tue, 3 Sep 2024 17:00:03 -0400 (EDT) |
branch: main
commit ef095c134bdbc9d4b3883b8d44213f6e1b256904
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Sep 3 17:11:39 2024 +0200
tests: Factorize build log retrieval.
* tests/remote.scm (build-log-file, build-log): New procedures.
("build log for success", "build log for timeout"): Use ‘build-log’.
---
tests/remote.scm | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/tests/remote.scm b/tests/remote.scm
index c836f32..3880cb6 100644
--- a/tests/remote.scm
+++ b/tests/remote.scm
@@ -133,6 +133,17 @@
"Return true if guix-daemon is running."
(force result))))
+(define (build-log-file drv)
+ "Return the file name of the build log of DRV, a string."
+ (let ((hash (store-path-hash-part drv)))
+ (in-vicinity "tests/cache" (string-append hash ".log.gz"))))
+
+(define (build-log drv)
+ "Return the build log of DRV as a string."
+ (call-with-input-file (build-log-file drv)
+ (lambda (port)
+ (call-with-gzip-input-port port get-string-all))))
+
(test-group-with-cleanup "remote"
(test-assert "db-init"
@@ -220,14 +231,9 @@
#:delay 1))
(test-assert "build log for success"
- (let* ((drv (force drv))
- (hash (store-path-hash-part drv)))
- (call-with-input-file (in-vicinity "tests/cache"
- (string-append hash ".log.gz"))
- (lambda (log)
- (string-contains (call-with-gzip-input-port log get-string-all)
- "Starting build process.
-Completing build process.\n")))))
+ (string-contains (build-log (force drv))
+ "Starting build process.
+Completing build process.\n"))
(test-assert "build timeout"
(begin
@@ -243,14 +249,9 @@ Completing build process.\n")))))
#:delay 1)))
(test-assert "build log for timeout"
- (let* ((drv (force drv-with-timeout))
- (hash (store-path-hash-part drv)))
- (call-with-input-file (in-vicinity "tests/cache"
- (string-append hash ".log.gz"))
- (lambda (log)
- (let ((str (call-with-gzip-input-port log get-string-all)))
- (and (string-contains str "Starting build process.")
- (not (string-contains str "Completing build process."))))))))
+ (let ((str (build-log (force drv-with-timeout))))
+ (and (string-contains str "Starting build process.")
+ (not (string-contains str "Completing build process.")))))
(test-assert "worker restart"
(begin
- main updated (59010a5 -> 2c726c9), Ludovic Courtès, 2024/09/03
- [no subject], Ludovic Courtès, 2024/09/03
- [no subject], Ludovic Courtès, 2024/09/03
- [no subject], Ludovic Courtès, 2024/09/03
- [no subject],
Ludovic Courtès <=
- [no subject], Ludovic Courtès, 2024/09/03
- [no subject], Ludovic Courtès, 2024/09/03