blob: 2c00a156f16b75ec75af380f34b0b9fe637c7473 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001#
Bram Moolenaar68392722010-07-30 22:04:17 +02002# Makefile to run all tests for Vim, on Dos-like machines.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003#
4# Requires a set of Unix tools: echo, diff, etc.
5
6VIMPROG = ..\\vim
7
Bram Moolenaar40bbcee2015-12-28 22:24:41 +01008default: nongui
9
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010010!include Make_all.mak
11
Bram Moolenaar071d4272004-06-13 20:20:40 +000012# Omitted:
13# test2 "\\tmp" doesn't work.
14# test10 'errorformat' is different
15# test12 can't unlink a swap file
16# test25 uses symbolic link
Bram Moolenaarda9888a2015-12-28 21:35:14 +010017# test49 fails in various ways
Bram Moolenaaree0ee2a2013-07-03 21:19:07 +020018# test97 \{ and \$ are not escaped characters.
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010020SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4)
Bram Moolenaar071d4272004-06-13 20:20:40 +000021
Bram Moolenaara6082432015-12-28 16:26:45 +010022TEST_OUTFILES = $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI)
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010023DOSTMP = dostmp
24DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test)
25DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in)
Bram Moolenaar071d4272004-06-13 20:20:40 +000026
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010027.SUFFIXES: .in .out .res .vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000028
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010029nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010031small: nolog report
Bram Moolenaar071d4272004-06-13 20:20:40 +000032
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010033gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000034
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010035win32: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000036
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010037# Copy the input files to dostmp, changing the fileformat to dos.
38$(DOSTMP_INFILES): $(*B).in
39 if not exist $(DOSTMP)\NUL md $(DOSTMP)
40 if exist $@ del $@
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010041 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010042
43# For each input file dostmp/test99.in run the tests.
44# This moves test99.in to test99.in.bak temporarily.
45$(TEST_OUTFILES): $(DOSTMP)\$(*B).in
46 -@if exist test.out DEL test.out
Bram Moolenaarb27523f2017-03-16 14:04:51 +010047 -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out
Bram Moolenaar29891c42017-01-06 18:00:12 +010048 move $(*B).in $(*B).in.bak > nul
49 copy $(DOSTMP)\$(*B).in $(*B).in > nul
50 copy $(*B).ok test.ok > nul
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010051 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in
Bram Moolenaar29891c42017-01-06 18:00:12 +010052 -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul
53 -@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010054 -@if exist test.ok del test.ok
55 -@if exist Xdir1 rd /s /q Xdir1
56 -@if exist Xfind rd /s /q Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +020057 -@if exist XfakeHOME rd /s /q XfakeHOME
Bram Moolenaaracf92d22016-01-02 16:00:20 +010058 -@del X*
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010059 -@if exist viminfo del viminfo
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010060 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010061 $(DOSTMP)\$(*B).out
62 @diff test.out $*.ok & if errorlevel 1 \
Bram Moolenaar29891c42017-01-06 18:00:12 +010063 ( move /y test.out $*.failed > nul \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010064 & del $(DOSTMP)\$(*B).out \
65 & echo $* FAILED >> test.log ) \
Bram Moolenaar29891c42017-01-06 18:00:12 +010066 else ( move /y test.out $*.out > nul )
Bram Moolenaarb78b0b02005-01-02 11:32:29 +000067
Bram Moolenaar60461972015-12-30 17:17:10 +010068# Must run test1 first to create small.vim.
69# This rule must come after the one that copies the input files to dostmp to
70# allow for running an individual test.
71$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST)
72
Bram Moolenaar6949eea2013-06-16 16:57:46 +020073report:
74 @echo ""
75 @echo Test results:
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010076 @if exist test.log ( type test.log & echo TEST FAILURE & exit /b 1 ) \
77 else ( echo ALL DONE )
Bram Moolenaar6949eea2013-06-16 16:57:46 +020078
Bram Moolenaar071d4272004-06-13 20:20:40 +000079clean:
80 -del *.out
Bram Moolenaar555d2a82013-06-17 21:53:37 +020081 -del *.failed
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010082 -del *.res
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010083 -if exist $(DOSTMP) rd /s /q $(DOSTMP)
84 -if exist test.in del test.in
Bram Moolenaar9c039782007-08-14 15:55:42 +000085 -if exist test.ok del test.ok
86 -if exist small.vim del small.vim
87 -if exist tiny.vim del tiny.vim
88 -if exist mbyte.vim del mbyte.vim
Bram Moolenaar2498b3a2010-03-02 17:59:44 +010089 -if exist mzscheme.vim del mzscheme.vim
Bram Moolenaarb35c3382012-10-06 19:10:35 +020090 -if exist lua.vim del lua.vim
Bram Moolenaar555d2a82013-06-17 21:53:37 +020091 -if exist Xdir1 rd /s /q Xdir1
92 -if exist Xfind rd /s /q Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +020093 -if exist XfakeHOME rd /s /q XfakeHOME
Bram Moolenaaracf92d22016-01-02 16:00:20 +010094 -del X*
Bram Moolenaard0232912016-01-17 16:15:32 +010095 -for /d %i in (X*) do @rmdir /s/q %i
Bram Moolenaar9c039782007-08-14 15:55:42 +000096 -if exist viminfo del viminfo
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010097 -if exist test.log del test.log
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010098 -if exist messages del messages
Bram Moolenaar9c7d98d2014-11-05 15:46:09 +010099 -if exist benchmark.out del benchmark.out
Bram Moolenaar65408f72017-03-07 21:31:27 +0100100 -if exist opt_test.vim del opt_test.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000101
Bram Moolenaar6949eea2013-06-16 16:57:46 +0200102nolog:
Bram Moolenaar13cf77b2015-02-27 21:11:02 +0100103 -if exist test.log del test.log
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100104 -if exist messages del messages
Bram Moolenaarfda37292014-11-05 14:27:36 +0100105
106benchmark:
107 bench_re_freeze.out
108
109bench_re_freeze.out: bench_re_freeze.vim
110 -if exist benchmark.out del benchmark.out
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100111 $(VIMPROG) -u dos.vim $(NO_INITS) $*.in
Bram Moolenaarfda37292014-11-05 14:27:36 +0100112 @IF EXIST benchmark.out ( type benchmark.out )
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100113
114# New style of tests uses Vim script with assert calls. These are easier
115# to write and a lot easier to read and debug.
116# Limitation: Only works with the +eval feature.
117
118newtests: $(NEW_TESTS)
119
120.vim.res:
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200121 @echo "$(VIMPROG)" > vimcmd
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100122 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
123 @del vimcmd
124
125test_gui.res: test_gui.vim
126 @echo "$(VIMPROG)" > vimcmd
Bram Moolenaar10c60292017-02-23 20:17:13 +0100127 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100128 @del vimcmd
129
130test_gui_init.res: test_gui_init.vim
131 @echo "$(VIMPROG)" > vimcmd
Bram Moolenaar87748452017-03-12 17:10:33 +0100132 $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200133 @del vimcmd
Bram Moolenaar65408f72017-03-07 21:31:27 +0100134
135opt_test.vim: ../option.c gen_opt_test.vim
Bram Moolenaarbb962262017-03-08 00:01:35 +0100136 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../option.c