diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hackage.scm | 2 | ||||
-rw-r--r-- | tests/packages.scm | 11 | ||||
-rw-r--r-- | tests/store.scm | 36 | ||||
-rw-r--r-- | tests/transformations.scm | 21 |
4 files changed, 68 insertions, 2 deletions
diff --git a/tests/hackage.scm b/tests/hackage.scm index 073e35ad05..9919d54f47 100644 --- a/tests/hackage.scm +++ b/tests/hackage.scm @@ -312,8 +312,6 @@ executable cabal mtl >= 2.0 && < 3 ") -;; Fails: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25138 -(test-expect-fail 1) (test-assert "hackage->guix-package test flag executable" (eval-test-with-cabal test-cabal-flag-executable match-ghc-foo)) diff --git a/tests/packages.scm b/tests/packages.scm index 2e1ca10dc4..46f4da1494 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -241,6 +241,17 @@ (eq? item new))) (null? (manifest-transaction-remove tx))))))) +(test-assert "package-definition-location" + (let ((location (package-location hello)) + (definition (package-definition-location hello))) + ;; Check for the usual layout of (define-public hello (package ...)). + (and (string=? (location-file location) + (location-file definition)) + (= 0 (location-column definition)) + (= 2 (location-column location)) + (= (location-line definition) + (- (location-line location) 1))))) + (test-assert "package-field-location" (let () (define (goto port line column) diff --git a/tests/store.scm b/tests/store.scm index d77c26192a..d895a328a4 100644 --- a/tests/store.scm +++ b/tests/store.scm @@ -454,6 +454,42 @@ (derivation->output-path drv))) (list d1 d2))))) +(test-equal "map/accumulate-builds cutoff" ;https://issues.guix.gnu.org/50264 + (iota 20) + + ;; Make sure that, when the cutoff is reached, 'map/accumulate-builds' still + ;; returns the right result and calls the build handler by batches. + (let* ((b (add-text-to-store %store "build" "echo $foo > $out" '())) + (s (add-to-store %store "bash" #t "sha256" + (search-bootstrap-binary "bash" + (%current-system)))) + (d (map (lambda (i) + (derivation %store (string-append "the-thing-" + (number->string i)) + s `("-e" ,b) + #:env-vars `(("foo" . ,(random-text))) + #:sources (list b s) + #:properties `((n . ,i)))) + (iota 20))) + (calls '())) + (define lst + (with-build-handler (lambda (continue store things mode) + (set! calls (cons things calls)) + (continue #f)) + (map/accumulate-builds %store + (lambda (d) + (build-derivations %store (list d)) + (assq-ref (derivation-properties d) 'n)) + d + #:cutoff 7))) + + (match (reverse calls) + (((batch1 ...) (batch2 ...) (batch3 ...)) + (and (equal? (map derivation-file-name (take d 8)) batch1) + (equal? (map derivation-file-name (take (drop d 8) 8)) batch2) + (equal? (map derivation-file-name (drop d 16)) batch3) + lst))))) + (test-assert "mapm/accumulate-builds" (let* ((d1 (run-with-store %store (gexp->derivation "foo" #~(mkdir #$output)))) diff --git a/tests/transformations.scm b/tests/transformations.scm index 3417c994ec..09839dc1c5 100644 --- a/tests/transformations.scm +++ b/tests/transformations.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2021 Marius Bakke <marius@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -235,6 +236,26 @@ (string=? (package-name dep2) "chbouib") (package-source dep2)))))))) +(test-equal "options->transformation, with-commit, version transformation" + '("1.0" "1.0-rc1-2-gabc123" "git.abc123") + (map (lambda (commit) + (let* ((p (dummy-package "guix.scm" + (inputs `(("foo" ,(dummy-package "chbouib" + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://example.org") + (commit "cabba9e"))) + (sha256 #f))))))))) + (t (options->transformation + `((with-commit . ,(string-append "chbouib=" commit)))))) + (let ((new (t p))) + (and (not (eq? new p)) + (match (package-inputs new) + ((("foo" dep1)) + (package-version dep1))))))) + '("v1.0" "1.0-rc1-2-gabc123" "abc123"))) + (test-equal "options->transformation, with-git-url" (let ((source (git-checkout (url "https://example.org") (recursive? #t)))) |