blob: 644573499b6d69a6c15425bce8b34d3a76a9c098 [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
17# test27 can't edit file with "*" in file name
Bram Moolenaarda9888a2015-12-28 21:35:14 +010018# test49 fails in various ways
Bram Moolenaaree0ee2a2013-07-03 21:19:07 +020019# test97 \{ and \$ are not escaped characters.
Bram Moolenaar071d4272004-06-13 20:20:40 +000020
Bram Moolenaar7b6156f2015-12-28 16:01:26 +010021SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE3) $(SCRIPTS_MORE4)
Bram Moolenaar071d4272004-06-13 20:20:40 +000022
Bram Moolenaara6082432015-12-28 16:26:45 +010023TEST_OUTFILES = $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI)
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010024DOSTMP = dostmp
25DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test)
26DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in)
Bram Moolenaar071d4272004-06-13 20:20:40 +000027
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010028.SUFFIXES: .in .out .res .vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000029
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010030nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000031
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010032small: nolog report
Bram Moolenaar071d4272004-06-13 20:20:40 +000033
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010034gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000035
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010036win32: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests report
Bram Moolenaar071d4272004-06-13 20:20:40 +000037
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010038# Copy the input files to dostmp, changing the fileformat to dos.
39$(DOSTMP_INFILES): $(*B).in
40 if not exist $(DOSTMP)\NUL md $(DOSTMP)
41 if exist $@ del $@
42 $(VIMPROG) -u dos.vim --noplugin "+set ff=dos|f $@|wq" $(*B).in
43
44# For each input file dostmp/test99.in run the tests.
45# This moves test99.in to test99.in.bak temporarily.
46$(TEST_OUTFILES): $(DOSTMP)\$(*B).in
47 -@if exist test.out DEL test.out
48 move $(*B).in $(*B).in.bak
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010049 copy $(DOSTMP)\$(*B).in $(*B).in
50 copy $(*B).ok test.ok
51 $(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $(*B).in
52 -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out
53 -@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in
54 -@del X*
55 -@if exist test.ok del test.ok
56 -@if exist Xdir1 rd /s /q Xdir1
57 -@if exist Xfind rd /s /q Xfind
58 -@if exist viminfo del viminfo
59 $(VIMPROG) -u dos.vim --noplugin "+set ff=unix|f test.out|wq" \
60 $(DOSTMP)\$(*B).out
61 @diff test.out $*.ok & if errorlevel 1 \
62 ( move /y test.out $*.failed \
63 & del $(DOSTMP)\$(*B).out \
64 & echo $* FAILED >> test.log ) \
65 else ( move /y test.out $*.out )
Bram Moolenaarb78b0b02005-01-02 11:32:29 +000066
Bram Moolenaar60461972015-12-30 17:17:10 +010067# Must run test1 first to create small.vim.
68# This rule must come after the one that copies the input files to dostmp to
69# allow for running an individual test.
70$(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS): $(SCRIPTS_FIRST)
71
Bram Moolenaar6949eea2013-06-16 16:57:46 +020072report:
73 @echo ""
74 @echo Test results:
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010075 @if exist test.log ( type test.log & echo TEST FAILURE & exit /b 1 ) \
76 else ( echo ALL DONE )
Bram Moolenaar6949eea2013-06-16 16:57:46 +020077
Bram Moolenaar071d4272004-06-13 20:20:40 +000078clean:
79 -del *.out
Bram Moolenaar555d2a82013-06-17 21:53:37 +020080 -del *.failed
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010081 -del *.res
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010082 -if exist $(DOSTMP) rd /s /q $(DOSTMP)
83 -if exist test.in del test.in
Bram Moolenaar9c039782007-08-14 15:55:42 +000084 -if exist test.ok del test.ok
85 -if exist small.vim del small.vim
86 -if exist tiny.vim del tiny.vim
87 -if exist mbyte.vim del mbyte.vim
Bram Moolenaar2498b3a2010-03-02 17:59:44 +010088 -if exist mzscheme.vim del mzscheme.vim
Bram Moolenaarb35c3382012-10-06 19:10:35 +020089 -if exist lua.vim del lua.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000090 -del X*
Bram Moolenaar555d2a82013-06-17 21:53:37 +020091 -if exist Xdir1 rd /s /q Xdir1
92 -if exist Xfind rd /s /q Xfind
Bram Moolenaar9c039782007-08-14 15:55:42 +000093 -if exist viminfo del viminfo
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010094 -if exist test.log del test.log
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +010095 -if exist messages del messages
Bram Moolenaar9c7d98d2014-11-05 15:46:09 +010096 -if exist benchmark.out del benchmark.out
Bram Moolenaar071d4272004-06-13 20:20:40 +000097
Bram Moolenaar6949eea2013-06-16 16:57:46 +020098nolog:
Bram Moolenaar13cf77b2015-02-27 21:11:02 +010099 -if exist test.log del test.log
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100100 -if exist messages del messages
Bram Moolenaarfda37292014-11-05 14:27:36 +0100101
102benchmark:
103 bench_re_freeze.out
104
105bench_re_freeze.out: bench_re_freeze.vim
106 -if exist benchmark.out del benchmark.out
107 $(VIMPROG) -u dos.vim -U NONE --noplugin $*.in
108 @IF EXIST benchmark.out ( type benchmark.out )
Bram Moolenaar4e5a31c2015-12-29 17:11:15 +0100109
110# New style of tests uses Vim script with assert calls. These are easier
111# to write and a lot easier to read and debug.
112# Limitation: Only works with the +eval feature.
113
114newtests: $(NEW_TESTS)
115
116.vim.res:
117 $(VIMPROG) -u NONE -S runtest.vim $*.vim