Skip to content

Commit eb380b9

Browse files
committed
patch 9.1.1525: tests: testdir/ is a bit messy
Problem: tests: testdir is a bit messy Solution: move test scripts into testdir/util/ directory src/testdir/ has become a dumping ground mixing test cases with utility functions. Let's fix this by moving all utility functions into the testdir/util/ directory Also a few related changes had to be done: - Update Filelist - update README.txt and mention the new directory layout - fix shadowbuild by linking the util directory into the shadow dir closes: #17677 Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent b0905e2 commit eb380b9

148 files changed

Lines changed: 234 additions & 228 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Filelist

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -184,64 +184,64 @@ SRC_ALL = \
184184
src/winclip.c \
185185
src/window.c \
186186
src/xxd/xxd.c \
187-
src/testdir/gen_opt_test.vim \
188-
src/testdir/README.txt \
189-
src/testdir/Make_all.mak \
190187
src/testdir/*.in \
191188
src/testdir/*.py \
192-
src/testdir/keycode_check.vim \
189+
src/testdir/Make_all.mak \
190+
src/testdir/README.txt \
191+
src/testdir/commondumps.vim \
192+
src/testdir/crash/* \
193+
src/testdir/dumps/*.dump \
194+
src/testdir/dumps/*.vim \
193195
src/testdir/keycode_check.json \
196+
src/testdir/keycode_check.vim \
194197
src/testdir/lsan-suppress.txt \
195-
src/testdir/sautest/autoload/*.vim \
196-
src/testdir/testluaplugin/lua/testluaplugin/*.lua \
197-
src/testdir/check.vim \
198-
src/testdir/commondumps.vim \
199-
src/testdir/gui_init.vim \
200-
src/testdir/gui_preinit.vim \
201-
src/testdir/mouse.vim \
202-
src/testdir/runtest.vim \
203-
src/testdir/screendump.vim \
204-
src/testdir/setup.vim \
205-
src/testdir/setup_gui.vim \
206-
src/testdir/shared.vim \
207-
src/testdir/vim9.vim \
208-
src/testdir/script_util.vim \
209-
src/testdir/summarize.vim \
210-
src/testdir/term_util.vim \
211-
src/testdir/view_util.vim \
212-
src/testdir/viewdumps.vim \
213-
src/testdir/test[0-9]*.ok \
214-
src/testdir/test77a.ok \
215-
src/testdir/test77a.com \
216-
src/testdir/test_*.vim \
217198
src/testdir/python2/*.py \
218199
src/testdir/python3/*.py \
200+
src/testdir/python_after/*.py \
201+
src/testdir/python_before/*.py \
219202
src/testdir/pythonx/*.py \
220203
src/testdir/pythonx/topmodule/__init__.py \
221204
src/testdir/pythonx/topmodule/submodule/__init__.py \
222205
src/testdir/pythonx/topmodule/submodule/subsubmodule/__init__.py \
223206
src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py \
224-
src/testdir/python_after/*.py \
225-
src/testdir/python_before/*.py \
226207
src/testdir/pyxfile/*.py \
227-
src/testdir/dumps/*.dump \
228-
src/testdir/dumps/*.vim \
208+
src/testdir/ru_RU/LC_MESSAGES/Makefile \
209+
src/testdir/ru_RU/LC_MESSAGES/__PACKAGE__.mo \
210+
src/testdir/ru_RU/LC_MESSAGES/__PACKAGE__.po \
211+
src/testdir/runtest.vim \
229212
src/testdir/samples/*.html \
230213
src/testdir/samples/*.txt \
231214
src/testdir/samples/*.vim \
232215
src/testdir/samples/poc.zip \
233-
src/testdir/samples/test000 \
234216
src/testdir/samples/test.zip \
217+
src/testdir/samples/test000 \
235218
src/testdir/samples/test_undo.txt.undo \
236219
src/testdir/samples/testa.zip \
237-
src/testdir/color_ramp.vim \
220+
src/testdir/sautest/autoload/*.vim \
238221
src/testdir/silent.wav \
239-
src/testdir/popupbounce.vim \
240-
src/testdir/crash/* \
241-
src/testdir/ru_RU/LC_MESSAGES/Makefile \
242-
src/testdir/ru_RU/LC_MESSAGES/__PACKAGE__.po \
243-
src/testdir/ru_RU/LC_MESSAGES/__PACKAGE__.mo \
244-
src/testdir/window_manager.vim \
222+
src/testdir/test77a.com \
223+
src/testdir/test77a.ok \
224+
src/testdir/test[0-9]*.ok \
225+
src/testdir/test_*.vim \
226+
src/testdir/testluaplugin/lua/testluaplugin/*.lua \
227+
src/testdir/util/check.vim \
228+
src/testdir/util/color_ramp.vim \
229+
src/testdir/util/gen_opt_test.vim \
230+
src/testdir/util/gui_init.vim \
231+
src/testdir/util/gui_preinit.vim \
232+
src/testdir/util/mouse.vim \
233+
src/testdir/util/popupbounce.vim \
234+
src/testdir/util/screendump.vim \
235+
src/testdir/util/script_util.vim \
236+
src/testdir/util/setup.vim \
237+
src/testdir/util/setup_gui.vim \
238+
src/testdir/util/shared.vim \
239+
src/testdir/util/summarize.vim \
240+
src/testdir/util/term_util.vim \
241+
src/testdir/util/view_util.vim \
242+
src/testdir/util/vim9.vim \
243+
src/testdir/util/window_manager.vim \
244+
src/testdir/viewdumps.vim \
245245
src/proto.h \
246246
src/protodef.h \
247247
src/proto/alloc.pro \
@@ -521,7 +521,7 @@ SRC_UNIX = \
521521
src/proto/pty.pro \
522522
src/pty.c \
523523
src/testdir/Makefile \
524-
src/testdir/unix.vim \
524+
src/testdir/util/unix.vim \
525525
src/toolcheck \
526526
src/vim_icon.xbm \
527527
src/vim_mask.xbm \
@@ -615,7 +615,7 @@ SRC_DOS = \
615615
src/testdir/Make_dos.mak \
616616
src/testdir/Make_mvc.mak \
617617
src/testdir/Make_ming.mak \
618-
src/testdir/dos.vim \
618+
src/testdir/util/dos.vim \
619619
src/uninstall.c \
620620
src/vim.rc \
621621
src/vim.manifest \
@@ -668,7 +668,7 @@ SRC_AMI = \
668668
src/os_amiga.h \
669669
src/proto/os_amiga.pro \
670670
src/testdir/Make_amiga.mak \
671-
src/testdir/amiga.vim \
671+
src/testdir/util/amiga.vim \
672672
src/xxd/Make_amiga.mak \
673673

674674
# Source files for Haiku (also in the extra archive).
@@ -699,7 +699,7 @@ SRC_VMS = \
699699
src/os_vms_mms.c \
700700
src/proto/os_vms.pro \
701701
src/testdir/Make_vms.mms \
702-
src/testdir/vms.vim \
702+
src/testdir/util/vms.vim \
703703
src/xxd/Make_vms.mms \
704704
vimtutor.com \
705705

runtime/syntax/testdir/runtest.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ endif
6969
" Use the script for source code screendump testing. It sources other scripts,
7070
" therefore we must "cd" there.
7171
cd ../../src/testdir
72-
source screendump.vim
72+
source util/screendump.vim
73+
source util/term_util.vim
7374
exe 'cd ' .. fnameescape(syntaxDir)
7475

7576
" For these tests we need to be able to run terminal Vim with 256 colors. On

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3022,6 +3022,7 @@ shadow: runtime pixmaps
30223022
../../testdir/ru_RU \
30233023
../../testdir/sautest \
30243024
../../testdir/samples \
3025+
../../testdir/util \
30253026
../../testdir/dumps \
30263027
../../testdir/*.ok \
30273028
../../testdir/testluaplugin \

src/testdir/Make_amiga.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ clean:
2121

2222
.in.out:
2323
copy $*.ok test.ok
24-
$(VIMPROG) -u amiga.vim -U NONE --noplugin --not-a-term -s dotest.in $*.in
24+
$(VIMPROG) -u util/amiga.vim -U NONE --noplugin --not-a-term -s dotest.in $*.in
2525
diff test.out $*.ok
2626
rename test.out $*.out
2727
-delete X#? ALL QUIET

src/testdir/Make_ming.mak

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ report:
4646
@rem without the +eval feature test_result.log is a copy of test.log
4747
@if exist test.log ( copy /y test.log test_result.log > nul ) \
4848
else ( echo No failures reported > test_result.log )
49-
$(VIMPROG) -u NONE $(COMMON_ARGS) -S summarize.vim messages
49+
$(VIMPROG) -u NONE $(COMMON_ARGS) -S util\summarize.vim messages
5050
-if exist starttime del starttime
5151
@echo.
5252
@echo Test results:
@@ -105,7 +105,7 @@ tinytests: $(SCRIPTS_TINY_OUT)
105105
$(DOSTMP)/%.in : %.in
106106
if not exist $(DOSTMP)\nul mkdir $(DOSTMP)
107107
if exist $(DOSTMP)\$< $(DEL) $(DOSTMP)\$<
108-
$(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=dos|f $@|wq" $<
108+
$(VIMPROG) -u util\dos.vim $(COMMON_ARGS) "+set ff=dos|f $@|wq" $<
109109

110110
# For each input file dostmp/test99.in run the tests.
111111
# This moves test99.in to test99.in.bak temporarily.
@@ -115,7 +115,7 @@ $(DOSTMP)/%.in : %.in
115115
$(MV) $(notdir $<) $(notdir $<).bak > NUL
116116
$(CP) $(DOSTMP)\$(notdir $<) $(notdir $<) > NUL
117117
$(CP) $(basename $@).ok test.ok > NUL
118-
$(VIMPROG) -u dos.vim $(COMMON_ARGS) -s dotest.in $(notdir $<)
118+
$(VIMPROG) -u util\dos.vim $(COMMON_ARGS) -s dotest.in $(notdir $<)
119119
-@if exist test.out $(MV) test.out $(DOSTMP)\$@ > NUL
120120
-@if exist $(notdir $<).bak $(MV) $(notdir $<).bak $(notdir $<) > NUL
121121
-@if exist test.ok $(DEL) test.ok
@@ -124,7 +124,7 @@ $(DOSTMP)/%.in : %.in
124124
-@if exist XfakeHOME $(DELDIR) XfakeHOME
125125
-@del X*
126126
-@if exist viminfo del viminfo
127-
$(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=unix|f test.out|wq" \
127+
$(VIMPROG) -u util\dos.vim $(COMMON_ARGS) "+set ff=unix|f test.out|wq" \
128128
$(DOSTMP)\$@
129129
@diff test.out $(basename $@).ok & if errorlevel 1 \
130130
( $(MV) test.out $(basename $@).failed > NUL \
@@ -154,10 +154,10 @@ test_gui.res: test_gui.vim
154154

155155
test_gui_init.res: test_gui_init.vim
156156
@echo $(VIMPROG) > vimcmd
157-
$(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $<
157+
$(VIMPROG) -u util\gui_preinit.vim -U util\gui_init.vim $(NO_PLUGINS) -S runtest.vim $<
158158
@$(DEL) vimcmd
159159

160-
opt_test.vim: gen_opt_test.vim ../optiondefs.h ../../runtime/doc/options.txt
160+
opt_test.vim: util/gen_opt_test.vim ../optiondefs.h ../../runtime/doc/options.txt
161161
$(VIMPROG) -e -s -u NONE $(COMMON_ARGS) --nofork -S $^
162162
@if test -f test.log; then \
163163
cat test.log; \

src/testdir/Make_mvc.mak

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ report:
4040
@rem without the +eval feature test_result.log is a copy of test.log
4141
@if exist test.log ( copy /y test.log test_result.log > nul ) \
4242
else ( echo No failures reported > test_result.log )
43-
$(VIMPROG) -u NONE $(COMMON_ARGS) -S summarize.vim messages
43+
$(VIMPROG) -u NONE $(COMMON_ARGS) -S util\summarize.vim messages
4444
-if exist starttime del starttime
4545
@echo:
4646
@echo Test results:
@@ -99,7 +99,7 @@ tinytests: $(SCRIPTS_TINY_OUT)
9999
$(DOSTMP_INFILES): $(*B).in
100100
if not exist $(DOSTMP)\NUL md $(DOSTMP)
101101
if exist $@ del $@
102-
$(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=dos|f $@|wq" $(*B).in
102+
$(VIMPROG) -u util\dos.vim $(COMMON_ARGS) "+set ff=dos|f $@|wq" $(*B).in
103103

104104
# For each input file dostmp/test99.in run the tests.
105105
# This moves test99.in to test99.in.bak temporarily.
@@ -109,7 +109,7 @@ $(TEST_OUTFILES): $(DOSTMP)\$(*B).in
109109
move $(*B).in $(*B).in.bak > nul
110110
copy $(DOSTMP)\$(*B).in $(*B).in > nul
111111
copy $(*B).ok test.ok > nul
112-
$(VIMPROG) -u dos.vim $(COMMON_ARGS) -s dotest.in $(*B).in
112+
$(VIMPROG) -u util\dos.vim $(COMMON_ARGS) -s dotest.in $(*B).in
113113
-@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul
114114
-@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul
115115
-@if exist test.ok del test.ok
@@ -118,7 +118,7 @@ $(TEST_OUTFILES): $(DOSTMP)\$(*B).in
118118
-@if exist XfakeHOME rd /s /q XfakeHOME
119119
-@del X*
120120
-@if exist viminfo del viminfo
121-
$(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=unix|f test.out|wq" \
121+
$(VIMPROG) -u util\dos.vim $(COMMON_ARGS) "+set ff=unix|f test.out|wq" \
122122
$(DOSTMP)\$(*B).out
123123
@diff test.out $*.ok & if errorlevel 1 \
124124
( move /y test.out $*.failed > nul \
@@ -148,10 +148,10 @@ test_gui.res: test_gui.vim
148148

149149
test_gui_init.res: test_gui_init.vim
150150
@echo $(VIMPROG) > vimcmd
151-
$(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim
151+
$(VIMPROG) -u util\gui_preinit.vim -U util\gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim
152152
@del vimcmd
153153

154-
opt_test.vim: gen_opt_test.vim ../optiondefs.h ../../runtime/doc/options.txt
154+
opt_test.vim: util/gen_opt_test.vim ../optiondefs.h ../../runtime/doc/options.txt
155155
$(VIMPROG) -e -s -u NONE $(COMMON_ARGS) --nofork -S $**
156156
@if exist test.log ( type test.log & exit /b 1 )
157157

src/testdir/Make_vms.mms

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ GUI_OPTION = -g
5656
-@ write sys$output " "$*" "
5757
-@ write sys$output "-----------------------------------------------"
5858
-@ !run the test
59-
-@ create/term/wait/nodetach mcr $(VIMPROG) $(GUI_OPTION) -u vms.vim --noplugin -s dotest.in $*.in
59+
-@ create/term/wait/nodetach mcr $(VIMPROG) $(GUI_OPTION) -u util/vms.vim --noplugin -s dotest.in $*.in
6060
-@ !analyse the result
6161
-@ directory /size/date test.out
6262
-@ if "''F$SEARCH("test.out.*")'" .NES. "" then rename/nolog test.out $*.out
@@ -89,9 +89,9 @@ nolog :
8989
-@ write sys$output "-----------------------------------------------"
9090
-@ write sys$output "MAKE_VMS.MMS options:"
9191
-@ write sys$output " WANT_GUI = ""$(WANT_GUI)"" "
92-
-@ write sys$output "Default vimrc file is VMS.VIM:"
92+
-@ write sys$output "Default vimrc file is util/VMS.VIM:"
9393
-@ write sys$output "-----------------------------------------------"
94-
-@ type VMS.VIM
94+
-@ type util/VMS.VIM
9595

9696
clean :
9797
-@ if "''F$SEARCH("*.out")'" .NES. "" then delete/noconfirm/nolog *.out.*

src/testdir/Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ REDIR_TEST_TO_NULL = --cmd 'au SwapExists * let v:swapchoice = "e"' | LC_ALL=C a
2121
# VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=45 --log-file=valgrind.$*
2222

2323
# To execute one test, e.g. in gdb, use something like this:
24-
# run -f -u unix.vim --gui-dialog-file guidialog -U NONE --noplugin --not-a-term -S runtest.vim test_name.vim
24+
# run -f -u util/unix.vim --gui-dialog-file guidialog -U NONE --noplugin --not-a-term -S runtest.vim test_name.vim
2525

2626
default: nongui
2727

@@ -48,7 +48,7 @@ report:
4848
then cp test.log test_result.log; \
4949
else echo No failures reported > test_result.log; \
5050
fi"
51-
$(VIMPROG) -u NONE $(NO_INITS) -S summarize.vim messages $(REDIR_TEST_TO_NULL)
51+
$(VIMPROG) -u NONE $(NO_INITS) -S util/summarize.vim messages $(REDIR_TEST_TO_NULL)
5252
@rm -f starttime
5353
@echo
5454
@echo 'Test results:'
@@ -87,7 +87,7 @@ test_vim9:
8787

8888
RM_ON_RUN = test.out X* viminfo
8989
RM_ON_START = test.ok benchmark.out
90-
RUN_VIMPROG = VIMRUNTIME=$(SCRIPTSOURCE) $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim $(NO_INITS) -s dotest.in
90+
RUN_VIMPROG = VIMRUNTIME=$(SCRIPTSOURCE) $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u util/unix.vim $(NO_INITS) -s dotest.in
9191

9292
# Delete files that may interfere with running tests. This includes some files
9393
# that may result from working on the tests, not only from running them.
@@ -141,7 +141,7 @@ tinytests: $(SCRIPTS_TINY_OUT)
141141
# to write and a lot easier to read and debug.
142142
# Limitation: Only works with the +eval feature.
143143
# Add --gui-dialog-file to avoid getting stuck in a dialog.
144-
RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE) $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim --gui-dialog-file guidialog
144+
RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE) $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u util/unix.vim --gui-dialog-file guidialog
145145

146146
newtests: newtestssilent
147147
@/bin/sh -c "if test -f messages; then cat messages; fi"
@@ -174,13 +174,13 @@ test_gui_init.res: test_gui_init.vim
174174
@echo "$(VIMPROG)" > vimcmd
175175
@echo "$(RUN_GVIMTEST_WITH_GVIMRC)" >> vimcmd
176176
if test -n "$${ASAN_OPTIONS}"; then \
177-
ASAN_OPTIONS="$${ASAN_OPTIONS}_$*" UBSAN_OPTIONS="$${UBSAN_OPTIONS}_$*" $(RUN_VIMTEST) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $< ; \
177+
ASAN_OPTIONS="$${ASAN_OPTIONS}_$*" UBSAN_OPTIONS="$${UBSAN_OPTIONS}_$*" $(RUN_VIMTEST) -u util/gui_preinit.vim -U util/gui_init.vim $(NO_PLUGINS) -S runtest.vim $< ; \
178178
else \
179-
$(RUN_VIMTEST) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $< ; \
179+
$(RUN_VIMTEST) -u util/gui_preinit.vim -U util/gui_init.vim $(NO_PLUGINS) -S runtest.vim $< ; \
180180
fi
181181
@rm vimcmd
182182

183-
GEN_OPT_DEPS = gen_opt_test.vim ../optiondefs.h ../../runtime/doc/options.txt
183+
GEN_OPT_DEPS = util/gen_opt_test.vim ../optiondefs.h ../../runtime/doc/options.txt
184184

185185
opt_test.vim: $(GEN_OPT_DEPS)
186186
if test -n "$${ASAN_OPTIONS}"; then \

src/testdir/README.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
This directory contains tests for various Vim features.
1+
This directory contains test cases for various Vim features.
2+
The auxiliary functions to perform the tests are in the util/ folder.
3+
24
For testing an indent script see runtime/indent/testdir/README.txt.
5+
For testing a syntax script see runtime/syntax/testdir/README.txt.
36

47
If it makes sense, add a new test method to an already existing file. You may
58
want to separate it from other tests with comment lines.

src/testdir/runtest.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ endif
101101
set shellslash
102102

103103
" Common with all tests on all systems.
104-
source setup.vim
104+
source util/setup.vim
105105

106106
" Needed for RunningWithValgrind().
107-
source shared.vim
107+
source util/shared.vim
108108

109109
" Needed for the various Check commands
110-
source check.vim
110+
source util/check.vim
111111

112112
" For consistency run all tests with 'nocompatible' set.
113113
" This also enables use of line continuation.

0 commit comments

Comments
 (0)