summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2021-05-09 14:35:57 +0200
committerMathieu Othacehe <othacehe@gnu.org>2021-06-06 18:49:12 +0200
commit82b0e27de109b38ed44f67434a96460c4a7f9217 (patch)
tree8e4a856ded82da528047fa7ef446fcbf4cb28e4d /tests
parente2ad110f4c2a54cecaa8fed3792ba2dbe5fa2af4 (diff)
downloadguix-82b0e27de109b38ed44f67434a96460c4a7f9217.tar.gz
lint: tests-true: Check if tests are enabled when cross-compiling.
* guix/lint.scm (check-tests-true): New linter.
(%local-checkers)[tests-true]: Add it.
* tests/lint.scm ("tests-true: #:tests? must not be set to #t")
("tests-true: absent #:tests? is acceptable")
("tests-true: #:tests? #f is acceptable")
("tests-true: #:tests? #t acceptable when compiling natively"): Test it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/lint.scm23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/lint.scm b/tests/lint.scm
index d54fafc1d2..f4c3dde774 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -277,6 +277,29 @@
    (let ((pkg (dummy-package "under_score")))
      (check-name pkg))))
 
+(test-equal "tests-true: #:tests? must not be set to #t"
+  "#:tests? must not be explicitly set to #t"
+  (single-lint-warning-message
+   (let ((pkg (dummy-package "x" (arguments '(#:tests? #t)))))
+     (check-tests-true pkg))))
+
+(test-equal "tests-true: absent #:tests? is acceptable"
+  '()
+  (let ((pkg (dummy-package "x")))
+    (check-tests-true pkg)))
+
+(test-equal "tests-true: #:tests? #f is acceptable"
+  '()
+  (let ((pkg (dummy-package "x" (arguments '(#:tests? #f)))))
+    (check-tests-true pkg)))
+
+(test-equal "tests-true: #:tests? #t acceptable when compiling natively"
+  '()
+  (let ((pkg (dummy-package "x"
+                            (arguments
+                             `(#:tests? ,(not (%current-target-system)))))))
+    (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