diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2021-12-13 16:09:56 +0100 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2021-12-13 16:09:56 +0100 |
commit | b30b33ed9b3cdacecebef73ad1131f03c635de7a (patch) | |
tree | 51f74825579561f8267b0ba7d0b885dcd88378cf /test | |
parent | c1476afb99fbba316832c12e584a633684966c09 (diff) | |
download | emacs-b30b33ed9b3cdacecebef73ad1131f03c635de7a.tar.gz |
ERT can generate JUnit test reports
* .gitignore: Add test/**/*.xml.
* admin/notes/emba: Mention JUnit test report.
* etc/NEWS: ERT can generate JUnit test reports.
* lisp/emacs-lisp/ert.el (xml-escape-string): Autoload.
(ert-write-junit-test-report)
(ert-write-junit-test-summary-report): New defuns.
(ert-run-tests-batch, ert-summarize-tests-batch-and-exit): Call them.
* test/Makefile.in (clean): Remove *.xml.
* test/README: Mention $EMACS_TEST_JUNIT_REPORT environment variable.
* test/infra/Makefile.in ($(FILE)): Generate header commentary.
(clean): Remove.
* test/infra/gitlab-ci.yml (variables): Set EMACS_TEST_JUNIT_REPORT.
(.job-template): Use it in script and after_script.
(.build-template, .gnustep-template, .filenotify-gio-template)
(.native-comp-template): Adapt rules.
(.test-template): Trigger JUnit test report.
* test/infra/test-jobs.yml: Regenerate.
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.in | 1 | ||||
-rw-r--r-- | test/README | 3 | ||||
-rw-r--r-- | test/infra/Makefile.in | 6 | ||||
-rw-r--r-- | test/infra/gitlab-ci.yml | 22 | ||||
-rw-r--r-- | test/infra/test-jobs.yml | 1 |
5 files changed, 18 insertions, 15 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index f2c49584e7f..eeda2918fa3 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -353,6 +353,7 @@ mostlyclean: clean: find . '(' -name '*.log' -o -name '*.log~' ')' $(FIND_DELETE) + find . '(' -name '*.xml' -a ! -path '*resources*' ')' $(FIND_DELETE) rm -f ${srcdir}/lisp/gnus/mml-sec-resources/random_seed rm -f $(test_module_dir)/*.o $(test_module_dir)/*.so \ $(test_module_dir)/*.dll diff --git a/test/README b/test/README index 4d447c9bf15..2bd84b5f9b3 100644 --- a/test/README +++ b/test/README @@ -114,6 +114,9 @@ mode--only the names of the failed tests are listed. If the $EMACS_TEST_VERBOSE environment variable is set, the failure summaries will also include the data from the failing test. +If the $EMACS_TEST_JUNIT_REPORT environment variable is set to a file +name, a JUnit test report is generated under this name. + Some of the tests require a remote temporary directory (autorevert-tests.el, filenotify-tests.el, shadowfile-tests.el and tramp-tests.el). Per default, a mock-up connection method is used diff --git a/test/infra/Makefile.in b/test/infra/Makefile.in index fd11d367983..e4f99743e09 100644 --- a/test/infra/Makefile.in +++ b/test/infra/Makefile.in @@ -93,10 +93,8 @@ all: generate-test-jobs .PHONY: generate-test-jobs $(FILE) $(SUBDIR_TARGETS) -generate-test-jobs: clean $(FILE) $(SUBDIR_TARGETS) +generate-test-jobs: $(FILE) $(SUBDIR_TARGETS) $(FILE): $(AM_V_GEN) - -clean: - @rm -f $(FILE) + @echo "# Generated by \"make generate-test-jobs\", don't edit." >$(FILE) diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index b0ea6813b30..3903642c792 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -44,6 +44,7 @@ workflow: variables: GIT_STRATEGY: fetch EMACS_EMBA_CI: 1 + EMACS_TEST_JUNIT_REPORT: junit-test-report.xml EMACS_TEST_TIMEOUT: 3600 EMACS_TEST_VERBOSE: 1 # Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled @@ -85,7 +86,7 @@ default: # TODO: with make -j4 several of the tests were failing, for # example shadowfile-tests, but passed without it. - 'export PWD=$(pwd)' - - 'docker run -i -e EMACS_EMBA_CI=${EMACS_EMBA_CI} -e EMACS_TEST_TIMEOUT=${EMACS_TEST_TIMEOUT} -e EMACS_TEST_VERBOSE=${EMACS_TEST_VERBOSE} --volumes-from $(docker ps -q -f "label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}"):ro --name ${test_name} ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} /bin/bash -c "git fetch ${PWD} HEAD && echo checking out these updated files && git diff --name-only FETCH_HEAD && ( git diff --name-only FETCH_HEAD | xargs git checkout -f FETCH_HEAD ) && make -j4 && make ${make_params}"' + - 'docker run -i -e EMACS_EMBA_CI=${EMACS_EMBA_CI} -e EMACS_TEST_JUNIT_REPORT=${EMACS_TEST_JUNIT_REPORT} -e EMACS_TEST_TIMEOUT=${EMACS_TEST_TIMEOUT} -e EMACS_TEST_VERBOSE=${EMACS_TEST_VERBOSE} --volumes-from $(docker ps -q -f "label=com.gitlab.gitlab-runner.job.id=${CI_JOB_ID}"):ro --name ${test_name} ${CI_REGISTRY_IMAGE}:${target}-${BUILD_TAG} /bin/bash -c "git fetch ${PWD} HEAD && echo checking out these updated files && git diff --name-only FETCH_HEAD && ( git diff --name-only FETCH_HEAD | xargs git checkout -f FETCH_HEAD ) && make -j4 && make ${make_params}"' after_script: # - docker ps -a # - printenv @@ -93,7 +94,8 @@ default: # Prepare test artifacts. - test -n "$(docker ps -aq -f name=${test_name})" && docker cp ${test_name}:checkout/test ${test_name} - test -n "$(docker ps -aq -f name=${test_name})" && docker rm ${test_name} - - find ${test_name} ! -name "*.log" -type f -delete + - find ${test_name} ! \( -name "*.log" -o -name ${EMACS_TEST_JUNIT_REPORT} \) -type f -delete + # BusyBox find does not know -empty. - find ${test_name} -type d -depth -exec rmdir {} + 2>/dev/null .build-template: @@ -103,7 +105,6 @@ default: when: always - changes: - "**.in" - - "**.yml" - GNUmakefile - aclocal.m4 - autogen.sh @@ -112,7 +113,7 @@ default: - lib/malloc/*.{h,c} - lisp/emacs-lisp/*.el - src/*.{h,c} - - test/infra/Dockerfile.emba + - test/infra/* - changes: # gfilemonitor, kqueue - src/gfilenotify.c @@ -133,9 +134,11 @@ default: name: ${test_name} public: true expire_in: 1 week + when: always paths: - ${test_name}/ - when: always + reports: + junit: ${test_name}/${EMACS_TEST_JUNIT_REPORT} .gnustep-template: rules: @@ -143,12 +146,11 @@ default: - if: '$CI_PIPELINE_SOURCE == "schedule"' changes: - "**.in" - - "**.yml" - src/ns*.{h,m} - src/macfont.{h,m} - lisp/term/ns-win.el - nextstep/** - - test/infra/Dockerfile.emba + - test/infra/* .filenotify-gio-template: rules: @@ -156,12 +158,11 @@ default: - if: '$CI_PIPELINE_SOURCE == "schedule"' changes: - "**.in" - - "**.yml" - lisp/autorevert.el - lisp/filenotify.el - lisp/net/tramp-sh.el - src/gfilenotify.c - - test/infra/Dockerfile.emba + - test/infra/* - test/lisp/autorevert-tests.el - test/lisp/filenotify-tests.el @@ -171,11 +172,10 @@ default: - if: '$CI_PIPELINE_SOURCE == "schedule"' changes: - "**.in" - - "**.yml" - lisp/emacs-lisp/comp.el - lisp/emacs-lisp/comp-cstr.el - src/comp.{h,m} - - test/infra/Dockerfile.emba + - test/infra/* - test/src/comp-resources/*.el - test/src/comp-tests.el timeout: 8 hours diff --git a/test/infra/test-jobs.yml b/test/infra/test-jobs.yml index bad8575b5c5..63b052bf8c7 100644 --- a/test/infra/test-jobs.yml +++ b/test/infra/test-jobs.yml @@ -1,3 +1,4 @@ +# Generated by "make generate-test-jobs", don't edit. test-lib-src-inotify: stage: normal |