]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(syntax-tests): Fail when executable syntax tests are found
authorAliaksei Budavei <0x000c70@gmail.com>
Wed, 18 Feb 2026 18:35:26 +0000 (18:35 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 18 Feb 2026 18:35:26 +0000 (18:35 +0000)
The input files with syntax test cases are never compiled or
interpreted on behalf of test runners, just read, and their
parts are rendered in accordance with syntax definitions for
associated languages, to be compared with previously vetted
renderings.  Whether their arbitrary contents will be valid
programs, benign programs, etc., is left for test authors to
decide and verify in their own environments.  As executable
and non-executable files equally qualify for testing and yet
executability is never exercised, and since maintaining
executable files turns out to be a short-lived exception
than common practice, let us persist in keeping syntax files
non-executable and enforce it with a CI check.

closes: #19433

Co-authored-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
.github/workflows/ci.yml
runtime/syntax/Makefile
runtime/syntax/testdir/README.txt
runtime/syntax/testdir/input/sh_mksh_gibberish.ksh [changed mode: 0755->0644]

index ca25f908e2f8334d5c42ecdbbfcdd2fcf5bba565..a8948eed9a6f040615ca352bc03f6600764e4a8e 100644 (file)
@@ -47,7 +47,7 @@ jobs:
             extra: [nogui]
           - features: tiny
             compiler: gcc
-            extra: [nogui]
+            extra: [nogui, syn_test_execs]
           - features: tiny
             compiler: gcc
             extra: [nogui]
@@ -106,6 +106,13 @@ jobs:
           # exit with an error code and list the missing entries.
           make -C ci -f hlgroups.make
 
+      - name: Report executable syntax tests
+        if: contains(matrix.extra, 'syn_test_execs')
+        run: |
+          # Search and list all found executable syntax tests, and exit with
+          # an error code.
+          make -C runtime/syntax executables
+
       - run: sudo dpkg --add-architecture i386
         if: matrix.architecture == 'i386'
 
index 9392b8dc98c189377904015e0b35ef0d9758795a..d0f71270ac77834d69a00c9835d222bb4ec1858f 100644 (file)
@@ -27,7 +27,7 @@ RUN_VIMTEST = VIMRUNTIME=$(VIMRUNTIME) $(VALGRIND) $(ENVVARS) ../$(VIMPROG) -f $
 # DEBUGLOG = --log testlog
 
 # All initial phony targets; these names may clash with file types.
-phonies = clean test testclean
+phonies = clean executables test testclean
 .PHONY: $(phonies)
 
 # Run the tests that didn't run yet or failed previously.
@@ -53,6 +53,9 @@ testdir/testdeps.mk:
 
 -include testdir/testdeps.mk
 
+executables:
+       @! find testdir/input -type f -perm /a+x -exec echo Executable syntax test found: \{\} \; | grep :
+
 clean testclean:
        rm -f testdir/failed/* testdir/done/* testdir/vimcmd testdir/messages testdir/Xtestscript testdir/Xfilter testdir/testdeps.mk
 
index e4f3945c8f8f6c0184241bba0ea307b6d358a843..bd3730435fd3d62ecbc233700e04874339a4ea29 100644 (file)
@@ -146,6 +146,9 @@ is covered by the test.  You can follow these steps:
        - Vim setup file:   syntax/testdir/input/setup/{name}.vim (if any)
        - test input file:  syntax/testdir/input/{name}.{ext}
        - test dump files:  syntax/testdir/dumps/{name}_*.dump
+   Since no input file is ever executed when you run the tests, review and
+   revoke each previously granted permission to execute such a file before
+   publishing it; e.g. "chmod -x input/java.java; git add input/java.java".
 
 As an extra check you can temporarily put back the old syntax plugin and
 verify that the tests fail.  Then you know your changes are covered by the