[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/16: lint: check-tests-true: Allow #:tests? #t for some build systems.
From: |
guix-commits |
Subject: |
01/16: lint: check-tests-true: Allow #:tests? #t for some build systems. |
Date: |
Fri, 11 Mar 2022 23:43:24 -0500 (EST) |
apteryx pushed a commit to branch master
in repository guix.
commit 88e44f7e1615579cee27a08bcde31248e65c1178
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Fri Mar 4 13:00:56 2022 +0000
lint: check-tests-true: Allow #:tests? #t for some build systems.
emacs-build-system sets #:tests? #f by default, so the linter shouldn't warn
if #:tests? #t is set for packages using emacs-build-system. Likewise for
texlive-build-system.
* guix/lint.scm (check-tests-true): Do not warn if the build system
is emacs-build-system or texlive-build-system.
* tests/lint.scm
("tests-true: #:tests? #t acceptable for emacs packages")
("tests-true: #:tests? #t acceptable for texlive packages"): New tests.
Fixes: <https://issues.guix.gnu.org/50299>
Reported-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
---
guix/lint.scm | 11 +++++++++++
tests/lint.scm | 21 +++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/guix/lint.scm b/guix/lint.scm
index 3ca7a0b608..e535eb8158 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -34,6 +34,7 @@
#:use-module (guix store)
#:autoload (guix base16) (bytevector->base16-string)
#:use-module (guix base32)
+ #:use-module (guix build-system)
#:use-module (guix diagnostics)
#:use-module (guix download)
#:use-module (guix ftp-client)
@@ -279,6 +280,16 @@ superfluous when building natively and incorrect when
cross-compiling."
(eq? tests? #t))
(package-arguments package)))
(if (and (tests-explicitly-enabled?)
+ ;; emacs-build-system sets #:tests? #f by default, therefore
+ ;; writing #:tests? #t in package definitions using
+ ;; emacs-build-system is reasonable. Likewise for
+ ;; texlive-build-system.
+ ;;
+ ;; Compare the name of the build system instead of the build system
+ ;; itself to avoid loading unnecessary modules when only a few
+ ;; modules are linted.
+ (not (memq (build-system-name (package-build-system package))
+ '(emacs texlive)))
;; Some packages, e.g. gnutls, set #:tests?
;; differently depending on whether it is being
;; cross-compiled.
diff --git a/tests/lint.scm b/tests/lint.scm
index 76c2a70b3a..6bb24370da 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -35,6 +35,8 @@
#:use-module (guix tests http)
#:use-module (guix download)
#:use-module (guix git-download)
+ #:use-module (guix build-system texlive)
+ #:use-module (guix build-system emacs)
#:use-module (guix build-system gnu)
#:use-module (guix packages)
#:use-module (guix lint)
@@ -338,6 +340,25 @@
`(#:tests? ,(not (%current-target-system)))))))
(check-tests-true pkg)))
+;; The emacs-build-system sets #:tests? #f by default.
+(test-equal "tests-true: #:tests? #t acceptable for emacs packages"
+ '()
+ (let ((pkg (dummy-package "x"
+ (build-system emacs-build-system)
+ (arguments
+ `(#:tests? #t)))))
+ (check-tests-true pkg)))
+
+;; Likewise, though the 'check' phase is deleted by default,
+;; so #:tests? #t won't be useful by itself.
+(test-equal "tests-true: #:tests? #t acceptable for texlive packages"
+ '()
+ (let ((pkg (dummy-package "x"
+ (build-system texlive-build-system)
+ (arguments
+ `(#:tests? #t)))))
+ (check-tests-true pkg)))
+
(test-equal "inputs: pkg-config is probably a native input"
"'pkg-config' should probably be a native input"
(single-lint-warning-message
- branch master updated (b769fe7f75 -> 662f1f7bba), guix-commits, 2022/03/11
- 04/16: gnu: ruby-yard-with-tests: Run tests conditionally., guix-commits, 2022/03/11
- 05/16: gnu: ruby-ffi-rzmq: Honor TESTS?., guix-commits, 2022/03/11
- 07/16: gnu: ecl: Run tests conditionally and please lint., guix-commits, 2022/03/11
- 08/16: gnu: perl-unicode-utf8: Run tests conditionally., guix-commits, 2022/03/11
- 02/16: gnu: lean: Update to 3.41.0 and fixes toward cross-compilation., guix-commits, 2022/03/11
- 01/16: lint: check-tests-true: Allow #:tests? #t for some build systems.,
guix-commits <=
- 13/16: gnu: belcard: Run tests conditionally., guix-commits, 2022/03/11
- 14/16: gnu: tdlib: Run tests conditionally., guix-commits, 2022/03/11
- 16/16: gnu: ghc-bsb-http-chunked: Don't run tests when cross-compiling., guix-commits, 2022/03/11
- 15/16: gnu: extra-cmake-modules: Don't run tests when cross-compiling., guix-commits, 2022/03/11
- 03/16: gnu: swi-prolog: Fix cross-compilation., guix-commits, 2022/03/11
- 06/16: gnu: go-1.16: Do not run tests when cross-compiling., guix-commits, 2022/03/11
- 12/16: gnu: lablgtk: Run tests conditionally., guix-commits, 2022/03/11
- 09/16: gnu: libicns: Do not explicitly set TESTS? to #t., guix-commits, 2022/03/11
- 11/16: gnu: Remove python2-promise., guix-commits, 2022/03/11
- 10/16: gnu: Remove python2-empy., guix-commits, 2022/03/11