xref: /vim-8.2.3635/src/testdir/Make_dos.mak (revision ed37d9b3)
1#
2# Makefile to run all tests for Vim, on Dos-like machines.
3#
4# Requires a set of Unix tools: echo, diff, etc.
5
6VIMPROG = ..\\vim
7
8default: nongui
9
10!include Make_all.mak
11
12# Omitted:
13# test2		"\\tmp" doesn't work.
14# test10	'errorformat' is different
15# test49	fails in various ways
16# test97	\{ and \$ are not escaped characters.
17
18SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4)
19
20TEST_OUTFILES = $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI)
21DOSTMP = dostmp
22DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test)
23DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in)
24
25.SUFFIXES: .in .out .res .vim
26
27nongui:	nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests report
28
29small:	nolog report
30
31gui:	nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests report
32
33win32:	nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests report
34
35# Copy the input files to dostmp, changing the fileformat to dos.
36$(DOSTMP_INFILES): $(*B).in
37	if not exist $(DOSTMP)\NUL md $(DOSTMP)
38	if exist $@ del $@
39	$(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in
40
41# For each input file dostmp/test99.in run the tests.
42# This moves test99.in to test99.in.bak temporarily.
43$(TEST_OUTFILES): $(DOSTMP)\$(*B).in
44	-@if exist test.out DEL test.out
45	-@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out
46	move $(*B).in $(*B).in.bak > nul
47	copy $(DOSTMP)\$(*B).in $(*B).in > nul
48	copy $(*B).ok test.ok > nul
49	$(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in
50	-@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul
51	-@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul
52	-@if exist test.ok del test.ok
53	-@if exist Xdir1 rd /s /q Xdir1
54	-@if exist Xfind rd /s /q Xfind
55	-@if exist XfakeHOME rd /s /q XfakeHOME
56	-@del X*
57	-@if exist viminfo del viminfo
58	$(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \
59		$(DOSTMP)\$(*B).out
60	@diff test.out $*.ok & if errorlevel 1 \
61		( move /y test.out $*.failed > nul \
62		 & del $(DOSTMP)\$(*B).out \
63		 & echo $* FAILED >> test.log ) \
64		else ( move /y test.out $*.out > nul )
65
66# Must run test1 first to create small.vim.
67# This rule must come after the one that copies the input files to dostmp to
68# allow for running an individual test.
69$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS_RES): $(SCRIPTS_FIRST)
70
71report:
72	@rem without the +eval feature test_result.log is a copy of test.log
73	@if exist test.log ( copy /y test.log test_result.log > nul ) \
74		else ( echo No failures reported > test_result.log )
75	$(VIMPROG) -u NONE $(NO_INITS) -S summarize.vim messages
76	@echo.
77	@echo Test results:
78	@cmd /c type test_result.log
79	@if exist test.log ( echo TEST FAILURE & exit /b 1 ) \
80		else ( echo ALL DONE )
81
82clean:
83	-del *.out
84	-del *.failed
85	-del *.res
86	-if exist $(DOSTMP) rd /s /q $(DOSTMP)
87	-if exist test.in del test.in
88	-if exist test.ok del test.ok
89	-if exist small.vim del small.vim
90	-if exist tiny.vim del tiny.vim
91	-if exist mbyte.vim del mbyte.vim
92	-if exist mzscheme.vim del mzscheme.vim
93	-if exist Xdir1 rd /s /q Xdir1
94	-if exist Xfind rd /s /q Xfind
95	-if exist XfakeHOME rd /s /q XfakeHOME
96	-del X*
97	-for /d %i in (X*) do @rmdir /s/q %i
98	-if exist viminfo del viminfo
99	-if exist test.log del test.log
100	-if exist test_result.log del test_result.log
101	-if exist messages del messages
102	-if exist benchmark.out del benchmark.out
103	-if exist opt_test.vim del opt_test.vim
104
105nolog:
106	-if exist test.log del test.log
107	-if exist test_result.log del test_result.log
108	-if exist messages del messages
109
110benchmark: test_bench_regexp.res
111
112test_bench_regexp.res: test_bench_regexp.vim
113	-if exist benchmark.out del benchmark.out
114	@echo $(VIMPROG) > vimcmd
115	$(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
116	@del vimcmd
117	@IF EXIST benchmark.out ( type benchmark.out )
118
119# New style of tests uses Vim script with assert calls.  These are easier
120# to write and a lot easier to read and debug.
121# Limitation: Only works with the +eval feature.
122
123newtests: newtestssilent
124	@if exist messages (findstr "SKIPPED FAILED" messages > nul) && type messages
125
126newtestssilent: $(NEW_TESTS_RES)
127
128.vim.res:
129	@echo $(VIMPROG) > vimcmd
130	$(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
131	@del vimcmd
132
133test_gui.res: test_gui.vim
134	@echo $(VIMPROG) > vimcmd
135	$(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
136	@del vimcmd
137
138test_gui_init.res: test_gui_init.vim
139	@echo $(VIMPROG) > vimcmd
140	$(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim
141	@del vimcmd
142
143test_options.res test_alot.res: opt_test.vim
144
145opt_test.vim: ../optiondefs.h gen_opt_test.vim
146	$(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h
147