blob: 61d77d2f53d9227450a3dbd387be0c21c7986b1d [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#
7# Note that test54 has been removed until it is fixed.
8#
9# Requires a set of Unix tools: echo, diff, etc.
10
11ifneq (sh.exe, $(SHELL))
12DEL = rm -f
Bram Moolenaaracf92d22016-01-02 16:00:20 +010013DELDIR = rm -rf
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000014MV = mv
15CP = cp
Bram Moolenaarfda37292014-11-05 14:27:36 +010016CAT = cat
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000017DIRSLASH = /
18else
19DEL = del
Bram Moolenaaracf92d22016-01-02 16:00:20 +010020DELDIR = rd /s /q
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000021MV = rename
22CP = copy
Bram Moolenaarfda37292014-11-05 14:27:36 +010023CAT = type
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000024DIRSLASH = \\
25endif
26
27VIMPROG = ..$(DIRSLASH)vim
28
Bram Moolenaar40bbcee2015-12-28 22:24:41 +010029default: vimall
30
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010031include Make_all.mak
32
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000033# Omitted:
34# test2 "\\tmp" doesn't work.
35# test10 'errorformat' is different
36# test12 can't unlink a swap file
37# test25 uses symbolic link
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010038# test54 doesn't work yet
39# test97 \{ and \$ are not escaped characters
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000040
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010041SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) $(SCRIPTS_WIN32)
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000042
Bram Moolenaarfda37292014-11-05 14:27:36 +010043SCRIPTS_BENCH = bench_re_freeze.out
44
Bram Moolenaara6082432015-12-28 16:26:45 +010045# Must run test1 first to create small.vim.
46$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST)
47
Bram Moolenaar9bd31862016-06-13 22:58:39 +020048.SUFFIXES: .in .out .res .vim
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000049
Bram Moolenaar9bd31862016-06-13 22:58:39 +020050vimall: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020051 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000052
Bram Moolenaar9bd31862016-06-13 22:58:39 +020053nongui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020054 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000055
Bram Moolenaarfda37292014-11-05 14:27:36 +010056benchmark: $(SCRIPTS_BENCH)
57
Bram Moolenaar9bd31862016-06-13 22:58:39 +020058small: nolog
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020059 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000060
Bram Moolenaar9bd31862016-06-13 22:58:39 +020061gui: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020062 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000063
Bram Moolenaar9bd31862016-06-13 22:58:39 +020064win32: fixff nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests
Bram Moolenaar5b4a3762016-08-06 20:36:34 +020065 @echo ALL DONE
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000066
Bram Moolenaar9bd31862016-06-13 22:58:39 +020067# TODO: find a way to avoid changing the distributed files.
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000068fixff:
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010069 -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=dos|upd" +q *.in *.ok
70 -$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=unix|upd" +q \
Bram Moolenaar3f9ebf32016-11-07 22:13:32 +010071 dotest.in test60.ok test_listchars.ok \
Bram Moolenaar298c6592016-04-02 22:24:20 +020072 test_getcwd.ok test_wordcount.ok
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000073
74clean:
Bram Moolenaar9bd31862016-06-13 22:58:39 +020075 -@if exist *.out $(DEL) *.out
76 -@if exist *.failed $(DEL) *.failed
77 -@if exist *.res $(DEL) *.res
78 -@if exist test.in $(DEL) test.in
79 -@if exist test.ok $(DEL) test.ok
80 -@if exist small.vim $(DEL) small.vim
81 -@if exist tiny.vim $(DEL) tiny.vim
82 -@if exist mbyte.vim $(DEL) mbyte.vim
83 -@if exist mzscheme.vim $(DEL) mzscheme.vim
84 -@if exist lua.vim $(DEL) lua.vim
85 -@if exist Xdir1 $(DELDIR) Xdir1
86 -@if exist Xfind $(DELDIR) Xfind
87 -@if exist X* $(DEL) X*
88 -@if exist viminfo $(DEL) viminfo
89 -@if exist test.log $(DEL) test.log
90 -@if exist messages $(DEL) messages
Bram Moolenaar34b6cb12008-09-20 14:27:03 +000091
92.in.out:
Bram Moolenaar9bd31862016-06-13 22:58:39 +020093 -@if exist $*.ok $(CP) $*.ok test.ok
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +010094 $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $*.in
Bram Moolenaar9bd31862016-06-13 22:58:39 +020095 @diff test.out $*.ok
96 -@if exist $*.out $(DEL) $*.out
97 @$(MV) test.out $*.out
98 -@if exist Xdir1 $(DELDIR) Xdir1
99 -@if exist Xfind $(DELDIR) Xfind
100 -@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
108bench_re_freeze.out: bench_re_freeze.vim
109 -$(DEL) benchmark.out
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100110 $(VIMPROG) -u dos.vim $(NO_INITS) $*.in
Bram Moolenaarfda37292014-11-05 14:27:36 +0100111 $(CAT) benchmark.out
Bram Moolenaar9bd31862016-06-13 22:58:39 +0200112
113# New style of tests uses Vim script with assert calls. These are easier
114# to write and a lot easier to read and debug.
115# Limitation: Only works with the +eval feature.
116
117newtests: $(NEW_TESTS)
118
119.vim.res:
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200120 @echo "$(VIMPROG)" > vimcmd
Bram Moolenaar8be2fbb2017-02-23 19:32:47 +0100121 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
122 @$(DEL) vimcmd
123
124test_gui.res: test_gui.vim
125 @echo "$(VIMPROG)" > vimcmd
126 $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $<
127 @$(DEL) vimcmd
128
129test_gui_init.res: test_gui_init.vim
130 @echo "$(VIMPROG)" > vimcmd
131 $(VIMPROG) -u NONE -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $<
Bram Moolenaar5b4a3762016-08-06 20:36:34 +0200132 @$(DEL) vimcmd
Bram Moolenaar9bd31862016-06-13 22:58:39 +0200133