blob: 5931da25df03e1dcc956221b0f3d9e993790280d [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 Moolenaarf7c4d832020-08-11 20:42:19 +020012TEST_OUTFILES = $(SCRIPTS_FIRST)
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010013DOSTMP = dostmp
14DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test)
15DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in)
Bram Moolenaar071d4272004-06-13 20:20:40 +000016
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010017.SUFFIXES: .in .out .res .vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000018
Bram Moolenaarf7c4d832020-08-11 20:42:19 +020019nongui: nolog $(SCRIPTS_FIRST) newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000020
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010021small: nolog report
Bram Moolenaar071d4272004-06-13 20:20:40 +000022
Bram Moolenaarf7c4d832020-08-11 20:42:19 +020023gui: nolog $(SCRIPTS_FIRST) newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
Bram Moolenaarf7c4d832020-08-11 20:42:19 +020025win32: nolog $(SCRIPTS_FIRST) newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000026
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010027# 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 $@
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010031 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010032
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
Bram Moolenaarb27523f2017-03-16 14:04:51 +010037 -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out
Bram Moolenaar29891c42017-01-06 18:00:12 +010038 move $(*B).in $(*B).in.bak > nul
39 copy $(DOSTMP)\$(*B).in $(*B).in > nul
40 copy $(*B).ok test.ok > nul
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010041 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in
Bram Moolenaar29891c42017-01-06 18:00:12 +010042 -@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
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010044 -@if exist test.ok del test.ok
45 -@if exist Xdir1 rd /s /q Xdir1
46 -@if exist Xfind rd /s /q Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +020047 -@if exist XfakeHOME rd /s /q XfakeHOME
Bram Moolenaaracf92d22016-01-02 16:00:20 +010048 -@del X*
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010049 -@if exist viminfo del viminfo
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010050 $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010051 $(DOSTMP)\$(*B).out
52 @diff test.out $*.ok & if errorlevel 1 \
Bram Moolenaar29891c42017-01-06 18:00:12 +010053 ( move /y test.out $*.failed > nul \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010054 & del $(DOSTMP)\$(*B).out \
55 & echo $* FAILED >> test.log ) \
Bram Moolenaar29891c42017-01-06 18:00:12 +010056 else ( move /y test.out $*.out > nul )
Bram Moolenaarb78b0b02005-01-02 11:32:29 +000057
Bram Moolenaar60461972015-12-30 17:17:10 +010058# 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.
Bram Moolenaarec504012019-01-11 17:30:16 +010061$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS_RES): $(SCRIPTS_FIRST)
Bram Moolenaar60461972015-12-30 17:17:10 +010062
Bram Moolenaar6949eea2013-06-16 16:57:46 +020063report:
Bram Moolenaard53ebfc2019-10-20 21:47:20 +020064 @rem without the +eval feature test_result.log is a copy of test.log
65 @if exist test.log ( copy /y test.log test_result.log > nul ) \
66 else ( echo No failures reported > test_result.log )
67 $(VIMPROG) -u NONE $(NO_INITS) -S summarize.vim messages
68 @echo.
Bram Moolenaar6949eea2013-06-16 16:57:46 +020069 @echo Test results:
Bram Moolenaar7d232042019-11-05 22:37:20 +010070 @cmd /c type test_result.log
Bram Moolenaard53ebfc2019-10-20 21:47:20 +020071 @if exist test.log ( echo TEST FAILURE & exit /b 1 ) \
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010072 else ( echo ALL DONE )
Bram Moolenaar6949eea2013-06-16 16:57:46 +020073
Bram Moolenaar071d4272004-06-13 20:20:40 +000074clean:
75 -del *.out
Bram Moolenaar555d2a82013-06-17 21:53:37 +020076 -del *.failed
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010077 -del *.res
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010078 -if exist $(DOSTMP) rd /s /q $(DOSTMP)
79 -if exist test.in del test.in
Bram Moolenaar9c039782007-08-14 15:55:42 +000080 -if exist test.ok del test.ok
81 -if exist small.vim del small.vim
82 -if exist tiny.vim del tiny.vim
83 -if exist mbyte.vim del mbyte.vim
Bram Moolenaar2498b3a2010-03-02 17:59:44 +010084 -if exist mzscheme.vim del mzscheme.vim
Bram Moolenaar555d2a82013-06-17 21:53:37 +020085 -if exist Xdir1 rd /s /q Xdir1
86 -if exist Xfind rd /s /q Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +020087 -if exist XfakeHOME rd /s /q XfakeHOME
Bram Moolenaaracf92d22016-01-02 16:00:20 +010088 -del X*
Bram Moolenaard0232912016-01-17 16:15:32 +010089 -for /d %i in (X*) do @rmdir /s/q %i
Bram Moolenaar9c039782007-08-14 15:55:42 +000090 -if exist viminfo del viminfo
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010091 -if exist test.log del test.log
Bram Moolenaard53ebfc2019-10-20 21:47:20 +020092 -if exist test_result.log del test_result.log
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010093 -if exist messages del messages
Bram Moolenaar9c7d98d2014-11-05 15:46:09 +010094 -if exist benchmark.out del benchmark.out
Bram Moolenaar65408f72017-03-07 21:31:27 +010095 -if exist opt_test.vim del opt_test.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000096
Bram Moolenaar6949eea2013-06-16 16:57:46 +020097nolog:
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010098 -if exist test.log del test.log
Bram Moolenaard53ebfc2019-10-20 21:47:20 +020099 -if exist test_result.log del test_result.log
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100100 -if exist messages del messages
Bram Moolenaarfda37292014-11-05 14:27:36 +0100101
Bram Moolenaarad48e6c2020-04-21 22:19:45 +0200102benchmark: test_bench_regexp.res
Bram Moolenaarfda37292014-11-05 14:27:36 +0100103
Bram Moolenaarad48e6c2020-04-21 22:19:45 +0200104test_bench_regexp.res: test_bench_regexp.vim
Bram Moolenaarfda37292014-11-05 14:27:36 +0100105 -if exist benchmark.out del benchmark.out
Bram Moolenaarad48e6c2020-04-21 22:19:45 +0200106 @echo $(VIMPROG) > vimcmd
107 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
108 @del vimcmd
Bram Moolenaarfda37292014-11-05 14:27:36 +0100109 @IF EXIST benchmark.out ( type benchmark.out )
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100110
111# New style of tests uses Vim script with assert calls. These are easier
112# to write and a lot easier to read and debug.
113# Limitation: Only works with the +eval feature.
114
Bram Moolenaar933bef72018-09-20 21:39:33 +0200115newtests: newtestssilent
116 @if exist messages (findstr "SKIPPED FAILED" messages > nul) && type messages
117
Bram Moolenaarec504012019-01-11 17:30:16 +0100118newtestssilent: $(NEW_TESTS_RES)
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100119
120.vim.res:
Bram Moolenaar4635e112017-10-07 21:05:18 +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
Bram Moolenaar4635e112017-10-07 21:05:18 +0200126 @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
Bram Moolenaar4635e112017-10-07 21:05:18 +0200131 @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
Bram Moolenaar46fd6bf2019-01-11 19:19:44 +0100135test_options.res test_alot.res: opt_test.vim
136
Bram Moolenaard9b0d832019-09-14 15:46:32 +0200137opt_test.vim: ../optiondefs.h gen_opt_test.vim
138 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h