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 | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 12 | # Explicit dependencies. |
| 13 | test_options.res test_alot.res: opt_test.vim |
| 14 | |
| 15 | TEST_OUTFILES = $(SCRIPTS_TINY_OUT) |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 16 | DOSTMP = dostmp |
| 17 | DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test) |
| 18 | DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 19 | |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 20 | .SUFFIXES: .in .out .res .vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 21 | |
Bram Moolenaar | 2d12c25 | 2022-06-13 21:42:45 +0100 | [diff] [blame] | 22 | # Add --gui-dialog-file to avoid getting stuck in a dialog. |
| 23 | COMMON_ARGS = $(NO_INITS) --gui-dialog-file guidialog |
| 24 | |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 25 | nongui: nolog tinytests newtests report |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 26 | |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 27 | gui: nolog tinytests newtests report |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 28 | |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 29 | tiny: nolog tinytests report |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 30 | |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 31 | benchmark: $(SCRIPTS_BENCH) |
| 32 | |
| 33 | report: |
| 34 | @rem without the +eval feature test_result.log is a copy of test.log |
| 35 | @if exist test.log ( copy /y test.log test_result.log > nul ) \ |
| 36 | else ( echo No failures reported > test_result.log ) |
Bram Moolenaar | 2d12c25 | 2022-06-13 21:42:45 +0100 | [diff] [blame] | 37 | $(VIMPROG) -u NONE $(COMMON_ARGS) -S summarize.vim messages |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 38 | @echo. |
| 39 | @echo Test results: |
| 40 | @cmd /c type test_result.log |
| 41 | @if exist test.log ( echo TEST FAILURE & exit /b 1 ) \ |
| 42 | else ( echo ALL DONE ) |
| 43 | |
| 44 | |
| 45 | # Execute an individual new style test, e.g.: |
| 46 | # nmake -f Make_dos.mak test_largefile |
| 47 | $(NEW_TESTS): |
| 48 | -if exist $@.res del $@.res |
| 49 | -if exist test.log del test.log |
| 50 | -if exist messages del messages |
| 51 | @$(MAKE) -nologo -f Make_dos.mak $@.res VIMPROG=$(VIMPROG) |
| 52 | @type messages |
| 53 | @if exist test.log exit 1 |
| 54 | |
| 55 | |
| 56 | # Delete files that may interfere with running tests. This includes some files |
| 57 | # that may result from working on the tests, not only from running them. |
| 58 | clean: |
Bram Moolenaar | 1623619 | 2020-08-14 23:08:22 +0200 | [diff] [blame] | 59 | -if exist *.out del *.out |
| 60 | -if exist *.failed del *.failed |
| 61 | -if exist *.res del *.res |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 62 | -if exist $(DOSTMP) rd /s /q $(DOSTMP) |
| 63 | -if exist test.in del test.in |
| 64 | -if exist test.ok del test.ok |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 65 | -if exist Xdir1 rd /s /q Xdir1 |
| 66 | -if exist Xfind rd /s /q Xfind |
| 67 | -if exist XfakeHOME rd /s /q XfakeHOME |
Bram Moolenaar | 1623619 | 2020-08-14 23:08:22 +0200 | [diff] [blame] | 68 | -if exist X* del X* |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 69 | -for /d %i in (X*) do @rd /s/q %i |
| 70 | -if exist viminfo del viminfo |
| 71 | -if exist test.log del test.log |
| 72 | -if exist test_result.log del test_result.log |
| 73 | -if exist messages del messages |
| 74 | -if exist benchmark.out del benchmark.out |
| 75 | -if exist opt_test.vim del opt_test.vim |
Bram Moolenaar | 2d12c25 | 2022-06-13 21:42:45 +0100 | [diff] [blame] | 76 | -if exist guidialog del guidialog |
| 77 | -if exist guidialogfile del guidialogfile |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 78 | |
| 79 | nolog: |
| 80 | -if exist test.log del test.log |
| 81 | -if exist test_result.log del test_result.log |
| 82 | -if exist messages del messages |
| 83 | |
| 84 | |
| 85 | # Tiny tests. Works even without the +eval feature. |
| 86 | tinytests: $(SCRIPTS_TINY_OUT) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 87 | |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 88 | # Copy the input files to dostmp, changing the fileformat to dos. |
| 89 | $(DOSTMP_INFILES): $(*B).in |
| 90 | if not exist $(DOSTMP)\NUL md $(DOSTMP) |
| 91 | if exist $@ del $@ |
Bram Moolenaar | 2d12c25 | 2022-06-13 21:42:45 +0100 | [diff] [blame] | 92 | $(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=dos|f $@|wq" $(*B).in |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 93 | |
| 94 | # For each input file dostmp/test99.in run the tests. |
| 95 | # This moves test99.in to test99.in.bak temporarily. |
| 96 | $(TEST_OUTFILES): $(DOSTMP)\$(*B).in |
| 97 | -@if exist test.out DEL test.out |
Bram Moolenaar | b27523f | 2017-03-16 14:04:51 +0100 | [diff] [blame] | 98 | -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out |
Bram Moolenaar | 29891c4 | 2017-01-06 18:00:12 +0100 | [diff] [blame] | 99 | move $(*B).in $(*B).in.bak > nul |
| 100 | copy $(DOSTMP)\$(*B).in $(*B).in > nul |
| 101 | copy $(*B).ok test.ok > nul |
Bram Moolenaar | 2d12c25 | 2022-06-13 21:42:45 +0100 | [diff] [blame] | 102 | $(VIMPROG) -u dos.vim $(COMMON_ARGS) -s dotest.in $(*B).in |
Bram Moolenaar | 29891c4 | 2017-01-06 18:00:12 +0100 | [diff] [blame] | 103 | -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul |
| 104 | -@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] | 105 | -@if exist test.ok del test.ok |
| 106 | -@if exist Xdir1 rd /s /q Xdir1 |
| 107 | -@if exist Xfind rd /s /q Xfind |
Bram Moolenaar | 30fe886 | 2017-07-29 23:01:57 +0200 | [diff] [blame] | 108 | -@if exist XfakeHOME rd /s /q XfakeHOME |
Bram Moolenaar | acf92d2 | 2016-01-02 16:00:20 +0100 | [diff] [blame] | 109 | -@del X* |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 110 | -@if exist viminfo del viminfo |
Bram Moolenaar | 2d12c25 | 2022-06-13 21:42:45 +0100 | [diff] [blame] | 111 | $(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=unix|f test.out|wq" \ |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 112 | $(DOSTMP)\$(*B).out |
| 113 | @diff test.out $*.ok & if errorlevel 1 \ |
Bram Moolenaar | 29891c4 | 2017-01-06 18:00:12 +0100 | [diff] [blame] | 114 | ( move /y test.out $*.failed > nul \ |
Bram Moolenaar | 13cf77b | 2015-02-27 21:11:02 +0100 | [diff] [blame] | 115 | & del $(DOSTMP)\$(*B).out \ |
| 116 | & echo $* FAILED >> test.log ) \ |
Bram Moolenaar | 29891c4 | 2017-01-06 18:00:12 +0100 | [diff] [blame] | 117 | else ( move /y test.out $*.out > nul ) |
Bram Moolenaar | b78b0b0 | 2005-01-02 11:32:29 +0000 | [diff] [blame] | 118 | |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 119 | |
| 120 | # New style of tests uses Vim script with assert calls. These are easier |
| 121 | # to write and a lot easier to read and debug. |
| 122 | # Limitation: Only works with the +eval feature. |
| 123 | |
Bram Moolenaar | 933bef7 | 2018-09-20 21:39:33 +0200 | [diff] [blame] | 124 | newtests: newtestssilent |
Bram Moolenaar | 6e3aeec | 2020-08-26 22:29:57 +0200 | [diff] [blame] | 125 | @if exist messages type messages |
Bram Moolenaar | 933bef7 | 2018-09-20 21:39:33 +0200 | [diff] [blame] | 126 | |
Bram Moolenaar | ec50401 | 2019-01-11 17:30:16 +0100 | [diff] [blame] | 127 | newtestssilent: $(NEW_TESTS_RES) |
Bram Moolenaar | 4e5a31c | 2015-12-29 17:11:15 +0100 | [diff] [blame] | 128 | |
| 129 | .vim.res: |
Bram Moolenaar | 4635e11 | 2017-10-07 21:05:18 +0200 | [diff] [blame] | 130 | @echo $(VIMPROG) > vimcmd |
Bram Moolenaar | 2d12c25 | 2022-06-13 21:42:45 +0100 | [diff] [blame] | 131 | $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim |
Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 132 | @del vimcmd |
| 133 | |
| 134 | test_gui.res: test_gui.vim |
Bram Moolenaar | 4635e11 | 2017-10-07 21:05:18 +0200 | [diff] [blame] | 135 | @echo $(VIMPROG) > vimcmd |
Bram Moolenaar | 2d12c25 | 2022-06-13 21:42:45 +0100 | [diff] [blame] | 136 | $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim |
Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 137 | @del vimcmd |
| 138 | |
| 139 | test_gui_init.res: test_gui_init.vim |
Bram Moolenaar | 4635e11 | 2017-10-07 21:05:18 +0200 | [diff] [blame] | 140 | @echo $(VIMPROG) > vimcmd |
Bram Moolenaar | 8774845 | 2017-03-12 17:10:33 +0100 | [diff] [blame] | 141 | $(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] | 142 | @del vimcmd |
Bram Moolenaar | 65408f7 | 2017-03-07 21:31:27 +0100 | [diff] [blame] | 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 |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 146 | |
| 147 | test_bench_regexp.res: test_bench_regexp.vim |
| 148 | -if exist benchmark.out del benchmark.out |
| 149 | @echo $(VIMPROG) > vimcmd |
Bram Moolenaar | 2d12c25 | 2022-06-13 21:42:45 +0100 | [diff] [blame] | 150 | $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim |
Bram Moolenaar | b96a32e | 2020-08-13 18:59:55 +0200 | [diff] [blame] | 151 | @del vimcmd |
| 152 | @IF EXIST benchmark.out ( type benchmark.out ) |