[PATCH v2 1/2] build-system/dune: Automatically deduce test-target in most cases.

  • Done
  • quality assurance status badge
Details
2 participants
  • Julien Lepiller
  • raingloom
Owner
unassigned
Submitted by
raingloom
Severity
normal
R
R
raingloom wrote on 12 Dec 2022 01:07
(address . guix-patches@gnu.org)
20221212000747.24632-1-raingloom@riseup.net
guix/build-system/dune.scm (dune-build): tests? defaults to #f.
guix/build/dune-build-system.scm (check): Missing test-target is auto-detected.
---
guix/build-system/dune.scm | 2 +-
guix/build/dune-build-system.scm | 14 ++++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)

Toggle diff (44 lines)
diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm
index 12100fd8e8..b531d3c337 100644
--- a/guix/build-system/dune.scm
+++ b/guix/build-system/dune.scm
@@ -107,7 +107,7 @@ (define* (dune-build name inputs
(dune-release-flags ''())
(tests? #t)
(test-flags ''())
- (test-target "test")
+ (test-target #f)
(install-target "install")
(validate-runpath? #t)
(patch-shebangs? #t)
diff --git a/guix/build/dune-build-system.scm b/guix/build/dune-build-system.scm
index e9ccc71057..e1337a3f82 100644
--- a/guix/build/dune-build-system.scm
+++ b/guix/build/dune-build-system.scm
@@ -42,14 +42,20 @@ (define* (build #:key (build-flags '()) (jbuild? #f)
build-flags)))
#t)
-(define* (check #:key (test-flags '()) (test-target "test") tests?
+(define* (check #:key (test-flags '()) (test-target #f) tests?
(jbuild? #f) (package #f) (dune-release-flags '())
#:allow-other-keys)
"Test the given package."
(when tests?
- (let ((program (if jbuild? "jbuilder" "dune")))
- (apply invoke program "runtest" test-target
- (append (if package (list "-p" package)
+ (let ((program (if jbuild? "jbuilder" "dune"))
+ (test-target (or test-target
+ (cond
+ ((file-exists? "tests") "tests")
+ ((file-exists? "test") "test")
+ (else ".")))))
+ (apply invoke program "runtest"
+ (append (if test-target (list test-target) '())
+ (if package (list "-p" package)
dune-release-flags)
test-flags))))
#t)
--
2.38.1
J
J
Julien Lepiller wrote on 28 Jan 2023 13:28
(name . raingloom)(address . raingloom@riseup.net)
20230128132839.49fab7f0@sybil.lepiller.eu
Closing since a similar patch was pushed already. Thanks!
J
J
Julien Lepiller wrote on 28 Jan 2023 13:29
(name . raingloom)(address . raingloom@riseup.net)
20230128132922.19e9cded@sybil.lepiller.eu
Actually closing the right ones...
?
Your comment

This issue is archived.

To comment on this conversation send an email to 59980@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 59980
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch