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>
			
			
This commit is contained in:
		
							parent
							
								
									b769fe7f75
								
							
						
					
					
						commit
						88e44f7e16
					
				
					 2 changed files with 32 additions and 0 deletions
				
			
		| 
						 | 
					@ -34,6 +34,7 @@
 | 
				
			||||||
  #:use-module (guix store)
 | 
					  #:use-module (guix store)
 | 
				
			||||||
  #:autoload   (guix base16) (bytevector->base16-string)
 | 
					  #:autoload   (guix base16) (bytevector->base16-string)
 | 
				
			||||||
  #:use-module (guix base32)
 | 
					  #:use-module (guix base32)
 | 
				
			||||||
 | 
					  #:use-module (guix build-system)
 | 
				
			||||||
  #:use-module (guix diagnostics)
 | 
					  #:use-module (guix diagnostics)
 | 
				
			||||||
  #:use-module (guix download)
 | 
					  #:use-module (guix download)
 | 
				
			||||||
  #:use-module (guix ftp-client)
 | 
					  #:use-module (guix ftp-client)
 | 
				
			||||||
| 
						 | 
					@ -279,6 +280,16 @@ superfluous when building natively and incorrect when cross-compiling."
 | 
				
			||||||
             (eq? tests? #t))
 | 
					             (eq? tests? #t))
 | 
				
			||||||
           (package-arguments package)))
 | 
					           (package-arguments package)))
 | 
				
			||||||
  (if (and (tests-explicitly-enabled?)
 | 
					  (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?
 | 
					           ;; Some packages, e.g. gnutls, set #:tests?
 | 
				
			||||||
           ;; differently depending on whether it is being
 | 
					           ;; differently depending on whether it is being
 | 
				
			||||||
           ;; cross-compiled.
 | 
					           ;; cross-compiled.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,6 +35,8 @@
 | 
				
			||||||
  #:use-module (guix tests http)
 | 
					  #:use-module (guix tests http)
 | 
				
			||||||
  #:use-module (guix download)
 | 
					  #:use-module (guix download)
 | 
				
			||||||
  #:use-module (guix git-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 build-system gnu)
 | 
				
			||||||
  #:use-module (guix packages)
 | 
					  #:use-module (guix packages)
 | 
				
			||||||
  #:use-module (guix lint)
 | 
					  #:use-module (guix lint)
 | 
				
			||||||
| 
						 | 
					@ -338,6 +340,25 @@
 | 
				
			||||||
                             `(#:tests? ,(not (%current-target-system)))))))
 | 
					                             `(#:tests? ,(not (%current-target-system)))))))
 | 
				
			||||||
    (check-tests-true pkg)))
 | 
					    (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"
 | 
					(test-equal "inputs: pkg-config is probably a native input"
 | 
				
			||||||
  "'pkg-config' should probably be a native input"
 | 
					  "'pkg-config' should probably be a native input"
 | 
				
			||||||
  (single-lint-warning-message
 | 
					  (single-lint-warning-message
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue