blob: e1f34674920ea37bc75f620977a9bf7276e87860 [file] [log] [blame]
Bram Moolenaar68392722010-07-30 22:04:17 +02001#
2# Makefile to run all tests for Vim, on Dos-like machines
Bram Moolenaar34b6cb12008-09-20 14:27:03 +00003# with sh.exe or zsh.exe in the path or not.
4#
5# Author: Bill McCarthy
6#
Bram Moolenaar34b6cb12008-09-20 14:27:03 +00007# Requires a set of Unix tools: echo, diff, etc.
8
9ifneq (sh.exe, $(SHELL))
10DEL = rm -f
Bram Moolenaaracf92d22016-01-02 16:00:20 +010011DELDIR = rm -rf
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000012MV = mv
13CP = cp
Bram Moolenaarfda37292014-11-05 14:27:36 +010014CAT = cat
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000015DIRSLASH = /
16else
17DEL = del
Bram Moolenaaracf92d22016-01-02 16:00:20 +010018DELDIR = rd /s /q
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000019MV = rename
20CP = copy
Bram Moolenaarfda37292014-11-05 14:27:36 +010021CAT = type
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000022DIRSLASH = \\
23endif
24
25VIMPROG = ..$(DIRSLASH)vim
26
Bram Moolenaar40bbcee2015-12-28 22:24:41 +010027default: vimall
28
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010029include Make_all.mak
30
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010031SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32)
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000032
Bram Moolenaarad48e6c2020-04-21 22:19:45 +020033SCRIPTS_BENCH = test_bench_regexp.res
Bram Moolenaarfda37292014-11-05 14:27:36 +010034
Bram Moolenaara6082432015-12-28 16:26:45 +010035# Must run test1 first to create small.vim.
Bram Moolenaarec504012019-01-11 17:30:16 +010036$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS_RES): $(SCRIPTS_FIRST)
Bram Moolenaara6082432015-12-28 16:26:45 +010037
Bram Moolenaar9bd31862016-06-13 22:58:39 +020038.SUFFIXES: .in .out .res .vim
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000039
Bram Moolenaar9bd31862016-06-13 22:58:39 +020040vimall: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020041 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000042
Bram Moolenaar9bd31862016-06-13 22:58:39 +020043nongui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020044 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000045
Bram Moolenaarfda37292014-11-05 14:27:36 +010046benchmark: $(SCRIPTS_BENCH)
47
Bram Moolenaar9bd31862016-06-13 22:58:39 +020048small: nolog
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020049 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000050
Bram Moolenaar9bd31862016-06-13 22:58:39 +020051gui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020052 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000053
Bram Moolenaar9bd31862016-06-13 22:58:39 +020054win32: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020055 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000056
Bram Moolenaar9bd31862016-06-13 22:58:39 +020057# TODO: find a way to avoid changing the distributed files.
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000058fixff:
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010059 -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=dos|upd" +q *.in *.ok
60 -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=unix|upd" +q \
Bram Moolenaara703aae2017-12-11 22:55:26 +010061 dotest.in
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000062
63clean:
Bram Moolenaar9bd31862016-06-13 22:58:39 +020064 -@if exist *.out $(DEL) *.out
65 -@if exist *.failed $(DEL) *.failed
66 -@if exist *.res $(DEL) *.res
67 -@if exist test.in $(DEL) test.in
68 -@if exist test.ok $(DEL) test.ok
69 -@if exist small.vim $(DEL) small.vim
70 -@if exist tiny.vim $(DEL) tiny.vim
71 -@if exist mbyte.vim $(DEL) mbyte.vim
72 -@if exist mzscheme.vim $(DEL) mzscheme.vim
Bram Moolenaar9bd31862016-06-13 22:58:39 +020073 -@if exist Xdir1 $(DELDIR) Xdir1
74 -@if exist Xfind $(DELDIR) Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +020075 -@if exist XfakeHOME $(DELDIR) XfakeHOME
Bram Moolenaar9bd31862016-06-13 22:58:39 +020076 -@if exist X* $(DEL) X*
77 -@if exist viminfo $(DEL) viminfo
78 -@if exist test.log $(DEL) test.log
79 -@if exist messages $(DEL) messages
Bram Moolenaar65408f72017-03-07 21:31:27 +010080 -@if exist opt_test.vim $(DEL) opt_test.vim
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000081
Bram Moolenaarfb1199d2019-01-24 12:18:46 +010082test1.out: test1.in
83 -@if exist wrongtermsize $(DEL) wrongtermsize
84 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in test1.in
85 -@if exist wrongtermsize ( \
86 echo Vim window too small- must be 80x25 or larger && exit 1 \
87 )
88 -@if exist test.out $(DEL) test.out
89 -@if exist viminfo $(DEL) viminfo
90
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000091.in.out:
Bram Moolenaar9bd31862016-06-13 22:58:39 +020092 -@if exist $*.ok $(CP) $*.ok test.ok
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010093 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $*.in
Bram Moolenaar9bd31862016-06-13 22:58:39 +020094 @diff test.out $*.ok
95 -@if exist $*.out $(DEL) $*.out
96 @$(MV) test.out $*.out
97 -@if exist Xdir1 $(DELDIR) Xdir1
98 -@if exist Xfind $(DELDIR) Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +020099 -@if exist XfakeHOME $(DELDIR) XfakeHOME
Bram Moolenaar9bd31862016-06-13 22:58:39 +0200100 -@if exist X* $(DEL) X*
101 -@if exist test.ok $(DEL) test.ok
102 -@if exist viminfo $(DEL) viminfo
103
104nolog:
105 -@if exist test.log $(DEL) test.log
106 -@if exist messages $(DEL) messages
Bram Moolenaarfda37292014-11-05 14:27:36 +0100107
Bram Moolenaarad48e6c2020-04-21 22:19:45 +0200108test_bench_regexp.res: test_bench_regexp.vim
Bram Moolenaarfda37292014-11-05 14:27:36 +0100109 -$(DEL) benchmark.out
Bram Moolenaarad48e6c2020-04-21 22:19:45 +0200110 @echo $(VIMPROG) > vimcmd
111 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
112 @$(DEL) vimcmd
Bram Moolenaarfda37292014-11-05 14:27:36 +0100113 $(CAT) benchmark.out
Bram Moolenaar9bd31862016-06-13 22:58:39 +0200114
115# New style of tests uses Vim script with assert calls. These are easier
116# to write and a lot easier to read and debug.
117# Limitation: Only works with the +eval feature.
118
Bram Moolenaarec504012019-01-11 17:30:16 +0100119newtests: $(NEW_TESTS_RES)
Bram Moolenaar9bd31862016-06-13 22:58:39 +0200120
121.vim.res:
Bram Moolenaar4635e112017-10-07 21:05:18 +0200122 @echo $(VIMPROG) > vimcmd
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100123 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
124 @$(DEL) vimcmd
125
126test_gui.res: test_gui.vim
Bram Moolenaar4635e112017-10-07 21:05:18 +0200127 @echo $(VIMPROG) > vimcmd
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100128 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $<
129 @$(DEL) vimcmd
130
131test_gui_init.res: test_gui_init.vim
Bram Moolenaar4635e112017-10-07 21:05:18 +0200132 @echo $(VIMPROG) > vimcmd
Bram Moolenaar84be8b62017-03-13 22:41:42 +0100133 $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $<
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200134 @$(DEL) vimcmd
Bram Moolenaar9bd31862016-06-13 22:58:39 +0200135
Bram Moolenaar46fd6bf2019-01-11 19:19:44 +0100136test_options.res test_alot.res: opt_test.vim
137
Bram Moolenaard9b0d832019-09-14 15:46:32 +0200138opt_test.vim: ../optiondefs.h gen_opt_test.vim
139 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h