Skip to content

Commit

Permalink
build: Auto-compile tests.
Browse files Browse the repository at this point in the history
With this change, tests run in 46s instead of 230s on my x86_64 laptop
when using ‘guix build -f guix.scm’.

* build-aux/guile.am (.scm.go): Set GUILE_AUTO_COMPILE=0.
* Makefile.am (TESTS_GOBJECTS, DISTCLEANFILES): New variables.
(CLEANFILES): Add $(TESTS_GOBJECTS).
(%.scm.go: %.go): New rule.
* guix.scm (guile-fibers)[arguments]: Remove.
  • Loading branch information
civodul committed Nov 17, 2024
1 parent 1237050 commit 916fab1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
13 changes: 13 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,19 @@ TESTS += \
tests/concurrent-web-server.scm
endif

# Tests are calibrated to be compiled (they're much slower when
# interpreted) so compile them upfront upon 'make check'.
#
# Note: Guile looks for tests/*.scm.go, not tests/*.go, hence the file
# extension weirdness below.
TESTS_GOBJECTS = $(TESTS:%.scm=%.scm.go)
CLEANFILES += $(TESTS_GOBJECTS)
DISTCLEANFILES = $(TESTS_GOBJECTS)
check-local: $(TESTS_GOBJECTS)

%.scm.go: %.go
mv "$^" "$@"

TESTS_ENVIRONMENT=top_srcdir="$(abs_top_srcdir)" ./env $(GUILE) -s

EXTRA_DIST += \
Expand Down
2 changes: 1 addition & 1 deletion build-aux/guile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ EXTRA_DIST = $(SOURCES) $(NOCOMP_SOURCES)
GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat
SUFFIXES = .scm .go
.scm.go:
$(AM_V_GEN) $(top_builddir)/env \
$(AM_V_GEN) GUILE_AUTO_COMPILE=0 $(top_builddir)/env \
$(GUILE_TOOLS) compile $(GUILE_TARGET) -L "$(abs_top_srcdir)" \
$(GUILE_WARNINGS) -o "$@" "$<"
8 changes: 0 additions & 8 deletions guix.scm
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@
"texinfo" "gettext-minimal"))))
(inputs
(list (S "guile")))
(arguments
`(#:phases (modify-phases %standard-phases
(add-before 'configure 'bootstrap
(lambda _
(zero? (system* "./autogen.sh"))))
(add-before 'configure 'setenv
(lambda _
(setenv "GUILE_AUTO_COMPILE" "0"))))))
(synopsis "Lightweight concurrency facility for Guile")
(description
"Fibers is a Guile library that implements a a lightweight concurrency
Expand Down

0 comments on commit 916fab1

Please sign in to comment.