From 0e510971c3f6e5203803f14c40b89fe37d3d3f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 19 Jan 2016 21:38:44 +0100 Subject: derivations: Add test in keep-going mode. * tests/derivations.scm ("derivation fails but keep going"): New test. --- tests/derivations.scm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests') diff --git a/tests/derivations.scm b/tests/derivations.scm index 64cc8a94c9..db96e26ab1 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -151,6 +151,33 @@ ;; the contents. (valid-path? %store (derivation->output-path drv))))) +(test-assert "derivation fails but keep going" + ;; In keep-going mode, 'build-derivations' should fail because of D1, but it + ;; must return only after D2 has succeeded. + (with-store store + (let* ((d1 (derivation %store "fails" + %bash `("-c" "false") + #:inputs `((,%bash)))) + (d2 (build-expression->derivation %store "sleep-then-succeed" + `(begin + ,(random-text) + ;; XXX: Hopefully that's long + ;; enough that D1 has already + ;; failed. + (sleep 2) + (mkdir %output))))) + (set-build-options %store + #:use-substitutes? #f + #:keep-going? #t) + (guard (c ((nix-protocol-error? c) + (and (= 100 (nix-protocol-error-status c)) + (string-contains (nix-protocol-error-message c) + (derivation-file-name d1)) + (not (valid-path? %store (derivation->output-path d1))) + (valid-path? %store (derivation->output-path d2))))) + (build-derivations %store (list d1 d2)) + #f)))) + (test-assert "identical files are deduplicated" (let* ((build1 (add-text-to-store %store "one.sh" "echo hello, world > \"$out\"\n" -- cgit v1.2.3 From d0bd632f89e242a2a217d7e85194589f088f75ea Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 16 Dec 2015 14:45:28 +0100 Subject: import: Add Bioconductor importer and updater. * guix/import/cran.scm (%bioconductor-updater, latest-bioconductor-release, bioconductor-package?): New procedures. (cran->guix-package): Support repositories other than CRAN. (%bioconductor-url, %bioconductor-svn-url): New variables. (description->package): Update signature to distinguish between packages from different repositories. (latest-release): Rename procedure ... (latest-cran-release): ... to this. (cran-package?): Do not assume all R packages are available on CRAN. * tests/cran.scm: Update tests. * guix/scripts/import/cran.scm: Add "--archive" option and default to CRAN. * guix/scripts/refresh.scm (%updaters): Add "%bioconductor-updater". * doc/guix.texi: Document Bioconductor importer and updater. --- tests/cran.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/cran.scm b/tests/cran.scm index 0a4a2fdd8f..e4f22353bd 100644 --- a/tests/cran.scm +++ b/tests/cran.scm @@ -107,7 +107,7 @@ Date/Publication: 2015-07-14 14:15:16 ("mirror://cran/src/contrib/My-Example_1.2.3.tar.gz" "source") (_ (error "Unexpected URL: " url)))))))) - (match ((@@ (guix import cran) description->package) description-alist) + (match ((@@ (guix import cran) description->package) 'cran description-alist) (('package ('name "r-my-example") ('version "1.2.3") -- cgit v1.2.3 From e88d5fa9ebab07d0b23cb3fc0f3f38bd41047e94 Mon Sep 17 00:00:00 2001 From: Ben Woodcroft Date: Sun, 17 Jan 2016 09:12:14 +1000 Subject: import: gem: Beautify only the description, not the synopsis. * guix/import/gem.scm (make-gem-sexp): Add synopsis argument. (gem->guix-package): Pass unbeautified synopsis to make-gem-sexp. * tests/gem.scm: Adapt it. --- tests/gem.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/gem.scm b/tests/gem.scm index 9efbda31fe..ebce809840 100644 --- a/tests/gem.scm +++ b/tests/gem.scm @@ -69,7 +69,7 @@ (("bundler" ('unquote 'bundler)) ("ruby-bar" ('unquote 'ruby-bar))))) ('synopsis "A cool gem") - ('description "A cool gem") + ('description "This package provides a cool gem") ('home-page "https://example.com") ('license ('list 'expat 'asl2.0))) #t) -- cgit v1.2.3 From a132f7d68f4c61133c0c97d8e5125c48f7205ac9 Mon Sep 17 00:00:00 2001 From: Ben Woodcroft Date: Sun, 17 Jan 2016 10:20:59 +1000 Subject: tests: Move beatify-description tests to import-tests. Fixes . * tests/cran.scm (beautify-description: use double spacing, beautify-description: transform fragment into sentence). Move from here ... * tests/import-utils.scm: ... to here. New file. * Makefile.am (SCM_TESTS): Add import-utils. --- tests/cran.scm | 10 ---------- tests/import-utils.scm | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 tests/import-utils.scm (limited to 'tests') diff --git a/tests/cran.scm b/tests/cran.scm index e4f22353bd..83d2e7f554 100644 --- a/tests/cran.scm +++ b/tests/cran.scm @@ -86,16 +86,6 @@ Date/Publication: 2015-07-14 14:15:16 '() ((@@ (guix import cran) listify) simple-alist "BadList")) -(test-equal "beautify-description: use double spacing" - "This is a package. It is great. Trust me Mr. Hendrix." - ((@@ (guix import cran) beautify-description) - "This is a package. It is great. Trust me Mr. Hendrix.")) - -(test-equal "beautify-description: transform fragment into sentence" - "This package provides a function to establish world peace" - ((@@ (guix import cran) beautify-description) - "A function to establish world peace")) - (test-assert "description->package" ;; Replace network resources with sample data. (mock ((guix build download) url-fetch diff --git a/tests/import-utils.scm b/tests/import-utils.scm new file mode 100644 index 0000000000..08365816d4 --- /dev/null +++ b/tests/import-utils.scm @@ -0,0 +1,39 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2015 Ricardo Wurmus +;;; Copyright © 2016 Ben Woodcroft +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (test-import-utils) + #:use-module (guix tests) + #:use-module (guix import utils) + #:use-module (srfi srfi-64)) + +(test-begin "import-utils") + +(test-equal "beautify-description: use double spacing" + "This is a package. It is great. Trust me Mr. Hendrix." + (beautify-description + "This is a package. It is great. Trust me Mr. Hendrix.")) + +(test-equal "beautify-description: transform fragment into sentence" + "This package provides a function to establish world peace" + (beautify-description "A function to establish world peace")) + +(test-end "import-utils") + + +(exit (= (test-runner-fail-count (test-runner-current)) 0)) -- cgit v1.2.3 From 6b779207ee627c93fc0dad18ef67c149024fa535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 21 Jan 2016 22:45:54 +0100 Subject: system: grub: Search root device by label or UUID if possible. Fixes . Reported by Christopher Allan Webber . * gnu/system/grub.scm (eye-candy): Add 'root-fs' parameter. Replace 'search --file' command in the output with whatever 'grub-root-search' returns. (grub-root-search): New procedure. (grub-configuration-file): Add 'store-fs' parameter. Use 'grub-root-search' instead of hard-coded 'search --file' commands. * gnu/system.scm (store-file-system, operating-system-store-file-system): New procedures. (operating-system-grub.cfg): Use it, and adjust call to 'grub-configuration-file'. * tests/system.scm: New file. * Makefile.am (SCM_TESTS): Add it. --- tests/system.scm | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tests/system.scm (limited to 'tests') diff --git a/tests/system.scm b/tests/system.scm new file mode 100644 index 0000000000..7e016a610b --- /dev/null +++ b/tests/system.scm @@ -0,0 +1,77 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2016 Ludovic Courtès +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (test-system) + #:use-module (gnu) + #:use-module (guix store) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-64)) + +;; Test the (gnu system) module. + +(define %root-fs + (file-system + (device "my-root") + (title 'label) + (mount-point "/") + (type "ext4"))) + +(define %os + (operating-system + (host-name "komputilo") + (timezone "Europe/Berlin") + (locale "en_US.utf8") + (bootloader (grub-configuration (device "/dev/sdX"))) + (file-systems (cons %root-fs %base-file-systems)) + + (users %base-user-accounts))) + +(test-begin "system") + +(test-assert "operating-system-store-file-system" + ;; %BASE-FILE-SYSTEMS defines a bind-mount for /gnu/store, but this + ;; shouldn't be a problem. + (eq? %root-fs + (operating-system-store-file-system %os))) + +(test-assert "operating-system-store-file-system, prefix" + (let* ((gnu (file-system + (device "foobar") + (mount-point (dirname (%store-prefix))) + (type "ext5"))) + (os (operating-system + (inherit %os) + (file-systems (cons* gnu %root-fs + %base-file-systems))))) + (eq? gnu (operating-system-store-file-system os)))) + +(test-assert "operating-system-store-file-system, store" + (let* ((gnu (file-system + (device "foobar") + (mount-point (%store-prefix)) + (type "ext5"))) + (os (operating-system + (inherit %os) + (file-systems (cons* gnu %root-fs + %base-file-systems))))) + (eq? gnu (operating-system-store-file-system os)))) + +(test-end) + + +(exit (= (test-runner-fail-count (test-runner-current)) 0)) -- cgit v1.2.3 From c74f0cb2b871f59466e6fbfbc954d8fc1cbc3c9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 21 Jan 2016 23:45:52 +0100 Subject: tests: Prevent 'http_proxy' from breaking Web server tests. * tests/lint.scm: Add call to 'unsetenv' to remove 'http_proxy'. * tests/publish.scm: Likewise. --- tests/lint.scm | 5 ++++- tests/publish.scm | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/lint.scm b/tests/lint.scm index df82593a9e..b8dad13ceb 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013 Cyril Roelandt ;;; Copyright © 2014, 2015 Eric Bavier -;;; Copyright © 2014, 2015 Ludovic Courtès +;;; Copyright © 2014, 2015, 2016 Ludovic Courtès ;;; Copyright © 2015 Mathieu Lirzin ;;; ;;; This file is part of GNU Guix. @@ -19,6 +19,9 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . +;; Avoid interference. +(unsetenv "http_proxy") + (define-module (test-lint) #:use-module (guix tests) #:use-module (guix download) diff --git a/tests/publish.scm b/tests/publish.scm index 4d72fdc468..0b92390900 100644 --- a/tests/publish.scm +++ b/tests/publish.scm @@ -16,6 +16,9 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . +;; Avoid interference. +(unsetenv "http_proxy") + (define-module (test-publish) #:use-module (guix scripts publish) #:use-module (guix tests) @@ -62,6 +65,7 @@ (connect conn AF_INET (inet-pton AF_INET "127.0.0.1") 6789)) (loop)))) + (test-begin "publish") (test-equal "/nix-cache-info" -- cgit v1.2.3