[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/11: tests: Test fixed-output derivations with several hash algorithms
From: |
guix-commits |
Subject: |
04/11: tests: Test fixed-output derivations with several hash algorithms. |
Date: |
Thu, 21 May 2020 19:39:19 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 9418aaa00db44d3e0e3318ff66faace0d7b43326
Author: Ludovic Courtès <address@hidden>
AuthorDate: Mon May 18 21:59:58 2020 +0200
tests: Test fixed-output derivations with several hash algorithms.
* tests/derivations.scm ("fixed-output derivation"): Test several hash
algorithms.
---
tests/derivations.scm | 39 ++++++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 15 deletions(-)
diff --git a/tests/derivations.scm b/tests/derivations.scm
index ef6cec6..a409fa9 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès
<address@hidden>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic
Courtès <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -324,20 +324,29 @@
#:hash hash #:hash-algo 'sha256)))
(fixed-output-derivation? drv)))
-(test-assert "fixed-output derivation"
- (let* ((builder (add-text-to-store %store "my-fixed-builder.sh"
- "echo -n hello > $out" '()))
- (hash (sha256 (string->utf8 "hello")))
- (drv (derivation %store "fixed"
- %bash `(,builder)
- #:sources `(,builder) ;optional
- #:hash hash #:hash-algo 'sha256))
- (succeeded? (build-derivations %store (list drv))))
- (and succeeded?
- (let ((p (derivation->output-path drv)))
- (and (equal? (string->utf8 "hello")
- (call-with-input-file p get-bytevector-all))
- (bytevector? (query-path-hash %store p)))))))
+(test-equal "fixed-output derivation"
+ '(sha1 sha256 sha512)
+ (map (lambda (hash-algorithm)
+ (let* ((builder (add-text-to-store %store "my-fixed-builder.sh"
+ "echo -n hello > $out" '()))
+ (sha256 (sha256 (string->utf8 "hello")))
+ (hash (bytevector-hash
+ (string->utf8 "hello")
+ (lookup-hash-algorithm hash-algorithm)))
+ (drv (derivation %store
+ (string-append
+ "fixed-" (symbol->string hash-algorithm))
+ %bash `(,builder)
+ #:sources `(,builder) ;optional
+ #:hash hash
+ #:hash-algo hash-algorithm)))
+ (build-derivations %store (list drv))
+ (let ((p (derivation->output-path drv)))
+ (and (bytevector=? (string->utf8 "hello")
+ (call-with-input-file p get-bytevector-all))
+ (bytevector? (query-path-hash %store p))
+ hash-algorithm))))
+ '(sha1 sha256 sha512)))
(test-assert "fixed-output derivation: output paths are equal"
(let* ((builder1 (add-text-to-store %store "fixed-builder1.sh"
- branch master updated (1ce1583 -> ef1d475), guix-commits, 2020/05/21
- 01/11: doc: Use "Alternatively" instead of "Alternately"., guix-commits, 2020/05/21
- 05/11: guix hash, guix download: Add '--hash'., guix-commits, 2020/05/21
- 06/11: guix hash, guix download: Support base64 format., guix-commits, 2020/05/21
- 07/11: packages: Add 'base64' macro., guix-commits, 2020/05/21
- 08/11: packages: Introduce <content-hash> and use it in <origin>., guix-commits, 2020/05/21
- 09/11: lint: archival: Use 'origin-hash'., guix-commits, 2020/05/21
- 02/11: maint: Add "make check-channel-news"., guix-commits, 2020/05/21
- 03/11: tests: Test 'add-to-store' with several hash algorithms., guix-commits, 2020/05/21
- 10/11: upstream: Use 'origin-hash'., guix-commits, 2020/05/21
- 04/11: tests: Test fixed-output derivations with several hash algorithms.,
guix-commits <=
- 11/11: gnu: llvm: Remove unused 'package-elisp-from-package' procedure., guix-commits, 2020/05/21