Skip to content

Commit b96a32e

Browse files
committed
patch 8.2.1439: tiny and small builds have no test coverage
Problem: Tiny and small builds have no test coverage. Solution: Restore tests that do not depend on the +eval feature. (Ken Takata, closes #6696)
1 parent 7ac616c commit b96a32e

33 files changed

Lines changed: 606 additions & 213 deletions

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ env:
77
_anchors:
88
envs:
99
- &tiny-nogui
10-
FEATURES=tiny CONFOPT="--disable-gui"
10+
FEATURES=tiny TEST=testtiny CONFOPT="--disable-gui"
1111
- &tiny
12-
FEATURES=tiny
12+
FEATURES=tiny TEST=testtiny
1313
- &small
14-
FEATURES=small
14+
FEATURES=small TEST=testtiny
1515
- &normal
1616
FEATURES=normal
1717
- &linux-huge

Filelist

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ SRC_ALL = \
158158
src/testdir/gen_opt_test.vim \
159159
src/testdir/README.txt \
160160
src/testdir/Make_all.mak \
161-
src/testdir/dotest.in \
162-
src/testdir/test1.in \
163-
src/testdir/test77a.in \
161+
src/testdir/*.in \
164162
src/testdir/*.py \
165163
src/testdir/lsan-suppress.txt \
166164
src/testdir/sautest/autoload/*.vim \
@@ -179,7 +177,7 @@ SRC_ALL = \
179177
src/testdir/summarize.vim \
180178
src/testdir/term_util.vim \
181179
src/testdir/view_util.vim \
182-
- src/testdir/test1.ok \
180+
src/testdir/test[0-9]*.ok \
183181
src/testdir/test77a.ok \
184182
src/testdir/test83-tags? \
185183
src/testdir/test77a.com \

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ first:
3232

3333
# Some make programs use the last target for the $@ default; put the other
3434
# targets separately to always let $@ expand to "first" by default.
35-
all install uninstall tools config configure reconfig proto depend lint tags types test scripttests test_libvterm unittests testclean clean distclean:
35+
all install uninstall tools config configure reconfig proto depend lint tags types test scripttests testtiny test_libvterm unittests testclean clean distclean:
3636
@if test ! -f src/auto/config.mk; then \
3737
cp src/config.mk.dist src/auto/config.mk; \
3838
fi

runtime/doc/testing.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ and for testing plugins.
2020
Vim can be tested after building it, usually with "make test".
2121
The tests are located in the directory "src/testdir".
2222

23+
There are two types of tests added over time:
24+
test20.in oldest, only for tiny and small builds
25+
test_something.vim new style tests
26+
2327
*new-style-testing*
2428
New tests should be added as new style tests. The test scripts are named
2529
test_<feature>.vim (replace <feature> with the feature under test). These use
2630
functions such as |assert_equal()| to keep the test commands and the expected
2731
result in one place.
32+
*old-style-testing*
33+
These tests are used only for testing Vim without the |+eval| feature.
2834

2935
Find more information in the file src/testdir/README.txt.
3036

src/Make_mvc.mak

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,22 +1464,32 @@ cmdidxs: ex_cmds.h
14641464

14651465
test:
14661466
cd testdir
1467-
$(MAKE) /NOLOGO -f Make_dos.mak win32
1467+
$(MAKE) /NOLOGO -f Make_dos.mak
14681468
cd ..
14691469

14701470
testgvim:
14711471
cd testdir
1472-
$(MAKE) /NOLOGO -f Make_dos.mak VIMPROG=..\gvim win32
1472+
$(MAKE) /NOLOGO -f Make_dos.mak VIMPROG=..\gvim
1473+
cd ..
1474+
1475+
testtiny:
1476+
cd testdir
1477+
$(MAKE) /NOLOGO -f Make_dos.mak tiny
1478+
cd ..
1479+
1480+
testgvimtiny:
1481+
cd testdir
1482+
$(MAKE) /NOLOGO -f Make_dos.mak tiny VIMPROG=..\gvim
14731483
cd ..
14741484

14751485
testclean:
14761486
cd testdir
14771487
$(MAKE) /NOLOGO -f Make_dos.mak clean
14781488
cd ..
14791489

1480-
# Run test1 to bootstrap tests
1490+
# Run individual OLD style test.
14811491
# These do not depend on the executable, compile it when needed.
1482-
$(SCRIPTS_FIRST:.out=):
1492+
$(SCRIPTS_TINY):
14831493
cd testdir
14841494
- if exist $@.out del $@.out
14851495
$(MAKE) /NOLOGO -f Make_dos.mak VIMPROG=..\$(VIMTESTTARGET) nolog

src/Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,6 +2258,9 @@ scripttests:
22582258
testgui:
22592259
cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) GUI_FLAG=-g $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
22602260

2261+
testtiny:
2262+
cd testdir; $(MAKE) -f Makefile tiny VIMPROG=../$(VIMTARGET) SCRIPTSOURCE=../$(SCRIPTSOURCE)
2263+
22612264
benchmark:
22622265
cd testdir; $(MAKE) -f Makefile benchmark VIMPROG=../$(VIMTARGET) SCRIPTSOURCE=../$(SCRIPTSOURCE)
22632266

@@ -2291,9 +2294,9 @@ test_libvterm:
22912294
CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"; \
22922295
fi
22932296

2294-
# Run test1, used to bootstrap tests.
2295-
# This does not depend on the executable, compile first it when needed.
2296-
test1:
2297+
# Run individual OLD style test.
2298+
# These do not depend on the executable, compile it when needed.
2299+
$(SCRIPTS_TINY):
22972300
cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
22982301

22992302
# Run individual NEW style test.

src/testdir/Make_all.mak

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,26 @@
77
NO_PLUGINS = --noplugin --not-a-term
88
NO_INITS = -U NONE $(NO_PLUGINS)
99

10-
# The first script creates small.vim.
11-
SCRIPTS_FIRST = test1.out
10+
# Tests for tiny and small builds.
11+
SCRIPTS_TINY = \
12+
test20 \
13+
test21 \
14+
test22 \
15+
test23 \
16+
test24 \
17+
test25 \
18+
test26 \
19+
test27
20+
21+
SCRIPTS_TINY_OUT = \
22+
test20.out \
23+
test21.out \
24+
test22.out \
25+
test23.out \
26+
test24.out \
27+
test25.out \
28+
test26.out \
29+
test27.out
1230

1331
# Tests for Vim9 script.
1432
TEST_VIM9 = \
@@ -25,6 +43,9 @@ TEST_VIM9_RES = \
2543
test_vim9_func.res \
2644
test_vim9_script.res
2745

46+
# Benchmark scripts.
47+
SCRIPTS_BENCH = test_bench_regexp.res
48+
2849
# Individual tests, including the ones part of test_alot.
2950
# Please keep sorted up to test_alot.
3051
NEW_TESTS = \

src/testdir/Make_amiga.mak

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ default: nongui
99

1010
include Make_all.mak
1111

12+
SCRIPTS = $(SCRIPTS_TINY_OUT)
13+
1214
.SUFFIXES: .in .out .res .vim
1315

14-
nongui: /tmp $(SCRIPTS_FIRST)
16+
nongui: /tmp $(SCRIPTS)
1517
csh -c echo ALL DONE
1618

1719
clean:

src/testdir/Make_dos.mak

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -9,56 +9,23 @@ default: nongui
99

1010
!include Make_all.mak
1111

12-
TEST_OUTFILES = $(SCRIPTS_FIRST)
12+
# Explicit dependencies.
13+
test_options.res test_alot.res: opt_test.vim
14+
15+
TEST_OUTFILES = $(SCRIPTS_TINY_OUT)
1316
DOSTMP = dostmp
1417
DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test)
1518
DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in)
1619

1720
.SUFFIXES: .in .out .res .vim
1821

19-
nongui: nolog $(SCRIPTS_FIRST) newtests report
22+
nongui: nolog tinytests newtests report
2023

21-
small: nolog report
24+
gui: nolog tinytests newtests report
2225

23-
gui: nolog $(SCRIPTS_FIRST) newtests report
26+
tiny: nolog tinytests report
2427

25-
win32: nolog $(SCRIPTS_FIRST) newtests report
26-
27-
# Copy the input files to dostmp, changing the fileformat to dos.
28-
$(DOSTMP_INFILES): $(*B).in
29-
if not exist $(DOSTMP)\NUL md $(DOSTMP)
30-
if exist $@ del $@
31-
$(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in
32-
33-
# For each input file dostmp/test99.in run the tests.
34-
# This moves test99.in to test99.in.bak temporarily.
35-
$(TEST_OUTFILES): $(DOSTMP)\$(*B).in
36-
-@if exist test.out DEL test.out
37-
-@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out
38-
move $(*B).in $(*B).in.bak > nul
39-
copy $(DOSTMP)\$(*B).in $(*B).in > nul
40-
copy $(*B).ok test.ok > nul
41-
$(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in
42-
-@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul
43-
-@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul
44-
-@if exist test.ok del test.ok
45-
-@if exist Xdir1 rd /s /q Xdir1
46-
-@if exist Xfind rd /s /q Xfind
47-
-@if exist XfakeHOME rd /s /q XfakeHOME
48-
-@del X*
49-
-@if exist viminfo del viminfo
50-
$(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \
51-
$(DOSTMP)\$(*B).out
52-
@diff test.out $*.ok & if errorlevel 1 \
53-
( move /y test.out $*.failed > nul \
54-
& del $(DOSTMP)\$(*B).out \
55-
& echo $* FAILED >> test.log ) \
56-
else ( move /y test.out $*.out > nul )
57-
58-
# Must run test1 first to create small.vim.
59-
# This rule must come after the one that copies the input files to dostmp to
60-
# allow for running an individual test.
61-
$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS_RES): $(SCRIPTS_FIRST)
28+
benchmark: $(SCRIPTS_BENCH)
6229

6330
report:
6431
@rem without the +eval feature test_result.log is a copy of test.log
@@ -71,10 +38,24 @@ report:
7138
@if exist test.log ( echo TEST FAILURE & exit /b 1 ) \
7239
else ( echo ALL DONE )
7340

41+
42+
# Execute an individual new style test, e.g.:
43+
# nmake -f Make_dos.mak test_largefile
44+
$(NEW_TESTS):
45+
-if exist $@.res del $@.res
46+
-if exist test.log del test.log
47+
-if exist messages del messages
48+
@$(MAKE) -nologo -f Make_dos.mak $@.res VIMPROG=$(VIMPROG)
49+
@type messages
50+
@if exist test.log exit 1
51+
52+
53+
# Delete files that may interfere with running tests. This includes some files
54+
# that may result from working on the tests, not only from running them.
7455
clean:
75-
-del *.out
76-
-del *.failed
77-
-del *.res
56+
-if exist *.out $(DEL) *.out
57+
-if exist *.failed $(DEL) *.failed
58+
-if exist *.res $(DEL) *.res
7859
-if exist $(DOSTMP) rd /s /q $(DOSTMP)
7960
-if exist test.in del test.in
8061
-if exist test.ok del test.ok
@@ -85,8 +66,8 @@ clean:
8566
-if exist Xdir1 rd /s /q Xdir1
8667
-if exist Xfind rd /s /q Xfind
8768
-if exist XfakeHOME rd /s /q XfakeHOME
88-
-del X*
89-
-for /d %i in (X*) do @rmdir /s/q %i
69+
-if exist X* $(DEL) X*
70+
-for /d %i in (X*) do @rd /s/q %i
9071
-if exist viminfo del viminfo
9172
-if exist test.log del test.log
9273
-if exist test_result.log del test_result.log
@@ -99,14 +80,41 @@ nolog:
9980
-if exist test_result.log del test_result.log
10081
-if exist messages del messages
10182

102-
benchmark: test_bench_regexp.res
10383

104-
test_bench_regexp.res: test_bench_regexp.vim
105-
-if exist benchmark.out del benchmark.out
106-
@echo $(VIMPROG) > vimcmd
107-
$(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
108-
@del vimcmd
109-
@IF EXIST benchmark.out ( type benchmark.out )
84+
# Tiny tests. Works even without the +eval feature.
85+
tinytests: $(SCRIPTS_TINY_OUT)
86+
87+
# Copy the input files to dostmp, changing the fileformat to dos.
88+
$(DOSTMP_INFILES): $(*B).in
89+
if not exist $(DOSTMP)\NUL md $(DOSTMP)
90+
if exist $@ del $@
91+
$(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in
92+
93+
# For each input file dostmp/test99.in run the tests.
94+
# This moves test99.in to test99.in.bak temporarily.
95+
$(TEST_OUTFILES): $(DOSTMP)\$(*B).in
96+
-@if exist test.out DEL test.out
97+
-@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out
98+
move $(*B).in $(*B).in.bak > nul
99+
copy $(DOSTMP)\$(*B).in $(*B).in > nul
100+
copy $(*B).ok test.ok > nul
101+
$(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in
102+
-@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul
103+
-@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul
104+
-@if exist test.ok del test.ok
105+
-@if exist Xdir1 rd /s /q Xdir1
106+
-@if exist Xfind rd /s /q Xfind
107+
-@if exist XfakeHOME rd /s /q XfakeHOME
108+
-@del X*
109+
-@if exist viminfo del viminfo
110+
$(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \
111+
$(DOSTMP)\$(*B).out
112+
@diff test.out $*.ok & if errorlevel 1 \
113+
( move /y test.out $*.failed > nul \
114+
& del $(DOSTMP)\$(*B).out \
115+
& echo $* FAILED >> test.log ) \
116+
else ( move /y test.out $*.out > nul )
117+
110118

111119
# New style of tests uses Vim script with assert calls. These are easier
112120
# to write and a lot easier to read and debug.
@@ -132,7 +140,12 @@ test_gui_init.res: test_gui_init.vim
132140
$(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim
133141
@del vimcmd
134142

135-
test_options.res test_alot.res: opt_test.vim
136-
137143
opt_test.vim: ../optiondefs.h gen_opt_test.vim
138144
$(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h
145+
146+
test_bench_regexp.res: test_bench_regexp.vim
147+
-if exist benchmark.out del benchmark.out
148+
@echo $(VIMPROG) > vimcmd
149+
$(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
150+
@del vimcmd
151+
@IF EXIST benchmark.out ( type benchmark.out )

0 commit comments

Comments
 (0)