summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-system.sh6
-rw-r--r--tests/import-utils.scm38
-rw-r--r--tests/packages.scm7
-rw-r--r--tests/print.scm23
-rw-r--r--tests/transformations.scm32
5 files changed, 96 insertions, 10 deletions
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index f76a5ce119..a59bd9a6b9 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -354,6 +354,12 @@ for example in gnu/system/examples/*.tmpl; do
guix system -n disk-image $options "$example"
done
+# Make sure the desktop image can be built on major architectures.
+for system in x86_64-linux i686-linux aarch64-linux
+do
+ guix system -n image -s "$system" gnu/system/examples/desktop.tmpl
+done
+
# Verify that the images can be built.
guix system -n vm gnu/system/examples/bare-bones.tmpl
guix system -n image gnu/system/images/pinebook-pro.scm
diff --git a/tests/import-utils.scm b/tests/import-utils.scm
index 7c6c782917..026c48bb1e 100644
--- a/tests/import-utils.scm
+++ b/tests/import-utils.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2017, 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
@@ -32,14 +32,27 @@
(test-begin "import-utils")
(test-equal "beautify-description: use double spacing"
- "This is a package. It is great. Trust me Mr. Hendrix."
+ "\
+Trust me Mr. Hendrix, M. Night Shyamalan et al. \
+Differences are hard to spot,
+e.g. in CLOS vs. GOOPS."
(beautify-description
- "This is a package. It is great. Trust me Mr. Hendrix."))
+ "
+Trust me Mr. Hendrix, M. Night Shyamalan et al. \
+Differences are hard to spot, e.g. in CLOS vs. GOOPS."))
(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-equal "beautify-description: remove single quotes"
+ "CRAN likes to quote acronyms and function names."
+ (beautify-description "CRAN likes to 'quote' acronyms and 'function' names."))
+
+(test-equal "beautify-description: escape @"
+ "This @@ is not Texinfo syntax. Neither is this %@@>%."
+ (beautify-description "This @ is not Texinfo syntax. Neither is this %@>%."))
+
(test-equal "license->symbol"
'license:lgpl2.0
(license->symbol license:lgpl2.0))
@@ -203,4 +216,23 @@
("license" . #f))))
(package-native-inputs (alist->package meta))))
+(test-assert "alist->package with properties"
+ (let* ((meta '(("name" . "hello")
+ ("version" . "2.10")
+ ("source" .
+ ;; Use a 'file://' URI so that we don't cause a download.
+ ,(string-append "file://"
+ (search-path %load-path "guix.scm")))
+ ("build-system" . "gnu")
+ ("properties" . (("hidden?" . #t)
+ ("upstream-name" . "hello-upstream")))
+ ("home-page" . "https://gnu.org")
+ ("synopsis" . "Say hi")
+ ("description" . "This package says hi.")
+ ("license" . "GPL-3.0+")))
+ (pkg (alist->package meta)))
+ (and (package? pkg)
+ (equal? (package-upstream-name pkg) "hello-upstream")
+ (hidden-package? pkg))))
+
(test-end "import-utils")
diff --git a/tests/packages.scm b/tests/packages.scm
index 6cbc34ba0b..dc03b13417 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -94,6 +94,13 @@
(write
(dummy-package "foo" (location #f)))))))
+(test-equal "license type checking"
+ 'bad-license
+ (guard (c ((package-license-error? c)
+ (package-error-invalid-license c)))
+ (dummy-package "foo"
+ (license 'bad-license))))
+
(test-assert "hidden-package"
(and (hidden-package? (hidden-package (dummy-package "foo")))
(not (hidden-package? (dummy-package "foo")))))
diff --git a/tests/print.scm b/tests/print.scm
index d9710d1ed3..b4f193b905 100644
--- a/tests/print.scm
+++ b/tests/print.scm
@@ -139,6 +139,25 @@
(description "This is a dummy package.")
(license license:gpl3+)))
+(define-with-source pkg-with-properties pkg-with-properties-source
+ (package
+ (name "test")
+ (version "1.2.3")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "file:///tmp/test-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
+ (properties
+ `((hidden? . #t) (upstream-name "test-upstream")))
+ (build-system (@ (guix build-system gnu) gnu-build-system))
+ (home-page "http://gnu.org")
+ (synopsis "Dummy")
+ (description "This is a dummy package.")
+ (license license:gpl3+)))
+
(test-equal "simple package"
`(define-public test ,pkg-source)
(package->code pkg))
@@ -159,4 +178,8 @@
`(define-public test ,pkg-with-arguments-source)
(package->code pkg-with-arguments))
+(test-equal "package with properties"
+ `(define-public test ,pkg-with-properties-source)
+ (package->code pkg-with-properties))
+
(test-end "print")
diff --git a/tests/transformations.scm b/tests/transformations.scm
index dbfe523518..47b1fc650d 100644
--- a/tests/transformations.scm
+++ b/tests/transformations.scm
@@ -103,16 +103,11 @@
"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"))
(s (search-path %load-path "guix.scm"))
(t (options->transformation `((with-source . ,s)))))
- (let* ((port (open-output-string))
- (new (parameterize ((guix-warning-port port))
- (t p))))
- (and (eq? new p)
- (string-contains (get-output-string port)
- "had no effect")))))
+ (eq? (package-source (t p))
+ (package-source p))))
(test-assert "options->transformation, with-source, PKG=URI"
(let* ((p (dummy-package "foo"))
@@ -147,6 +142,29 @@
(add-to-store store (basename s) #t
"sha256" s)))))))
+(test-assert "options->transformation, with-source, in depth"
+ (let* ((p0 (dummy-package "foo" (version "0.0")))
+ (s (search-path %load-path "guix.scm"))
+ (f (string-append "foo@42.0=" s))
+ (t (options->transformation `((with-source . ,f))))
+ (p1 (dummy-package "bar" (inputs (list p0))))
+ (p2 (dummy-package "baz" (inputs (list p1)))))
+ (with-store store
+ (let ((new (t p2)))
+ (and (not (eq? new p2))
+ (match (package-inputs new)
+ ((("bar" p1*))
+ (match (package-inputs p1*)
+ ((("foo" p0*))
+ (and (not (eq? p0* p0))
+ (string=? (package-name p0*) (package-name p0))
+ (string=? (package-version p0*) "42.0")
+ (string=? (add-to-store store (basename s) #t
+ "sha256" s)
+ (run-with-store store
+ (lower-object
+ (package-source p0*))))))))))))))
+
(test-assert "options->transformation, with-input"
(let* ((p (dummy-package "guix.scm"
(inputs `(("foo" ,(specification->package "coreutils"))