Subject: bug#76446: [Patch Debbugs] Infrastructure Improvements

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 02 Mar 2025 00:44:41 +0900

Hi,

Michael Albinus <[email-masked]> writes:

[...]

> +## SELECTOR discrimination (see ERT manual for more possibilities):
> +##
> +## SELECTOR='"regexp"': Run all tests which name match "regexp"
> +## SELECTOR='test-name': Run test with name test-name

The use of different quotes here appear somewhat misleading to me;
someone may think extra quoting is needed when using a regexp, but it
isn't, IIUC.

> +
> +### Code:
> +
>  EMACS ?= emacs
>  MAKEINFO ?= makeinfo
>
> -# regex of tests to run
> -TESTS=.*
> +SOURCE = $(wildcard *.el)
> +TESTSOURCE = $(wildcard test/*.el)
> +TARGET = $(filter-out debbugs-pkg.elc,$(patsubst %.el,%.elc,$(SOURCE)))
> +TESTTARGET = $(patsubst %.el,%.elc,$(TESTSOURCE))
>
> -SOURCE=$(wildcard *.el)
> -TESTSOURCE=$(wildcard test/*.el)
> -TARGET=$(filter-out debbugs-pkg.elc,$(patsubst %.el,%.elc,$(SOURCE)))
> -TESTTARGET=$(patsubst %.el,%.elc,$(TESTSOURCE))
> +TESTS = $(patsubst test/%.el,%,$(wildcard test/*-tests.el))
> +SELECTOR ?= (not (tag :unstable))
>
> -INFOMANUALS=debbugs.info debbugs-ug.info
> +INFOMANUALS = debbugs.info debbugs-ug.info
>
>  .PHONY: all build check clean checkdoc
>  .PRECIOUS: %.elc
> @@ -30,10 +63,14 @@ doc: $(INFOMANUALS)
>  build: $(TARGET)
>
>  checkdoc: $(SOURCE) $(TESTSOURCE)
> -	@$(EMACS) -Q --batch -l resources/debbugs-checkdoc-config.el $(foreach file,$^,"--eval=(checkdoc-file \"$(file)\")")
> +	@$(EMACS) -Q --batch -l resources/debbugs-checkdoc-config.el \
> +	  $(foreach file,$^,"--eval=(checkdoc-file \"$(file)\")")
> +
> +check: $(TESTS)
>
> -check: build $(TESTTARGET)
> -	@$(EMACS) -Q --batch -L . -L ./test $(foreach file,$(TESTSOURCE), -l $(file)) --eval '(ert-run-tests-batch-and-exit "$(TESTS)")'
> +%-tests: build $(TESTTARGET)
> +	@$(EMACS) -Q --batch -L . -L ./test -l $@ \
> +	  --eval '(ert-run-tests-batch-and-exit (quote ${SELECTOR}))'

The above LGTM; I agree being able to select a single test is useful.

-- 
Thanks,
Maxim