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