summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gremlin.scm18
-rw-r--r--tests/guix-graph.sh5
-rw-r--r--tests/guix-package-net.sh11
-rw-r--r--tests/import-github.scm139
-rw-r--r--tests/texlive.scm14
5 files changed, 168 insertions, 19 deletions
diff --git a/tests/gremlin.scm b/tests/gremlin.scm
index 41cefd9c7c..3dbb8d3643 100644
--- a/tests/gremlin.scm
+++ b/tests/gremlin.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2018, 2020, 2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Chris Marusich <cmmarusich@gmail.com>
+;;; Copyright © 2022 Pierre Langlois <pierre.langlois@gmx.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,9 +21,11 @@
(define-module (test-gremlin)
#:use-module (guix elf)
#:use-module (guix tests)
- #:use-module ((guix utils) #:select (call-with-temporary-directory))
+ #:use-module ((guix utils) #:select (call-with-temporary-directory
+ target-aarch64?))
#:use-module (guix build utils)
#:use-module (guix build gremlin)
+ #:use-module (gnu packages bootstrap)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
@@ -94,8 +97,17 @@
(loop result))))))
(define ground-truth
(remove (lambda (entry)
+ ;; See vdso(7) for the list of vDSO names across
+ ;; architectures.
(or (string-prefix? "linux-vdso.so" entry)
- (string-prefix? "linux-vdso64.so" entry)))
+ (string-prefix? "linux-vdso32.so" entry) ;32-bit powerpc
+ (string-prefix? "linux-vdso64.so" entry) ;64-bit powerpc
+ (string-prefix? "linux-gate.so" entry) ;i386
+ ;; FIXME: ELF files on aarch64 do not always include a
+ ;; NEEDED entry for the dynamic linker, and it is unclear
+ ;; if that is OK. See: https://issues.guix.gnu.org/52943
+ (and (target-aarch64?)
+ (string-contains entry (glibc-dynamic-linker)))))
(read-ldd-output pipe)))
(and (zero? (close-pipe pipe))
diff --git a/tests/guix-graph.sh b/tests/guix-graph.sh
index 666660ab4b..e813e01c31 100644
--- a/tests/guix-graph.sh
+++ b/tests/guix-graph.sh
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2015, 2016, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2015-2016, 2019-2020, 2022 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
#
# This file is part of GNU Guix.
@@ -23,11 +23,10 @@
module_dir="t-guix-graph-$$"
mkdir "$module_dir"
-trap "rm -rf $module_dir" EXIT
tmpfile1="$module_dir/t-guix-graph1-$$"
tmpfile2="$module_dir/t-guix-graph2-$$"
-trap 'rm -f "$tmpfile1" "$tmpfile2"' EXIT
+trap 'rm -r "$module_dir"' EXIT
cat > "$module_dir/foo.scm"<<EOF
diff --git a/tests/guix-package-net.sh b/tests/guix-package-net.sh
index 6d21c6cff6..a3beb238fe 100644
--- a/tests/guix-package-net.sh
+++ b/tests/guix-package-net.sh
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2012, 2013, 2014, 2015, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2012-2015, 2017, 2019, 2022 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
# Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
#
@@ -50,7 +50,10 @@ profile="t-profile-$$"
profile_alt="t-profile-alt-$$"
rm -f "$profile"
-trap 'rm -f "$profile" "$profile_alt" "$profile-"[0-9]* "$profile_alt-"[0-9]* ; rm -rf t-home-'"$$" EXIT
+module_dir="t-guix-package-net-$$"
+mkdir "$module_dir"
+
+trap 'rm -f "$profile" "$profile_alt" "$profile.lock" "$profile_alt.lock" "$profile-"[0-9]* "$profile_alt-"[0-9]* ; rm -r "$module_dir" t-home-'"$$" EXIT
guix package --bootstrap -p "$profile" -i guile-bootstrap
@@ -177,10 +180,6 @@ guix package -p "$profile" -p "$profile_alt" --search-paths \
| grep "LIBRARY_PATH.*$profile/lib.$profile_alt/lib"
# Simulate an upgrade and make sure the package order is preserved.
-module_dir="t-guix-package-net-$$"
-trap 'rm -rf "$module_dir"' EXIT
-
-mkdir "$module_dir"
cat > "$module_dir/new.scm" <<EOF
(define-module (new)
#:use-module (guix)
diff --git a/tests/import-github.scm b/tests/import-github.scm
new file mode 100644
index 0000000000..979a0fc12b
--- /dev/null
+++ b/tests/import-github.scm
@@ -0,0 +1,139 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
+;;;
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(define-module (test-import-github)
+ #:use-module (json)
+ #:use-module (srfi srfi-35)
+ #:use-module (srfi srfi-64)
+ #:use-module (guix git-download)
+ #:use-module (guix http-client)
+ #:use-module (guix import github)
+ #:use-module (guix packages)
+ #:use-module (guix tests)
+ #:use-module (guix upstream)
+ #:use-module (ice-9 match))
+
+(test-begin "github")
+
+(define (call-with-releases thunk tags releases)
+ (mock ((guix http-client) http-fetch
+ (lambda* (uri #:key headers)
+ (unless (string-prefix? "mock://" uri)
+ (error "the URI ~a should not be used" uri))
+ (define components
+ (string-split (substring uri 8) #\/))
+ (pk 'stuff components headers)
+ (define (scm->json-port scm)
+ (open-input-string (scm->json-string scm)))
+ (match components
+ (("repos" "foo" "foomatics" "releases")
+ (scm->json-port releases))
+ (("repos" "foo" "foomatics" "tags")
+ (scm->json-port tags))
+ (rest (error "TODO ~a" rest)))))
+ (parameterize ((%github-api "mock://"))
+ (thunk))))
+
+;; Copied from tests/minetest.scm
+(define (upstream-source->sexp upstream-source)
+ (define url (upstream-source-urls upstream-source))
+ (unless (git-reference? url)
+ (error "a <git-reference> is expected"))
+ `(,(upstream-source-package upstream-source)
+ ,(upstream-source-version upstream-source)
+ ,(git-reference-url url)
+ ,(git-reference-commit url)))
+
+(define* (expected-sexp new-version new-commit)
+ `("foomatics" ,new-version "https://github.com/foo/foomatics" ,new-commit))
+
+(define (example-package old-version old-commit)
+ (package
+ (name "foomatics")
+ (version old-version)
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/foo/foomatics")
+ (commit old-commit)))
+ (sha256 #f) ; not important for following tests
+ (file-name (git-file-name name version))))
+ (build-system #f)
+ (license #f)
+ (synopsis #f)
+ (description #f)
+ (home-page #f)))
+
+(define* (found-sexp old-version old-commit tags releases)
+ (and=>
+ (call-with-releases (lambda ()
+ ((upstream-updater-latest %github-updater)
+ (example-package old-version old-commit)))
+ tags releases)
+ upstream-source->sexp))
+
+(define-syntax-rule (test-release test-case old-version
+ old-commit new-version new-commit
+ tags releases)
+ (test-equal test-case
+ (expected-sexp new-version new-commit)
+ (found-sexp old-version old-commit tags releases)))
+
+(test-release "newest release is choosen"
+ "1.0.0" "v1.0.0" "1.9" "v1.9"
+ #()
+ ;; a mixture of current, older and newer versions
+ #((("tag_name" . "v0.0"))
+ (("tag_name" . "v1.0.1"))
+ (("tag_name" . "v1.9"))
+ (("tag_name" . "v1.0.0"))
+ (("tag_name" . "v1.0.2"))))
+
+(test-release "tags are used when there are no formal releases"
+ "1.0.0" "v1.0.0" "1.9" "v1.9"
+ ;; a mixture of current, older and newer versions
+ #((("name" . "v0.0"))
+ (("name" . "v1.0.1"))
+ (("name" . "v1.9"))
+ (("name" . "v1.0.0"))
+ (("name" . "v1.0.2")))
+ #())
+
+(test-release "\"version-\" prefixes are recognised"
+ "1.0.0" "v1.0.0" "1.9" "version-1.9"
+ #((("name" . "version-1.9")))
+ #())
+
+(test-release "prefixes are optional"
+ "1.0.0" "v1.0.0" "1.9" "1.9"
+ #((("name" . "1.9")))
+ #())
+
+(test-release "prefixing by package name is acceptable"
+ "1.0.0" "v1.0.0" "1.9" "foomatics-1.9"
+ #((("name" . "foomatics-1.9")))
+ #())
+
+(test-release "not all prefixes are acceptable"
+ "1.0.0" "v1.0.0" "1.0.0" "v1.0.0"
+ #((("name" . "v1.0.0"))
+ (("name" . "barstatics-1.9")))
+ #())
+
+(test-end "github")
diff --git a/tests/texlive.scm b/tests/texlive.scm
index 368e36e31a..f718e3a0a0 100644
--- a/tests/texlive.scm
+++ b/tests/texlive.scm
@@ -177,19 +177,19 @@ completely compatible with Plain TeX.")
(('package
('inherit ('simple-texlive-package
"texlive-texsis"
- ('list "doc/man/man1/"
+ ('list "bibtex/bst/texsis/"
+ "doc/man/man1/"
"doc/otherformats/texsis/base/"
- "bibtex/bst/texsis/"
"tex/texsis/base/"
"tex/texsis/config/")
('base32 (? string? hash))
#:trivial? #t))
('propagated-inputs
- (("texlive-cm" ',texlive-cm)
- ("texlive-hyphen-base" ',texlive-hyphen-base)
- ("texlive-knuth-lib" ',texlive-knuth-lib)
- ("texlive-plain" ',texlive-plain)
- ("texlive-tex" ',texlive-tex)))
+ ('list 'texlive-cm
+ 'texlive-hyphen-base
+ 'texlive-knuth-lib
+ 'texlive-plain
+ 'texlive-tex))
('home-page "https://www.tug.org/texlive/")
('synopsis "Plain TeX macros for Physicists")
('description (? string? description))