Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | # |
Bram Moolenaar | 6839272 | 2010-07-30 22:04:17 +0200 | [diff] [blame] | 2 | # Makefile to run all tests for Vim, on Dos-like machines. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3 | # |
| 4 | # Requires a set of Unix tools: echo, diff, etc. |
| 5 | |
| 6 | VIMPROG = ..\\vim |
| 7 | |
Bram Moolenaar | 40bbcee | 2015-12-28 22:24:41 +0100 | [diff] [blame] | 8 | default: nongui |
| 9 | |
Bram Moolenaar | 7b6156f | 2015-12-28 16:01:26 +0100 | [diff] [blame] | 10 | !include Make_all.mak |
| 11 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 12 | # Omitted: |
| 13 | # test2 "\\tmp" doesn't work. |
| 14 | # test10 'errorformat' is different |
Bram Moolenaar | da9888a | 2015-12-28 21:35:14 +0100 | [diff] [blame] | 15 | # test49 fails in various ways |
Bram Moolenaar | ee0ee2a | 2013-07-03 21:19:07 +0200 | [diff] [blame] | 16 | # test97 \{ and \$ are not escaped characters. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 17 | |
Bram Moolenaar | 53f0c96 | 2017-10-22 14:23:59 +0200 | [diff] [blame] | 18 | SCRIPTS = $(SCRIPTS_ALL) $(SCRIPTS_MORE1) $(SCRIPTS_MORE4) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 19 | |
Bram Moolenaar | a608243 | 2015-12-28 16:26:45 +0100 | [diff] [blame] | 20 | TEST_OUTFILES = $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) $(SCRIPTS_GUI) |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 21 | DOSTMP = dostmp |
| 22 | DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test) |
| 23 | DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 24 | |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 25 | .SUFFIXES: .in .out .res .vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 26 | |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 27 | nongui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) newtests report |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 28 | |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 29 | small: nolog report |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 30 | |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 31 | gui: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_GUI) newtests report |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 32 | |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 33 | win32: nolog $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32) newtests report |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 34 | |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 35 | # Copy the input files to dostmp, changing the fileformat to dos. |
| 36 | $(DOSTMP_INFILES): $(*B).in |
| 37 | if not exist $(DOSTMP)\NUL md $(DOSTMP) |
| 38 | if exist $@ del $@ |
Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 39 | $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 40 | |
| 41 | # For each input file dostmp/test99.in run the tests. |
| 42 | # This moves test99.in to test99.in.bak temporarily. |
| 43 | $(TEST_OUTFILES): $(DOSTMP)\$(*B).in |
| 44 | -@if exist test.out DEL test.out |
Bram Moolenaar | b27523f | 2017-03-16 14:04:51 +0100 | [diff] [blame] | 45 | -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out |
Bram Moolenaar | 29891c4 | 2017-01-06 18:00:12 +0100 | [diff] [blame] | 46 | move $(*B).in $(*B).in.bak > nul |
| 47 | copy $(DOSTMP)\$(*B).in $(*B).in > nul |
| 48 | copy $(*B).ok test.ok > nul |
Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 49 | $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in |
Bram Moolenaar | 29891c4 | 2017-01-06 18:00:12 +0100 | [diff] [blame] | 50 | -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul |
| 51 | -@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 52 | -@if exist test.ok del test.ok |
| 53 | -@if exist Xdir1 rd /s /q Xdir1 |
| 54 | -@if exist Xfind rd /s /q Xfind |
Bram Moolenaar | 30fe886 | 2017-07-29 23:01:57 +0200 | [diff] [blame] | 55 | -@if exist XfakeHOME rd /s /q XfakeHOME |
Bram Moolenaar | acf92d2 | 2016-01-02 16:00:20 +0100 | [diff] [blame] | 56 | -@del X* |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 57 | -@if exist viminfo del viminfo |
Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 58 | $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \ |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 59 | $(DOSTMP)\$(*B).out |
| 60 | @diff test.out $*.ok & if errorlevel 1 \ |
Bram Moolenaar | 29891c4 | 2017-01-06 18:00:12 +0100 | [diff] [blame] | 61 | ( move /y test.out $*.failed > nul \ |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 62 | & del $(DOSTMP)\$(*B).out \ |
| 63 | & echo $* FAILED >> test.log ) \ |
Bram Moolenaar | 29891c4 | 2017-01-06 18:00:12 +0100 | [diff] [blame] | 64 | else ( move /y test.out $*.out > nul ) |
Bram Moolenaar | b78b0b0 | 2005-01-02 11:32:29 +0000 | [diff] [blame] | 65 | |
Bram Moolenaar | 6046197 | 2015-12-30 17:17:10 +0100 | [diff] [blame] | 66 | # Must run test1 first to create small.vim. |
| 67 | # This rule must come after the one that copies the input files to dostmp to |
| 68 | # allow for running an individual test. |
Bram Moolenaar | ec50401 | 2019-01-11 17:30:16 +0100 | [diff] [blame] | 69 | $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS_WIN32) $(NEW_TESTS_RES): $(SCRIPTS_FIRST) |
Bram Moolenaar | 6046197 | 2015-12-30 17:17:10 +0100 | [diff] [blame] | 70 | |
Bram Moolenaar | 6949eea | 2013-06-16 16:57:46 +0200 | [diff] [blame] | 71 | report: |
Bram Moolenaar | d53ebfc | 2019-10-20 21:47:20 +0200 | [diff] [blame] | 72 | @rem without the +eval feature test_result.log is a copy of test.log |
| 73 | @if exist test.log ( copy /y test.log test_result.log > nul ) \ |
| 74 | else ( echo No failures reported > test_result.log ) |
| 75 | $(VIMPROG) -u NONE $(NO_INITS) -S summarize.vim messages |
| 76 | @echo. |
Bram Moolenaar | 6949eea | 2013-06-16 16:57:46 +0200 | [diff] [blame] | 77 | @echo Test results: |
Bram Moolenaar | 7d23204 | 2019-11-05 22:37:20 +0100 | [diff] [blame^] | 78 | @cmd /c type test_result.log |
Bram Moolenaar | d53ebfc | 2019-10-20 21:47:20 +0200 | [diff] [blame] | 79 | @if exist test.log ( echo TEST FAILURE & exit /b 1 ) \ |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 80 | else ( echo ALL DONE ) |
Bram Moolenaar | 6949eea | 2013-06-16 16:57:46 +0200 | [diff] [blame] | 81 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 82 | clean: |
| 83 | -del *.out |
Bram Moolenaar | 555d2a8 | 2013-06-17 21:53:37 +0200 | [diff] [blame] | 84 | -del *.failed |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 85 | -del *.res |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 86 | -if exist $(DOSTMP) rd /s /q $(DOSTMP) |
| 87 | -if exist test.in del test.in |
Bram Moolenaar | 9c03978 | 2007-08-14 15:55:42 +0000 | [diff] [blame] | 88 | -if exist test.ok del test.ok |
| 89 | -if exist small.vim del small.vim |
| 90 | -if exist tiny.vim del tiny.vim |
| 91 | -if exist mbyte.vim del mbyte.vim |
Bram Moolenaar | 2498b3a | 2010-03-02 17:59:44 +0100 | [diff] [blame] | 92 | -if exist mzscheme.vim del mzscheme.vim |
Bram Moolenaar | 555d2a8 | 2013-06-17 21:53:37 +0200 | [diff] [blame] | 93 | -if exist Xdir1 rd /s /q Xdir1 |
| 94 | -if exist Xfind rd /s /q Xfind |
Bram Moolenaar | 30fe886 | 2017-07-29 23:01:57 +0200 | [diff] [blame] | 95 | -if exist XfakeHOME rd /s /q XfakeHOME |
Bram Moolenaar | acf92d2 | 2016-01-02 16:00:20 +0100 | [diff] [blame] | 96 | -del X* |
Bram Moolenaar | d023291 | 2016-01-17 16:15:32 +0100 | [diff] [blame] | 97 | -for /d %i in (X*) do @rmdir /s/q %i |
Bram Moolenaar | 9c03978 | 2007-08-14 15:55:42 +0000 | [diff] [blame] | 98 | -if exist viminfo del viminfo |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 99 | -if exist test.log del test.log |
Bram Moolenaar | d53ebfc | 2019-10-20 21:47:20 +0200 | [diff] [blame] | 100 | -if exist test_result.log del test_result.log |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 101 | -if exist messages del messages |
Bram Moolenaar | 9c7d98d | 2014-11-05 15:46:09 +0100 | [diff] [blame] | 102 | -if exist benchmark.out del benchmark.out |
Bram Moolenaar | 65408f7 | 2017-03-07 21:31:27 +0100 | [diff] [blame] | 103 | -if exist opt_test.vim del opt_test.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 104 | |
Bram Moolenaar | 6949eea | 2013-06-16 16:57:46 +0200 | [diff] [blame] | 105 | nolog: |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 106 | -if exist test.log del test.log |
Bram Moolenaar | d53ebfc | 2019-10-20 21:47:20 +0200 | [diff] [blame] | 107 | -if exist test_result.log del test_result.log |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 108 | -if exist messages del messages |
Bram Moolenaar | fda3729 | 2014-11-05 14:27:36 +0100 | [diff] [blame] | 109 | |
| 110 | benchmark: |
| 111 | bench_re_freeze.out |
| 112 | |
| 113 | bench_re_freeze.out: bench_re_freeze.vim |
| 114 | -if exist benchmark.out del benchmark.out |
Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 115 | $(VIMPROG) -u dos.vim $(NO_INITS) $*.in |
Bram Moolenaar | fda3729 | 2014-11-05 14:27:36 +0100 | [diff] [blame] | 116 | @IF EXIST benchmark.out ( type benchmark.out ) |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 117 | |
| 118 | # New style of tests uses Vim script with assert calls. These are easier |
| 119 | # to write and a lot easier to read and debug. |
| 120 | # Limitation: Only works with the +eval feature. |
| 121 | |
Bram Moolenaar | 933bef7 | 2018-09-20 21:39:33 +0200 | [diff] [blame] | 122 | newtests: newtestssilent |
| 123 | @if exist messages (findstr "SKIPPED FAILED" messages > nul) && type messages |
| 124 | |
Bram Moolenaar | ec50401 | 2019-01-11 17:30:16 +0100 | [diff] [blame] | 125 | newtestssilent: $(NEW_TESTS_RES) |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 126 | |
| 127 | .vim.res: |
Bram Moolenaar | 4635e11 | 2017-10-07 21:05:18 +0200 | [diff] [blame] | 128 | @echo $(VIMPROG) > vimcmd |
Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 129 | $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim |
| 130 | @del vimcmd |
| 131 | |
| 132 | test_gui.res: test_gui.vim |
Bram Moolenaar | 4635e11 | 2017-10-07 21:05:18 +0200 | [diff] [blame] | 133 | @echo $(VIMPROG) > vimcmd |
Bram Moolenaar | 10c6029 | 2017-02-23 20:17:13 +0100 | [diff] [blame] | 134 | $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim |
Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 135 | @del vimcmd |
| 136 | |
| 137 | test_gui_init.res: test_gui_init.vim |
Bram Moolenaar | 4635e11 | 2017-10-07 21:05:18 +0200 | [diff] [blame] | 138 | @echo $(VIMPROG) > vimcmd |
Bram Moolenaar | 8774845 | 2017-03-12 17:10:33 +0100 | [diff] [blame] | 139 | $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim |
Bram Moolenaar | 5b4a376 | 2016-08-06 20:36:34 +0200 | [diff] [blame] | 140 | @del vimcmd |
Bram Moolenaar | 65408f7 | 2017-03-07 21:31:27 +0100 | [diff] [blame] | 141 | |
Bram Moolenaar | 46fd6bf | 2019-01-11 19:19:44 +0100 | [diff] [blame] | 142 | test_options.res test_alot.res: opt_test.vim |
| 143 | |
Bram Moolenaar | d9b0d83 | 2019-09-14 15:46:32 +0200 | [diff] [blame] | 144 | opt_test.vim: ../optiondefs.h gen_opt_test.vim |
| 145 | $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h |