blob: f2bd8b740505317e217672d8f6181d0531fc275a [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 Moolenaar34b6cb12008-09-20 14:27:03 +000031# Omitted:
32# test2 "\\tmp" doesn't work.
33# test10 'errorformat' is different
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010034# test97 \{ and \$ are not escaped characters
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000035
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010036SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32)
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000037
Bram Moolenaarfda37292014-11-05 14:27:36 +010038SCRIPTS_BENCH = bench_re_freeze.out
39
Bram Moolenaara6082432015-12-28 16:26:45 +010040# Must run test1 first to create small.vim.
41$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST)
42
Bram Moolenaar9bd31862016-06-13 22:58:39 +020043.SUFFIXES: .in .out .res .vim
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000044
Bram Moolenaar9bd31862016-06-13 22:58:39 +020045vimall: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020046 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000047
Bram Moolenaar9bd31862016-06-13 22:58:39 +020048nongui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020049 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000050
Bram Moolenaarfda37292014-11-05 14:27:36 +010051benchmark: $(SCRIPTS_BENCH)
52
Bram Moolenaar9bd31862016-06-13 22:58:39 +020053small: nolog
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020054 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000055
Bram Moolenaar9bd31862016-06-13 22:58:39 +020056gui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020057 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000058
Bram Moolenaar9bd31862016-06-13 22:58:39 +020059win32: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020060 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000061
Bram Moolenaar9bd31862016-06-13 22:58:39 +020062# TODO: find a way to avoid changing the distributed files.
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000063fixff:
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010064 -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=dos|upd" +q *.in *.ok
65 -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=unix|upd" +q \
Bram Moolenaar4a6fcf82017-10-12 21:29:22 +020066 dotest.in test_listchars.ok \
Bram Moolenaar292eff02017-07-11 21:46:28 +020067 test_wordcount.ok
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000068
69clean:
Bram Moolenaar9bd31862016-06-13 22:58:39 +020070 -@if exist *.out $(DEL) *.out
71 -@if exist *.failed $(DEL) *.failed
72 -@if exist *.res $(DEL) *.res
73 -@if exist test.in $(DEL) test.in
74 -@if exist test.ok $(DEL) test.ok
75 -@if exist small.vim $(DEL) small.vim
76 -@if exist tiny.vim $(DEL) tiny.vim
77 -@if exist mbyte.vim $(DEL) mbyte.vim
78 -@if exist mzscheme.vim $(DEL) mzscheme.vim
79 -@if exist lua.vim $(DEL) lua.vim
80 -@if exist Xdir1 $(DELDIR) Xdir1
81 -@if exist Xfind $(DELDIR) Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +020082 -@if exist XfakeHOME $(DELDIR) XfakeHOME
Bram Moolenaar9bd31862016-06-13 22:58:39 +020083 -@if exist X* $(DEL) X*
84 -@if exist viminfo $(DEL) viminfo
85 -@if exist test.log $(DEL) test.log
86 -@if exist messages $(DEL) messages
Bram Moolenaar65408f72017-03-07 21:31:27 +010087 -@if exist opt_test.vim $(DEL) opt_test.vim
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000088
89.in.out:
Bram Moolenaar9bd31862016-06-13 22:58:39 +020090 -@if exist $*.ok $(CP) $*.ok test.ok
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010091 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $*.in
Bram Moolenaar9bd31862016-06-13 22:58:39 +020092 @diff test.out $*.ok
93 -@if exist $*.out $(DEL) $*.out
94 @$(MV) test.out $*.out
95 -@if exist Xdir1 $(DELDIR) Xdir1
96 -@if exist Xfind $(DELDIR) Xfind
Bram Moolenaar30fe8862017-07-29 23:01:57 +020097 -@if exist XfakeHOME $(DELDIR) XfakeHOME
Bram Moolenaar9bd31862016-06-13 22:58:39 +020098 -@if exist X* $(DEL) X*
99 -@if exist test.ok $(DEL) test.ok
100 -@if exist viminfo $(DEL) viminfo
101
102nolog:
103 -@if exist test.log $(DEL) test.log
104 -@if exist messages $(DEL) messages
Bram Moolenaarfda37292014-11-05 14:27:36 +0100105
106bench_re_freeze.out: bench_re_freeze.vim
107 -$(DEL) benchmark.out
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100108 $(VIMPROG) -u dos.vim $(NO_INITS) $*.in
Bram Moolenaarfda37292014-11-05 14:27:36 +0100109 $(CAT) benchmark.out
Bram Moolenaar9bd31862016-06-13 22:58:39 +0200110
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
115newtests: $(NEW_TESTS)
116
117.vim.res:
Bram Moolenaar4635e112017-10-07 21:05:18 +0200118 @echo $(VIMPROG) > vimcmd
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100119 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
120 @$(DEL) vimcmd
121
122test_gui.res: test_gui.vim
Bram Moolenaar4635e112017-10-07 21:05:18 +0200123 @echo $(VIMPROG) > vimcmd
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100124 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $<
125 @$(DEL) vimcmd
126
127test_gui_init.res: test_gui_init.vim
Bram Moolenaar4635e112017-10-07 21:05:18 +0200128 @echo $(VIMPROG) > vimcmd
Bram Moolenaar84be8b62017-03-13 22:41:42 +0100129 $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $<
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200130 @$(DEL) vimcmd
Bram Moolenaar9bd31862016-06-13 22:58:39 +0200131
Bram Moolenaar65408f72017-03-07 21:31:27 +0100132opt_test.vim: ../option.c gen_opt_test.vim
Bram Moolenaarbb962262017-03-08 00:01:35 +0100133 $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../option.c