From 6762394734f960db014099b405776c8e42fda8aa Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 24 Jan 2026 09:07:46 +0100 Subject: [PATCH 1/2] Improve handling of not-parallel test runs * test/Makefile.in: Distinguish between parallel and not-parallel tests. Mark lisp/autorevert-tests.log, lisp/filenotify-tests.log and lisp/net/tramp-tests.log to run not-parrallel. (Bug#80164) * test/README: Some of the tests do not run parallel when expensive tests are activated. * test/infra/gitlab-ci.yml (.job-template): Use "make -j". Makefile knows how to handle parallel runs properly. --- test/Makefile.in | 16 +++++++++++++--- test/README | 7 ++++++- test/infra/gitlab-ci.yml | 5 +++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/test/Makefile.in b/test/Makefile.in index 0d26303a637..21f31f4c2d0 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -219,8 +219,13 @@ LOGFILES := $(patsubst %.el,%.log, \ TESTS := $(LOGFILES:.log=) ## Some tests show problems when run in parallel with other tests. -## Suppress parallelism for them. -.NOTPARALLEL: lisp/filenotify-tests.log lisp/net/tramp-tests.log +## Suppress parallelism for them when SELECTOR is equal to +## SELECTOR_EXPENSIVE or SELECTOR_ALL. +PARALLEL_TESTS := $(LOGFILES) +ifeq ($(subst $(SELECTOR_ALL),yes,$(subst $(SELECTOR_EXPENSIVE),yes,$(SELECTOR_ACTUAL))), yes) +$(eval NOT_PARALLEL_TESTS := $(filter lisp/autorevert-tests.log lisp/filenotify-tests.log lisp/net/tramp-tests.log, $(LOGFILES))) +$(eval PARALLEL_TESTS := $(filter-out $(NOT_PARALLEL_TESTS), ${LOGFILES})) +endif ## If we have to interrupt a hanging test, preserve the log so we can ## see what the problem was. @@ -352,7 +357,12 @@ ifeq ($(TEST_INTERACTIVE), yes) $(patsubst %,-l %,$(if $(findstring $(TEST_LOAD_EL),yes),$ELFILES,$(ELFILES:.el=))) \ $(TEST_RUN_ERT) else - -@${MAKE} -k ${LOGFILES} +ifdef NOT_PARALLEL_TESTS + -@${MAKE} -k -j1 ${NOT_PARALLEL_TESTS} +endif +ifdef PARALLEL_TESTS + -@${MAKE} -k ${PARALLEL_TESTS} +endif @$(emacs) --batch -l ert --eval \ "(ert-summarize-tests-batch-and-exit ${SUMMARIZE_TESTS})" ${LOGFILES} endif diff --git a/test/README b/test/README index a287ae69734..fa48b690347 100644 --- a/test/README +++ b/test/README @@ -35,7 +35,9 @@ test" instead. Running several tests in parallel could result in unexpected side effects with ephemeral test errors. Therefore, it is recommend not to -use "make -j". +use "make -j". Nonetheless, when expensive tests are activated, some of +the tests do not run parallel anyway. See make variable +$NOT_PARALLEL_TESTS. The Makefile sets the environment variable $EMACS_TEST_DIRECTORY, which points to this directory. This environment variable does not @@ -97,6 +99,9 @@ use it directly: make SELECTOR='test-foo-remote' +Setting $SELECTOR in combination with the check-expensive or check-all +make targets is ignored. + Note that although the test files are always compiled (unless they set no-byte-compile), the source files will be run when expensive or unstable tests are involved, to give nicer backtraces. To run the diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index 23af677d186..1f0f33bbe86 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -90,6 +90,7 @@ default: -e EMACS_TEST_JUNIT_REPORT=${EMACS_TEST_JUNIT_REPORT} -e EMACS_TEST_TIMEOUT=${EMACS_TEST_TIMEOUT} -e EMACS_TEST_VERBOSE=${EMACS_TEST_VERBOSE} + -e NPROC=`nproc` -e http_proxy=${http_proxy} -e https_proxy=${https_proxy} -e no_proxy=${no_proxy} @@ -103,8 +104,8 @@ default: git diff --name-only FETCH_HEAD && ( git diff --name-only FETCH_HEAD | xargs git checkout -f FETCH_HEAD ) && - make && - make -k ${make_params}"' + make -j \$NPROC && + make -k -j \$NPROC ${make_params}"' after_script: # - docker ps -a # - pwd; printenv From 17c78c992041b5a250e1f44019a3f47d447acc85 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 24 Jan 2026 10:15:29 +0100 Subject: [PATCH 2/2] ; Tramp code cleanup * lisp/net/tramp-cache.el (tramp-cache-unload-hook): * lisp/net/tramp-cmds.el (tramp-enable-method, tramp-bug): * lisp/net/tramp-compat.el: * test/lisp/net/tramp-tests.el (tramp-test26-interactive-file-name-completion): Simplify retrieving proper function symbols. --- lisp/net/tramp-cache.el | 10 +++------- lisp/net/tramp-cmds.el | 5 ++--- lisp/net/tramp-compat.el | 4 ++-- test/lisp/net/tramp-tests.el | 2 +- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index bb9179630cb..1fc3fb3aeae 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -202,11 +202,6 @@ Return DEFAULT if not set." (set var (1+ val)))) value))) -(add-hook 'tramp-cache-unload-hook - (lambda () - (dolist (var (all-completions "tramp-cache-get-count-" obarray)) - (unintern var obarray)))) - ;;;###tramp-autoload (defun tramp-set-file-property (key file property value) "Set the PROPERTY of FILE to VALUE, in the cache context of KEY. @@ -229,8 +224,9 @@ Return VALUE." (add-hook 'tramp-cache-unload-hook (lambda () - (dolist (var (all-completions "tramp-cache-set-count-" obarray)) - (unintern var obarray)))) + (dolist (var (apropos-internal + (rx bos "tramp-cache-" (| "get" "set") "-count-"))) + (unintern var nil)))) ;;;###tramp-autoload (defun tramp-file-property-p (key file property) diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 84c1c7ea7f4..95e1c5ecad8 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -78,8 +78,7 @@ SYNTAX can be one of the symbols `default' (default), ((not (assoc method tramp-methods)))) method)) ;; All method enabling functions. - (mapcar - #'intern (all-completions "tramp-enable-" obarray #'functionp)))))) + (apropos-internal (rx bos "tramp-enable-") #'functionp))))) (when-let* (((not (assoc method tramp-methods))) (fn (intern (format "tramp-enable-%s-method" method))) @@ -839,7 +838,7 @@ This is needed if there are compatibility problems." (and x (boundp x) (not (get x 'tramp-suppress-trace)) (cons x 'tramp-reporter-dump-variable))) (append - (mapcar #'intern (all-completions "tramp-" obarray #'boundp)) + (apropos-internal (rx bos "tramp-") #'boundp) ;; Non-Tramp variables of interest. '(shell-prompt-pattern backup-by-copying diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index c9a728e2be1..f975457d4df 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -229,8 +229,8 @@ value is the default binding of the variable." (cdr result) ,variable))))) -(dolist (elt (all-completions "tramp-compat-" obarray #'functionp)) - (function-put (intern elt) 'tramp-suppress-trace t)) +(dolist (elt (apropos-internal (rx bos "tramp-compat-") #'functionp)) + (function-put elt 'tramp-suppress-trace t)) (add-hook 'tramp-unload-hook (lambda () diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 7391eb56058..20e76e5fe9b 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -5060,7 +5060,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (dolist (elt (append - (mapcar #'intern (all-completions "tramp-" obarray #'functionp)) + (apropos-internal (rx bos "tramp-") #'functionp) '(completion-file-name-table read-file-name))) (unless (get elt 'tramp-suppress-trace) (trace-function-background elt))))