K.Takata | 5bc1345 | 2022-09-09 10:52:47 +0100 | [diff] [blame] | 1 | # |
| 2 | # Makefile to run all tests for Vim, on Dos-like machines. |
| 3 | # |
| 4 | # Requires a set of Unix tools: echo, diff, etc. |
| 5 | |
| 6 | VIMPROG = ..\\vim |
| 7 | |
| 8 | default: nongui |
| 9 | |
| 10 | !include Make_all.mak |
| 11 | |
| 12 | # Explicit dependencies. |
| 13 | test_options.res test_alot.res: opt_test.vim |
| 14 | |
| 15 | TEST_OUTFILES = $(SCRIPTS_TINY_OUT) |
| 16 | DOSTMP = dostmp |
| 17 | DOSTMP_OUTFILES = $(TEST_OUTFILES:test=dostmp\test) |
| 18 | DOSTMP_INFILES = $(DOSTMP_OUTFILES:.out=.in) |
| 19 | |
| 20 | .SUFFIXES: .in .out .res .vim |
| 21 | |
| 22 | # Add --gui-dialog-file to avoid getting stuck in a dialog. |
| 23 | COMMON_ARGS = $(NO_INITS) --gui-dialog-file guidialog |
| 24 | |
| 25 | nongui: nolog tinytests newtests report |
| 26 | |
| 27 | gui: nolog tinytests newtests report |
| 28 | |
| 29 | tiny: nolog tinytests report |
| 30 | |
| 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 ) |
| 37 | $(VIMPROG) -u NONE $(COMMON_ARGS) -S summarize.vim messages |
Bram Moolenaar | b9093d5 | 2022-09-23 19:42:31 +0100 | [diff] [blame] | 38 | -if exist starttime del starttime |
K.Takata | 5bc1345 | 2022-09-09 10:52:47 +0100 | [diff] [blame] | 39 | @echo. |
| 40 | @echo Test results: |
| 41 | @cmd /c type test_result.log |
| 42 | @if exist test.log ( echo TEST FAILURE & exit /b 1 ) \ |
| 43 | else ( echo ALL DONE ) |
| 44 | |
| 45 | |
| 46 | # Execute an individual new style test, e.g.: |
| 47 | # nmake -f Make_mvc.mak test_largefile |
| 48 | $(NEW_TESTS): |
| 49 | -if exist $@.res del $@.res |
| 50 | -if exist test.log del test.log |
| 51 | -if exist messages del messages |
Bram Moolenaar | b9093d5 | 2022-09-23 19:42:31 +0100 | [diff] [blame] | 52 | -if exist starttime del starttime |
K.Takata | 5bc1345 | 2022-09-09 10:52:47 +0100 | [diff] [blame] | 53 | @$(MAKE) -nologo -f Make_mvc.mak $@.res VIMPROG=$(VIMPROG) |
| 54 | @type messages |
| 55 | @if exist test.log exit 1 |
| 56 | |
| 57 | |
| 58 | # Delete files that may interfere with running tests. This includes some files |
| 59 | # that may result from working on the tests, not only from running them. |
| 60 | clean: |
| 61 | -if exist *.out del *.out |
| 62 | -if exist *.failed del *.failed |
| 63 | -if exist *.res del *.res |
| 64 | -if exist $(DOSTMP) rd /s /q $(DOSTMP) |
| 65 | -if exist test.in del test.in |
| 66 | -if exist test.ok del test.ok |
| 67 | -if exist Xdir1 rd /s /q Xdir1 |
| 68 | -if exist Xfind rd /s /q Xfind |
| 69 | -if exist XfakeHOME rd /s /q XfakeHOME |
| 70 | -if exist X* del X* |
| 71 | -for /d %i in (X*) do @rd /s/q %i |
| 72 | -if exist viminfo del viminfo |
| 73 | -if exist test.log del test.log |
| 74 | -if exist test_result.log del test_result.log |
| 75 | -if exist messages del messages |
Bram Moolenaar | b9093d5 | 2022-09-23 19:42:31 +0100 | [diff] [blame] | 76 | -if exist starttime del starttime |
K.Takata | 5bc1345 | 2022-09-09 10:52:47 +0100 | [diff] [blame] | 77 | -if exist benchmark.out del benchmark.out |
| 78 | -if exist opt_test.vim del opt_test.vim |
| 79 | -if exist guidialog del guidialog |
| 80 | -if exist guidialogfile del guidialogfile |
| 81 | |
| 82 | nolog: |
| 83 | -if exist test.log del test.log |
| 84 | -if exist test_result.log del test_result.log |
| 85 | -if exist messages del messages |
Bram Moolenaar | b9093d5 | 2022-09-23 19:42:31 +0100 | [diff] [blame] | 86 | -if exist starttime del starttime |
K.Takata | 5bc1345 | 2022-09-09 10:52:47 +0100 | [diff] [blame] | 87 | |
| 88 | |
| 89 | # Tiny tests. Works even without the +eval feature. |
| 90 | tinytests: $(SCRIPTS_TINY_OUT) |
| 91 | |
| 92 | # Copy the input files to dostmp, changing the fileformat to dos. |
| 93 | $(DOSTMP_INFILES): $(*B).in |
| 94 | if not exist $(DOSTMP)\NUL md $(DOSTMP) |
| 95 | if exist $@ del $@ |
| 96 | $(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=dos|f $@|wq" $(*B).in |
| 97 | |
| 98 | # For each input file dostmp/test99.in run the tests. |
| 99 | # This moves test99.in to test99.in.bak temporarily. |
| 100 | $(TEST_OUTFILES): $(DOSTMP)\$(*B).in |
| 101 | -@if exist test.out DEL test.out |
| 102 | -@if exist $(DOSTMP)\$(*B).out DEL $(DOSTMP)\$(*B).out |
| 103 | move $(*B).in $(*B).in.bak > nul |
| 104 | copy $(DOSTMP)\$(*B).in $(*B).in > nul |
| 105 | copy $(*B).ok test.ok > nul |
| 106 | $(VIMPROG) -u dos.vim $(COMMON_ARGS) -s dotest.in $(*B).in |
| 107 | -@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul |
| 108 | -@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul |
| 109 | -@if exist test.ok del test.ok |
| 110 | -@if exist Xdir1 rd /s /q Xdir1 |
| 111 | -@if exist Xfind rd /s /q Xfind |
| 112 | -@if exist XfakeHOME rd /s /q XfakeHOME |
| 113 | -@del X* |
| 114 | -@if exist viminfo del viminfo |
| 115 | $(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=unix|f test.out|wq" \ |
| 116 | $(DOSTMP)\$(*B).out |
| 117 | @diff test.out $*.ok & if errorlevel 1 \ |
| 118 | ( move /y test.out $*.failed > nul \ |
| 119 | & del $(DOSTMP)\$(*B).out \ |
| 120 | & echo $* FAILED >> test.log ) \ |
| 121 | else ( move /y test.out $*.out > nul ) |
| 122 | |
| 123 | |
| 124 | # New style of tests uses Vim script with assert calls. These are easier |
| 125 | # to write and a lot easier to read and debug. |
| 126 | # Limitation: Only works with the +eval feature. |
| 127 | |
| 128 | newtests: newtestssilent |
| 129 | @if exist messages type messages |
| 130 | |
| 131 | newtestssilent: $(NEW_TESTS_RES) |
| 132 | |
| 133 | .vim.res: |
| 134 | @echo $(VIMPROG) > vimcmd |
| 135 | $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim |
| 136 | @del vimcmd |
| 137 | |
| 138 | test_gui.res: test_gui.vim |
| 139 | @echo $(VIMPROG) > vimcmd |
| 140 | $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim |
| 141 | @del vimcmd |
| 142 | |
| 143 | test_gui_init.res: test_gui_init.vim |
| 144 | @echo $(VIMPROG) > vimcmd |
| 145 | $(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $*.vim |
| 146 | @del vimcmd |
| 147 | |
| 148 | opt_test.vim: ../optiondefs.h gen_opt_test.vim |
| 149 | $(VIMPROG) -u NONE -S gen_opt_test.vim --noplugin --not-a-term ../optiondefs.h |
| 150 | |
| 151 | test_bench_regexp.res: test_bench_regexp.vim |
| 152 | -if exist benchmark.out del benchmark.out |
| 153 | @echo $(VIMPROG) > vimcmd |
| 154 | $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim |
| 155 | @del vimcmd |
| 156 | @IF EXIST benchmark.out ( type benchmark.out ) |