diff options
Diffstat (limited to 'tests')
46 files changed, 44 insertions, 141 deletions
diff --git a/tests/base32.scm b/tests/base32.scm index dcd926f4b8..194f8da96b 100644 --- a/tests/base32.scm +++ b/tests/base32.scm @@ -101,6 +101,3 @@ l)))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/build-utils.scm b/tests/build-utils.scm index b0a4d1584a..cc96738e36 100644 --- a/tests/build-utils.scm +++ b/tests/build-utils.scm @@ -141,6 +141,3 @@ (equal? str "hello world\n"))))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/builders.scm b/tests/builders.scm index a7c3e42830..bb9e0fa85b 100644 --- a/tests/builders.scm +++ b/tests/builders.scm @@ -113,6 +113,3 @@ (file-exists? (string-append out "/bin/hello"))))) (test-end "builders") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/challenge.scm b/tests/challenge.scm index e53cacd333..9505042a45 100644 --- a/tests/challenge.scm +++ b/tests/challenge.scm @@ -106,9 +106,6 @@ (test-end) - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) - ;;; Local Variables: ;;; eval: (put 'with-derivation-narinfo* 'scheme-indent-function 2) ;;; End: diff --git a/tests/containers.scm b/tests/containers.scm index 12982a64f7..c11cdd1ce5 100644 --- a/tests/containers.scm +++ b/tests/containers.scm @@ -26,14 +26,14 @@ (define (assert-exit x) (primitive-exit (if x 0 1))) +(test-begin "containers") + ;; Skip these tests unless user namespaces are available and the setgroups ;; file (introduced in Linux 3.19 to address a security issue) exists. (unless (and (user-namespace-supported?) (unprivileged-user-namespace-supported?) (setgroups-supported?)) - (exit 77)) - -(test-begin "containers") + (test-skip 7)) (test-assert "call-with-container, exit with 0 when there is no error" (zero? @@ -142,6 +142,3 @@ (zero? result))))))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/cpan.scm b/tests/cpan.scm index 583684104d..5d56f0bd2b 100644 --- a/tests/cpan.scm +++ b/tests/cpan.scm @@ -98,6 +98,3 @@ (pk 'fail x #f))))) (test-end "cpan") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/cpio.scm b/tests/cpio.scm index cf65f9808d..516de0655b 100644 --- a/tests/cpio.scm +++ b/tests/cpio.scm @@ -79,6 +79,3 @@ (stat:size (stat file)))))))))))))) (test-end "cpio") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/cran.scm b/tests/cran.scm index 83d2e7f554..896c5af06c 100644 --- a/tests/cran.scm +++ b/tests/cran.scm @@ -131,6 +131,3 @@ lines. And: this line continues the description.") (pk 'fail x #f)))))) (test-end "cran") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/cve.scm b/tests/cve.scm index 26bc560e52..26e710ce70 100644 --- a/tests/cve.scm +++ b/tests/cve.scm @@ -64,6 +64,3 @@ (lookup "openoffice.org" "2.3.0")))) (test-end "cve") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/derivations.scm b/tests/derivations.scm index 4d3b82fe1a..cb7196e2a9 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -570,6 +570,15 @@ (test-skip (if (%guile-for-build) 0 8)) +(test-equal "build-expression->derivation and invalid module name" + '(file-search-error "guix/module/that/does/not/exist.scm") + (guard (c ((file-search-error? c) + (list 'file-search-error + (file-search-error-file-name c)))) + (build-expression->derivation %store "foo" #t + #:modules '((guix module that + does not exist))))) + (test-assert "build-expression->derivation and derivation-prerequisites" (let ((drv (build-expression->derivation %store "fail" #f))) (any (match-lambda @@ -999,6 +1008,3 @@ (call-with-input-file out get-string-all)))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/elpa.scm b/tests/elpa.scm index e8adde3f07..46c6ac2d75 100644 --- a/tests/elpa.scm +++ b/tests/elpa.scm @@ -104,6 +104,3 @@ information about package NAME. (Function 'elpa-package-info'.)" (eval-test-with-elpa "auctex")) (test-end "elpa") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/file-systems.scm b/tests/file-systems.scm index c36509b2b0..aed27e89c2 100644 --- a/tests/file-systems.scm +++ b/tests/file-systems.scm @@ -51,6 +51,3 @@ (equal? form '(uuid "foobar")))))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/gem.scm b/tests/gem.scm index ebce809840..0b37c70142 100644 --- a/tests/gem.scm +++ b/tests/gem.scm @@ -77,6 +77,3 @@ (pk 'fail x #f))))) (test-end "gem") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/gexp.scm b/tests/gexp.scm index 75b907abee..db0ffd2fdd 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -784,9 +784,6 @@ (test-end "gexp") - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) - ;; Local Variables: ;; eval: (put 'test-assertm 'scheme-indent-function 1) ;; End: diff --git a/tests/gnu-maintenance.scm b/tests/gnu-maintenance.scm index e7296137dc..4f2f1ae943 100644 --- a/tests/gnu-maintenance.scm +++ b/tests/gnu-maintenance.scm @@ -39,6 +39,3 @@ ("gnutls" "gnutls-3.2.18-w32.zip"))))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/grafts.scm b/tests/grafts.scm index 4bc33709d6..afed704cde 100644 --- a/tests/grafts.scm +++ b/tests/grafts.scm @@ -159,6 +159,3 @@ (string=? (readlink two) one)))))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/graph.scm b/tests/graph.scm index 4205b9b8c7..32317195d7 100644 --- a/tests/graph.scm +++ b/tests/graph.scm @@ -276,6 +276,3 @@ edges." (list p1a p1b p0))))))) (test-end "graph") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/gremlin.scm b/tests/gremlin.scm index dc9f78c21a..2885554967 100644 --- a/tests/gremlin.scm +++ b/tests/gremlin.scm @@ -64,6 +64,3 @@ "ORIGIN/foo"))) (test-end "gremlin") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh index aba34a3bd0..0a7ea481fc 100644 --- a/tests/guix-environment-container.sh +++ b/tests/guix-environment-container.sh @@ -82,8 +82,13 @@ grep -e "$NIX_STORE_DIR/.*-bash" $tmpdir/mounts # bootstrap bash rm $tmpdir/mounts +abnormal_exit_code=" +(use-modules (system foreign)) +;; Purposely make Guile crash with a segfault. :) +(pointer->string (make-pointer 123) 123)" + if guix environment --bootstrap --container \ - --ad-hoc bootstrap-binaries -- kill -SEGV 2 + --ad-hoc guile-bootstrap -- guile -c "$abnormal_exit_code" then false; else test $? -gt 127 diff --git a/tests/hackage.scm b/tests/hackage.scm index b608ccd866..d1ebe37405 100644 --- a/tests/hackage.scm +++ b/tests/hackage.scm @@ -160,6 +160,3 @@ library (x (pk 'fail x #f)))) (test-end "hackage") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/hash.scm b/tests/hash.scm index 9bcd69440b..8039549971 100644 --- a/tests/hash.scm +++ b/tests/hash.scm @@ -126,6 +126,3 @@ In Guile <= 2.0.9, CBIPs were always fully buffered, so the (list hello hash world)))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/import-utils.scm b/tests/import-utils.scm index 08365816d4..3b11875c4a 100644 --- a/tests/import-utils.scm +++ b/tests/import-utils.scm @@ -34,6 +34,3 @@ (beautify-description "A function to establish world peace")) (test-end "import-utils") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/lint.scm b/tests/lint.scm index 54be50d1c1..4f0196491d 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -581,9 +581,6 @@ requests." (test-end "lint") - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) - ;; Local Variables: ;; eval: (put 'with-http-server 'scheme-indent-function 1) ;; eval: (put 'with-warnings 'scheme-indent-function 0) diff --git a/tests/monads.scm b/tests/monads.scm index 4112bcb6cf..18bf4119be 100644 --- a/tests/monads.scm +++ b/tests/monads.scm @@ -258,6 +258,3 @@ '()))) (test-end "monads") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/nar.scm b/tests/nar.scm index e24a638db9..9796980e35 100644 --- a/tests/nar.scm +++ b/tests/nar.scm @@ -320,9 +320,6 @@ (test-end "nar") - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) - ;;; Local Variables: ;;; eval: (put 'with-file-tree 'scheme-indent-function 2) ;;; End: diff --git a/tests/packages.scm b/tests/packages.scm index 823ede1f25..94e8150b75 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -799,9 +799,6 @@ (test-end "packages") - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) - ;;; Local Variables: ;;; eval: (put 'dummy-package 'scheme-indent-function 1) ;;; End: diff --git a/tests/pk-crypto.scm b/tests/pk-crypto.scm index f5008f3248..5024a15a43 100644 --- a/tests/pk-crypto.scm +++ b/tests/pk-crypto.scm @@ -287,6 +287,3 @@ (canonical-sexp->sexp (sexp->canonical-sexp sexp)))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/pki.scm b/tests/pki.scm index 51f2119466..876ad98d73 100644 --- a/tests/pki.scm +++ b/tests/pki.scm @@ -119,6 +119,3 @@ (corrupt-signature 'c)))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/profiles.scm b/tests/profiles.scm index 6714dfcaa7..fc1dfd2bfc 100644 --- a/tests/profiles.scm +++ b/tests/profiles.scm @@ -320,9 +320,6 @@ (test-end "profiles") - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) - ;;; Local Variables: ;;; eval: (put 'dummy-package 'scheme-indent-function 1) ;;; End: diff --git a/tests/publish.scm b/tests/publish.scm index 6c710fe0a7..6645286f5a 100644 --- a/tests/publish.scm +++ b/tests/publish.scm @@ -121,6 +121,3 @@ References: ~a~%" (response-code (http-get (publish-uri (string-append "/nar/invalid")))))) (test-end "publish") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/pypi.scm b/tests/pypi.scm index cf351a542f..e463467c41 100644 --- a/tests/pypi.scm +++ b/tests/pypi.scm @@ -106,6 +106,3 @@ baz > 13.37") (pk 'fail x #f))))) (test-end "pypi") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/records.scm b/tests/records.scm index 800ed03827..c6f85d4a81 100644 --- a/tests/records.scm +++ b/tests/records.scm @@ -305,6 +305,3 @@ Description: 1st line, '("a"))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/scripts-build.scm b/tests/scripts-build.scm index 94ddaf447b..e48c8da264 100644 --- a/tests/scripts-build.scm +++ b/tests/scripts-build.scm @@ -22,6 +22,7 @@ #:use-module (guix packages) #:use-module (guix scripts build) #:use-module (guix ui) + #:use-module (guix utils) #:use-module (gnu packages base) #:use-module (gnu packages busybox) #:use-module (ice-9 match) @@ -49,6 +50,25 @@ (add-to-store store "guix.scm" #t "sha256" s))))))) +(test-assert "options->transformation, with-source, with version" + ;; Our pseudo-package is called 'guix.scm' so the 'guix.scm-2.0' source + ;; should be applicable, and its version should be extracted. + (let ((p (dummy-package "foo")) + (s (search-path %load-path "guix.scm"))) + (call-with-temporary-directory + (lambda (directory) + (let* ((f (string-append directory "/foo-42.0.tar.gz")) + (t (options->transformation `((with-source . ,f))))) + (copy-file s f) + (with-store store + (let ((new (t store p))) + (and (not (eq? new p)) + (string=? (package-name new) (package-name p)) + (string=? (package-version new) "42.0") + (string=? (package-source new) + (add-to-store store (basename f) #t + "sha256" f)))))))))) + (test-assert "options->transformation, with-source, no matches" ;; When a transformation in not applicable, a warning must be raised. (let* ((p (dummy-package "foobar")) @@ -83,6 +103,3 @@ (eq? dep findutils))))))))))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/scripts.scm b/tests/scripts.scm index 3bf41aed4d..3901710953 100644 --- a/tests/scripts.scm +++ b/tests/scripts.scm @@ -64,9 +64,6 @@ (test-end "scripts") - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) - ;;; Local Variables: ;;; eval: (put 'with-environment-variable 'scheme-indent-function 2) ;;; End: diff --git a/tests/services.scm b/tests/services.scm index 3635549077..477a197160 100644 --- a/tests/services.scm +++ b/tests/services.scm @@ -119,6 +119,3 @@ (null? (e s3))))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/sets.scm b/tests/sets.scm index 0a89591765..cdb7efe172 100644 --- a/tests/sets.scm +++ b/tests/sets.scm @@ -47,6 +47,3 @@ (set-contains? s3 b)))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/size.scm b/tests/size.scm index a1106045f8..fcd590283d 100644 --- a/tests/size.scm +++ b/tests/size.scm @@ -88,9 +88,6 @@ (test-end "size") - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) - ;;; Local Variables: ;;; eval: (put 'match* 'scheme-indent-function 1) ;;; End: diff --git a/tests/snix.scm b/tests/snix.scm index a66b2c7b60..4c31e3389d 100644 --- a/tests/snix.scm +++ b/tests/snix.scm @@ -71,6 +71,3 @@ (pk 'fail x #f)))) (test-end "snix") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/store.scm b/tests/store.scm index f7db7df966..eeadcb94f8 100644 --- a/tests/store.scm +++ b/tests/store.scm @@ -911,6 +911,3 @@ (path-info-deriver (query-path-info %store o)))))) (test-end "store") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/substitute.scm b/tests/substitute.scm index 9d907e7abf..69b272f2bb 100644 --- a/tests/substitute.scm +++ b/tests/substitute.scm @@ -275,9 +275,6 @@ a file for NARINFO." (test-end "substitute") - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) - ;;; Local Variables: ;;; eval: (put 'with-narinfo 'scheme-indent-function 1) ;;; eval: (put 'test-quit 'scheme-indent-function 2) diff --git a/tests/syscalls.scm b/tests/syscalls.scm index a57a9ca9f9..8e24184fe2 100644 --- a/tests/syscalls.scm +++ b/tests/syscalls.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015 David Thompson <davet@gnu.org> ;;; ;;; This file is part of GNU Guix. @@ -223,7 +223,11 @@ ((interfaces ..1) (list (every interface? interfaces) (every string? (map interface-name interfaces)) - (every vector? (map interface-address interfaces)))))) + (every (lambda (sockaddr) + ;; Sometimes interfaces have no associated address. + (or (vector? sockaddr) + (not sockaddr))) + (map interface-address interfaces)))))) (test-equal "network-interfaces returns \"lo\"" (list #t (make-socket-address AF_INET (inet-pton AF_INET "127.0.0.1") 0)) @@ -241,6 +245,3 @@ (lo (interface-address lo))))))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/system.scm b/tests/system.scm index 7e016a610b..b935bd07eb 100644 --- a/tests/system.scm +++ b/tests/system.scm @@ -72,6 +72,3 @@ (eq? gnu (operating-system-store-file-system os)))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/ui.scm b/tests/ui.scm index f28e623ccf..51577acb76 100644 --- a/tests/ui.scm +++ b/tests/ui.scm @@ -250,6 +250,3 @@ Second line" 24)) (show-manifest-transaction store m t))))))))) (test-end "ui") - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/union.scm b/tests/union.scm index 22ba67ce99..cccf397181 100644 --- a/tests/union.scm +++ b/tests/union.scm @@ -125,6 +125,3 @@ (eq? 'directory (stat:type (lstat "bin")))))))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/upstream.scm b/tests/upstream.scm index eb18dd6193..6c86abe817 100644 --- a/tests/upstream.scm +++ b/tests/upstream.scm @@ -44,6 +44,3 @@ '("ftp://example.org/foo-1.tar.xz.sig")))))) (test-end) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) diff --git a/tests/utils.scm b/tests/utils.scm index 67b3724451..6b7725554f 100644 --- a/tests/utils.scm +++ b/tests/utils.scm @@ -336,6 +336,3 @@ (test-end) (false-if-exception (delete-file temp-file)) - - -(exit (= (test-runner-fail-count (test-runner-current)) 0)) |