From 3e3c2778704331ee9a48721fe217afe5f8030e52 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Wed, 31 May 2023 08:44:44 +0200 Subject: [PATCH] Improve tree-sitter tests on emba * test/infra/Dockerfile.emba (emacs-tree-sitter): Install only grammars which are needed. * test/infra/Makefile.in (subdir_template): Special handling of progmodes. (TREE-SITTER-FILES): New variable. (tree-sitter-files-template): New rule. (.PHONY, generate-test-jobs): Add it to dependencies. * test/infra/gitlab-ci.yml (.tree-sitter-template): Add test/lisp/progmodes/*-ts-mode-resources/**. (test-tree-sitter): Extends also .tree-sitter-files-template. Use $tree-sitter-files. * test/infra/test-jobs.yml: Regenerate. --- test/infra/Dockerfile.emba | 18 ++------ test/infra/Makefile.in | 26 ++++++++++-- test/infra/gitlab-ci.yml | 13 ++---- test/infra/test-jobs.yml | 84 +++++++++++++++++++++++--------------- 4 files changed, 80 insertions(+), 61 deletions(-) diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba index 5141c8919b1..1969afdd333 100644 --- a/test/infra/Dockerfile.emba +++ b/test/infra/Dockerfile.emba @@ -114,28 +114,16 @@ RUN src/emacs -Q --batch \ --eval '(setq \ treesit-extra-load-path (list "/usr/local/lib/tree-sitter") \ treesit-language-source-alist \ - (quote ((bash "https://github.com/tree-sitter/tree-sitter-bash") \ - (c "https://github.com/tree-sitter/tree-sitter-c") \ - (cmake "https://github.com/uyha/tree-sitter-cmake") \ + (quote ((c "https://github.com/tree-sitter/tree-sitter-c") \ (cpp "https://github.com/tree-sitter/tree-sitter-cpp") \ - (css "https://github.com/tree-sitter/tree-sitter-css") \ - (elisp "https://github.com/Wilfred/tree-sitter-elisp") \ (elixir "https://github.com/elixir-lang/tree-sitter-elixir") \ - (java "https://github.com/tree-sitter/tree-sitter-java") \ (go "https://github.com/tree-sitter/tree-sitter-go") \ (gomod "https://github.com/camdencheek/tree-sitter-go-mod") \ (heex "https://github.com/phoenixframework/tree-sitter-heex") \ - (html "https://github.com/tree-sitter/tree-sitter-html") \ - (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src") \ - (json "https://github.com/tree-sitter/tree-sitter-json") \ - (make "https://github.com/alemuller/tree-sitter-make") \ - (markdown "https://github.com/ikatyang/tree-sitter-markdown") \ - (python "https://github.com/tree-sitter/tree-sitter-python") \ + (java "https://github.com/tree-sitter/tree-sitter-java") \ (ruby "https://github.com/tree-sitter/tree-sitter-ruby") \ - (toml "https://github.com/tree-sitter/tree-sitter-toml") \ (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src") \ - (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src") \ - (yaml "https://github.com/ikatyang/tree-sitter-yaml"))))' \ + (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src"))))' \ --eval '(dolist (lang (mapcar (quote car) treesit-language-source-alist)) \ (treesit-install-language-grammar lang "/usr/local/lib/tree-sitter"))' diff --git a/test/infra/Makefile.in b/test/infra/Makefile.in index c6538c093c0..7b2c27918a7 100644 --- a/test/infra/Makefile.in +++ b/test/infra/Makefile.in @@ -53,6 +53,17 @@ define subdir_template define changes @echo ' - lisp/emacs-lisp/faceup*.el' >>$(FILE) endef + else ifeq ($(findstring progmodes, $(1)), progmodes) + define changes + @echo ' - $(1)/eglot.el' >>$(FILE) + @echo ' - $(1)/*-ts-mode.el' >>$(FILE) + @echo ' - test/$(1)/eglot-tests.el' >>$(FILE) + @echo ' - test/$(1)/*-ts-mode-resources/**' >>$(FILE) + @echo ' - test/$(1)/*-ts-mode-tests.el' >>$(FILE) + @echo ' when: never' >>$(FILE) + @echo ' - changes:' >>$(FILE) + @echo ' - $(1)/*.el' >>$(FILE) + endef else ifeq ($(findstring so-long, $(1)), so-long) define changes @echo ' - lisp/so-long*.el' >>$(FILE) @@ -80,8 +91,8 @@ define subdir_template @echo ' when: never' >>$(FILE) @echo ' - changes:' >>$(FILE) $(changes) - @echo ' - test/$(1)/*.el' >>$(FILE) @echo ' - test/$(1)/*resources/**' >>$(FILE) + @echo ' - test/$(1)/*.el' >>$(FILE) @echo ' variables:' >>$(FILE) @echo ' target: emacs-inotify' >>$(FILE) @echo ' make_params: "-k -C test $(target)"' >>$(FILE) @@ -89,11 +100,20 @@ endef $(foreach subdir, $(SUBDIRS), $(eval $(call subdir_template,$(subdir)))) +TREE-SITTER-FILES ?= $(shell cd .. ; find lisp -name "*-ts-*.el" | sort | sed s/\\.el/.log/) + all: generate-test-jobs -.PHONY: generate-test-jobs $(FILE) $(SUBDIR_TARGETS) +.PHONY: generate-test-jobs $(FILE) $(SUBDIR_TARGETS) tree-sitter-files-template + +generate-test-jobs: $(FILE) $(SUBDIR_TARGETS) tree-sitter-files-template -generate-test-jobs: $(FILE) $(SUBDIR_TARGETS) +tree-sitter-files-template: + @echo >>$(FILE) + @echo '.tree-sitter-files-template:' >>$(FILE) + @echo ' variables:' >>$(FILE) + @echo ' tree-sitter-files: >-' >>$(FILE) + @for name in $(TREE-SITTER-FILES) ; do echo " $${name}" >>$(FILE) ; done $(FILE): $(AM_V_GEN) diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml index 9a862dcba3c..b5b3e6823c7 100644 --- a/test/infra/gitlab-ci.yml +++ b/test/infra/gitlab-ci.yml @@ -184,6 +184,7 @@ default: - "**.in" - lisp/progmodes/*-ts-mode.el - test/infra/* + - test/lisp/progmodes/*-ts-mode-resources/** - test/lisp/progmodes/*-ts-mode-tests.el .native-comp-template: @@ -274,22 +275,14 @@ build-image-tree-sitter: test-tree-sitter: stage: platforms - extends: [.job-template, .test-template, .tree-sitter-template] + extends: [.job-template, .test-template, .tree-sitter-template, .tree-sitter-files-template] needs: - job: build-image-tree-sitter optional: true variables: target: emacs-tree-sitter # This is needed in order to get a JUnit test report. - files: >- - lisp/progmodes/c-ts-mode-tests.log - lisp/progmodes/elixir-ts-mode-tests.log - lisp/progmodes/go-ts-mode-tests.log - lisp/progmodes/heex-ts-mode-tests.log - lisp/progmodes/java-ts-mode-tests.log - lisp/progmodes/ruby-ts-mode-tests.log - lisp/progmodes/typescript-ts-mode-tests.log - make_params: '-k -C test check-expensive LD_LIBRARY_PATH=/usr/local/lib/tree-sitter LOGFILES="$files"' + make_params: '-k -C test check-expensive LD_LIBRARY_PATH=/usr/local/lib/tree-sitter LOGFILES="$tree-sitter-files"' build-image-gnustep: stage: platform-images diff --git a/test/infra/test-jobs.yml b/test/infra/test-jobs.yml index 55ce590af89..7c26c33f6c6 100644 --- a/test/infra/test-jobs.yml +++ b/test/infra/test-jobs.yml @@ -11,8 +11,8 @@ test-lib-src-inotify: when: never - changes: - lib-src/*.{h,c} - - test/lib-src/*.el - test/lib-src/*resources/** + - test/lib-src/*.el variables: target: emacs-inotify make_params: "-k -C test check-lib-src" @@ -28,8 +28,8 @@ test-lisp-inotify: when: never - changes: - lisp/*.el - - test/lisp/*.el - test/lisp/*resources/** + - test/lisp/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp" @@ -45,8 +45,8 @@ test-lisp-calc-inotify: when: never - changes: - lisp/calc/*.el - - test/lisp/calc/*.el - test/lisp/calc/*resources/** + - test/lisp/calc/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-calc" @@ -62,8 +62,8 @@ test-lisp-calendar-inotify: when: never - changes: - lisp/calendar/*.el - - test/lisp/calendar/*.el - test/lisp/calendar/*resources/** + - test/lisp/calendar/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-calendar" @@ -79,8 +79,8 @@ test-lisp-cedet-inotify: when: never - changes: - lisp/cedet/*.el - - test/lisp/cedet/*.el - test/lisp/cedet/*resources/** + - test/lisp/cedet/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-cedet" @@ -96,8 +96,8 @@ test-lisp-cedet-semantic-inotify: when: never - changes: - lisp/cedet/semantic/*.el - - test/lisp/cedet/semantic/*.el - test/lisp/cedet/semantic/*resources/** + - test/lisp/cedet/semantic/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-cedet-semantic" @@ -113,8 +113,8 @@ test-lisp-cedet-semantic-bovine-inotify: when: never - changes: - lisp/cedet/semantic/bovine/*.el - - test/lisp/cedet/semantic/bovine/*.el - test/lisp/cedet/semantic/bovine/*resources/** + - test/lisp/cedet/semantic/bovine/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-cedet-semantic-bovine" @@ -130,8 +130,8 @@ test-lisp-cedet-srecode-inotify: when: never - changes: - lisp/cedet/srecode/*.el - - test/lisp/cedet/srecode/*.el - test/lisp/cedet/srecode/*resources/** + - test/lisp/cedet/srecode/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-cedet-srecode" @@ -147,8 +147,8 @@ test-lisp-emacs-lisp-inotify: when: never - changes: - lisp/emacs-lisp/*.el - - test/lisp/emacs-lisp/*.el - test/lisp/emacs-lisp/*resources/** + - test/lisp/emacs-lisp/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-emacs-lisp" @@ -164,8 +164,8 @@ test-lisp-emacs-lisp-eieio-tests-inotify: when: never - changes: - lisp/emacs-lisp/eieio*.el - - test/lisp/emacs-lisp/eieio-tests/*.el - test/lisp/emacs-lisp/eieio-tests/*resources/** + - test/lisp/emacs-lisp/eieio-tests/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-emacs-lisp-eieio-tests" @@ -181,8 +181,8 @@ test-lisp-emacs-lisp-faceup-tests-inotify: when: never - changes: - lisp/emacs-lisp/faceup*.el - - test/lisp/emacs-lisp/faceup-tests/*.el - test/lisp/emacs-lisp/faceup-tests/*resources/** + - test/lisp/emacs-lisp/faceup-tests/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-emacs-lisp-faceup-tests" @@ -198,8 +198,8 @@ test-lisp-emulation-inotify: when: never - changes: - lisp/emulation/*.el - - test/lisp/emulation/*.el - test/lisp/emulation/*resources/** + - test/lisp/emulation/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-emulation" @@ -215,8 +215,8 @@ test-lisp-erc-inotify: when: never - changes: - lisp/erc/*.el - - test/lisp/erc/*.el - test/lisp/erc/*resources/** + - test/lisp/erc/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-erc" @@ -232,8 +232,8 @@ test-lisp-eshell-inotify: when: never - changes: - lisp/eshell/*.el - - test/lisp/eshell/*.el - test/lisp/eshell/*resources/** + - test/lisp/eshell/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-eshell" @@ -249,8 +249,8 @@ test-lisp-gnus-inotify: when: never - changes: - lisp/gnus/*.el - - test/lisp/gnus/*.el - test/lisp/gnus/*resources/** + - test/lisp/gnus/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-gnus" @@ -266,8 +266,8 @@ test-lisp-image-inotify: when: never - changes: - lisp/image/*.el - - test/lisp/image/*.el - test/lisp/image/*resources/** + - test/lisp/image/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-image" @@ -283,8 +283,8 @@ test-lisp-international-inotify: when: never - changes: - lisp/international/*.el - - test/lisp/international/*.el - test/lisp/international/*resources/** + - test/lisp/international/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-international" @@ -300,8 +300,8 @@ test-lisp-mail-inotify: when: never - changes: - lisp/mail/*.el - - test/lisp/mail/*.el - test/lisp/mail/*resources/** + - test/lisp/mail/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-mail" @@ -317,8 +317,8 @@ test-lisp-mh-e-inotify: when: never - changes: - lisp/mh-e/*.el - - test/lisp/mh-e/*.el - test/lisp/mh-e/*resources/** + - test/lisp/mh-e/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-mh-e" @@ -334,8 +334,8 @@ test-lisp-net-inotify: when: never - changes: - lisp/net/*.el - - test/lisp/net/*.el - test/lisp/net/*resources/** + - test/lisp/net/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-net" @@ -351,8 +351,8 @@ test-lisp-nxml-inotify: when: never - changes: - lisp/nxml/*.el - - test/lisp/nxml/*.el - test/lisp/nxml/*resources/** + - test/lisp/nxml/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-nxml" @@ -368,8 +368,8 @@ test-lisp-obsolete-inotify: when: never - changes: - lisp/obsolete/*.el - - test/lisp/obsolete/*.el - test/lisp/obsolete/*resources/** + - test/lisp/obsolete/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-obsolete" @@ -385,8 +385,8 @@ test-lisp-org-inotify: when: never - changes: - lisp/org/*.el - - test/lisp/org/*.el - test/lisp/org/*resources/** + - test/lisp/org/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-org" @@ -402,8 +402,8 @@ test-lisp-play-inotify: when: never - changes: - lisp/play/*.el - - test/lisp/play/*.el - test/lisp/play/*resources/** + - test/lisp/play/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-play" @@ -417,10 +417,17 @@ test-lisp-progmodes-inotify: rules: - if: '$CI_PIPELINE_SOURCE == "schedule"' when: never + - changes: + - lisp/progmodes/eglot.el + - lisp/progmodes/*-ts-mode.el + - test/lisp/progmodes/eglot-tests.el + - test/lisp/progmodes/*-ts-mode-resources/** + - test/lisp/progmodes/*-ts-mode-tests.el + when: never - changes: - lisp/progmodes/*.el - - test/lisp/progmodes/*.el - test/lisp/progmodes/*resources/** + - test/lisp/progmodes/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-progmodes" @@ -436,8 +443,8 @@ test-lisp-so-long-tests-inotify: when: never - changes: - lisp/so-long*.el - - test/lisp/so-long-tests/*.el - test/lisp/so-long-tests/*resources/** + - test/lisp/so-long-tests/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-so-long-tests" @@ -453,8 +460,8 @@ test-lisp-term-inotify: when: never - changes: - lisp/term/*.el - - test/lisp/term/*.el - test/lisp/term/*resources/** + - test/lisp/term/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-term" @@ -470,8 +477,8 @@ test-lisp-textmodes-inotify: when: never - changes: - lisp/textmodes/*.el - - test/lisp/textmodes/*.el - test/lisp/textmodes/*resources/** + - test/lisp/textmodes/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-textmodes" @@ -487,8 +494,8 @@ test-lisp-url-inotify: when: never - changes: - lisp/url/*.el - - test/lisp/url/*.el - test/lisp/url/*resources/** + - test/lisp/url/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-url" @@ -504,8 +511,8 @@ test-lisp-use-package-inotify: when: never - changes: - lisp/use-package/*.el - - test/lisp/use-package/*.el - test/lisp/use-package/*resources/** + - test/lisp/use-package/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-use-package" @@ -521,8 +528,8 @@ test-lisp-vc-inotify: when: never - changes: - lisp/vc/*.el - - test/lisp/vc/*.el - test/lisp/vc/*resources/** + - test/lisp/vc/*.el variables: target: emacs-inotify make_params: "-k -C test check-lisp-vc" @@ -538,8 +545,8 @@ test-misc-inotify: when: never - changes: - admin/*.el - - test/misc/*.el - test/misc/*resources/** + - test/misc/*.el variables: target: emacs-inotify make_params: "-k -C test check-misc" @@ -555,8 +562,19 @@ test-src-inotify: when: never - changes: - src/*.{h,c} - - test/src/*.el - test/src/*resources/** + - test/src/*.el variables: target: emacs-inotify make_params: "-k -C test check-src" + +.tree-sitter-files-template: + variables: + tree-sitter-files: >- + lisp/progmodes/c-ts-mode-tests.log + lisp/progmodes/elixir-ts-mode-tests.log + lisp/progmodes/go-ts-mode-tests.log + lisp/progmodes/heex-ts-mode-tests.log + lisp/progmodes/java-ts-mode-tests.log + lisp/progmodes/ruby-ts-mode-tests.log + lisp/progmodes/typescript-ts-mode-tests.log -- 2.39.2