build-system: mix: Allow passing test flags.

* guix/build-system/mix.scm (mix-build): Add test-flags keyword
argument and pass it on.
* guix/build/mix-build-system.scm (check): Add test-flags keyword
argument and pass it to Mix.

Change-Id: Ib8243aaaf7a7d02df993cee44f33b36566049e83
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Giacomo Leidi 2025-09-21 21:03:38 +02:00 committed by Ludovic Courtès
parent 6e4ac11633
commit 40c2edf91b
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 8 additions and 4 deletions

View file

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
;;; Copyright © 2025 Giacomo Leidi <goodoldpaul@autistici.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -73,6 +74,7 @@ See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
#:key
source
(tests? #t)
(test-flags ''())
(mix-path #f) ;See MIX_PATH.
(mix-exs "mix.exs") ;See MIX_EXS.
(build-per-environment #t) ;See :build_per_environment.
@ -107,6 +109,7 @@ See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
#:source #+source
#:system #$system
#:tests? #$tests?
#:test-flags #$test-flags
#:mix-path #$mix-path
#:mix-exs #$mix-exs
#:mix-environments '#$mix-environments

View file

@ -1,7 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
;;; Copyright © 2024 Igor Goryachev <igor@goryachev.org>
;;; Copyright © 2024 Giacomo Leidi <goodoldpaul@autistici.org>
;;; Copyright © 2024, 2025 Giacomo Leidi <goodoldpaul@autistici.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -119,13 +119,14 @@ See: https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables"
"--no-prune-code-paths"))
mix-environments))
(define* (check #:key (tests? #t) #:allow-other-keys)
(define* (check #:key (tests? #t) (test-flags '()) #:allow-other-keys)
"Test the Mix project."
(if tests?
(begin
(setenv "MIX_ENV" "test")
(invoke "mix" "do" "compile" "--no-deps-check" "--no-prune-code-paths" "+"
"test" "--no-deps-check"))
(apply invoke "mix" "do" "compile" "--no-deps-check"
"--no-prune-code-paths" "+" "test"
"--no-deps-check" test-flags))
(format #t "tests? = ~a~%" tests?)))
(define* (remove-mix-dirs . _)