summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2023-12-10 13:25:47 +0200
committerEfraim Flashner <efraim@flashner.co.il>2023-12-10 13:25:47 +0200
commit34eaf5714efcb847c9cba03a055a17e790c1d017 (patch)
treed9c534cac0e668052e6b3c5b11602d0773aa5068 /tests
parent99f7f6457485d524c560bce428fb8c3997e2b553 (diff)
parent63e06f30ce20fa846a7e2e814976fefcd9eda7d3 (diff)
Merge remote-tracking branch 'origin/master' into rust-team
Change-Id: Ic45f7071abd6a02c2ccad411500e5103c8272ffb
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-shell.sh33
-rw-r--r--tests/hackage.scm47
-rw-r--r--tests/pack.scm7
-rw-r--r--tests/profiles.scm4
-rw-r--r--tests/substitute.scm47
5 files changed, 108 insertions, 30 deletions
diff --git a/tests/guix-shell.sh b/tests/guix-shell.sh
index 2f5fd86809..b2f820bf26 100644
--- a/tests/guix-shell.sh
+++ b/tests/guix-shell.sh
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2021-2022 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2021-2023 Ludovic Courtès <ludo@gnu.org>
#
# This file is part of GNU Guix.
#
@@ -103,6 +103,37 @@ guix shell --bootstrap --pure -D -f "$tmpdir/empty-package.scm" \
guile-bootstrap -- guile --version
rm "$tmpdir/empty-package.scm"
+# Make sure '--development' honors '--system'.
+this_system="$(guile -c '(use-modules (guix utils))
+ (display (%current-system))')"
+other_system="$(guile -c '(use-modules (guix utils))
+ (display (if (string=? "riscv64-linux" (%current-system))
+ "x86_64-linux"
+ "riscv64-linux"))')"
+cat > "$tmpdir/some-package.scm" <<EOF
+(use-modules (guix utils)
+ (guix packages)
+ (gnu packages base))
+
+(define unsupported-dependency
+ (package
+ (inherit grep)
+ (name "unsupported-dependency")
+ (supported-systems '())))
+
+(package
+ (inherit hello)
+ (name "phony-package")
+ (inputs
+ (if (string=? (%current-system) "$this_system")
+ (list unsupported-dependency)
+ '())))
+EOF
+
+guix shell -D -f "$tmpdir/some-package.scm" -n && false
+guix shell -D -f "$tmpdir/some-package.scm" -n -s "$other_system"
+
+
if guile -c '(getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)' 2> /dev/null
then
# Compute the build environment for the initial GNU Make.
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 8eea818ebd..403f587c41 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -306,8 +306,6 @@ executable cabal
ghc-options: -Wall
")
-;; Fails: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=35743
-(test-expect-fail 1)
(test-assert "hackage->guix-package test mixed layout"
(eval-test-with-cabal test-cabal-mixed-layout match-ghc-foo))
@@ -624,4 +622,49 @@ executable cabal
(test-assert "hackage->guix-package test cabal import"
(eval-test-with-cabal test-cabal-import match-ghc-foo-import))
+(define test-cabal-multiple-imports
+ "name: foo
+version: 1.0.0
+homepage: http://test.org
+synopsis: synopsis
+description: description
+license: BSD3
+common commons
+ build-depends:
+ HTTP >= 4000.2.5 && < 4000.3,
+ mtl >= 2.0 && < 3
+
+common others
+ build-depends:
+ base == 4.16.*,
+ stm-chans == 3.0.*
+
+executable cabal
+ import:
+ commons
+ , others
+")
+
+(define-package-matcher match-ghc-foo-multiple-imports
+ ('package
+ ('name "ghc-foo")
+ ('version "1.0.0")
+ ('source
+ ('origin
+ ('method 'url-fetch)
+ ('uri ('hackage-uri "foo" 'version))
+ ('sha256
+ ('base32
+ (? string? hash)))))
+ ('build-system 'haskell-build-system)
+ ('properties '(quote ((upstream-name . "foo"))))
+ ('inputs ('list 'ghc-http 'ghc-stm-chans))
+ ('home-page "http://test.org")
+ ('synopsis (? string?))
+ ('description (? string?))
+ ('license 'license:bsd-3)))
+
+(test-assert "hackage->guix-package test cabal multiple imports"
+ (eval-test-with-cabal test-cabal-multiple-imports match-ghc-foo-multiple-imports))
+
(test-end "hackage")
diff --git a/tests/pack.scm b/tests/pack.scm
index 8fdaed0168..ac78817a70 100644
--- a/tests/pack.scm
+++ b/tests/pack.scm
@@ -30,7 +30,7 @@
#:use-module (guix modules)
#:use-module (guix utils)
#:use-module (gnu packages)
- #:use-module ((gnu packages base) #:select (glibc-utf8-locales))
+ #:use-module ((gnu packages base) #:select (libc-utf8-locales-for-target))
#:use-module (gnu packages bootstrap)
#:use-module ((gnu packages package-management) #:select (rpm))
#:use-module ((gnu packages compression) #:select (squashfs-tools))
@@ -197,8 +197,9 @@
;; Make sure non-ASCII file names are properly
;; handled.
(setenv "GUIX_LOCPATH"
- #+(file-append glibc-utf8-locales
- "/lib/locale"))
+ #+(file-append
+ (libc-utf8-locales-for-target)
+ "/lib/locale"))
(setlocale LC_ALL "en_US.utf8")
(mkdir #$output)
diff --git a/tests/profiles.scm b/tests/profiles.scm
index 9c419ada93..ddd6d74f3b 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -463,7 +463,7 @@
(target -> "arm-linux-gnueabihf")
(grep (package->cross-derivation packages:grep target))
(sed (package->cross-derivation packages:sed target))
- (locales (package->derivation packages:glibc-utf8-locales))
+ (locales (package->derivation (packages:libc-utf8-locales-for-target)))
(drv (profile-derivation manifest
#:hooks '()
#:locales? #t
@@ -482,7 +482,7 @@
(derivation-file-name grep))
(string=? (find-input packages:sed)
(derivation-file-name sed))
- (string=? (find-input packages:glibc-utf8-locales)
+ (string=? (find-input (packages:libc-utf8-locales-for-target))
(derivation-file-name locales))))))
(test-assert "package->manifest-entry defaults to \"out\""
diff --git a/tests/substitute.scm b/tests/substitute.scm
index 7246ed82d5..33a6d6040a 100644
--- a/tests/substitute.scm
+++ b/tests/substitute.scm
@@ -662,28 +662,31 @@ System: mips64el-linux\n")))
(lambda ()
(false-if-exception (delete-file "substitute-retrieved")))))))
-(test-quit "substitute, narinfo is available but nar is missing"
- "failed to find alternative substitute"
- (with-narinfo*
- (string-append %narinfo "Signature: "
- (signature-field
- %narinfo
- #:public-key %wrong-public-key))
- %main-substitute-directory
-
- (with-http-server `((200 ,(string-append %narinfo "Signature: "
- (signature-field %narinfo)))
- (404 "Sorry, nar is missing!"))
- (parameterize ((substitute-urls
- (list (%local-url)
- (string-append "file://"
- %main-substitute-directory))))
- (delete-file (string-append %main-substitute-directory
- "/example.nar"))
- (request-substitution (string-append (%store-prefix)
- "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo")
- "substitute-retrieved")
- (not (file-exists? "substitute-retrieved"))))))
+(test-equal "substitute, narinfo is available but nar is missing"
+ "not-found\n"
+ (let ((port (open-output-string)))
+ (parameterize ((current-output-port port))
+ (with-narinfo*
+ (string-append %narinfo "Signature: "
+ (signature-field
+ %narinfo
+ #:public-key %wrong-public-key))
+ %main-substitute-directory
+
+ (with-http-server `((200 ,(string-append %narinfo "Signature: "
+ (signature-field %narinfo)))
+ (404 "Sorry, nar is missing!"))
+ (parameterize ((substitute-urls
+ (list (%local-url)
+ (string-append "file://"
+ %main-substitute-directory))))
+ (delete-file (string-append %main-substitute-directory
+ "/example.nar"))
+ (request-substitution (string-append (%store-prefix)
+ "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo")
+ "substitute-retrieved")
+ (and (not (file-exists? "substitute-retrieved"))
+ (get-output-string port))))))))
(test-equal "substitute, first narinfo is unsigned and has wrong hash"
"Substitutable data."