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