Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | # |
Bram Moolenaar | 6ee1016 | 2007-07-26 20:58:42 +0000 | [diff] [blame] | 2 | # Makefile to run all tests for Vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 3 | # |
| 4 | |
| 5 | VIMPROG = ../vim |
Bram Moolenaar | efa304d | 2014-04-01 14:08:28 +0200 | [diff] [blame] | 6 | SCRIPTSOURCE = ../../runtime |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 7 | |
Bram Moolenaar | 0c77b7b | 2009-06-24 16:08:18 +0000 | [diff] [blame] | 8 | # Uncomment this line to use valgrind for memory leaks and extra warnings. |
| 9 | # The output goes into a file "valgrind.testN" |
| 10 | # Vim should be compiled with EXITFREE to avoid false warnings. |
| 11 | # This will make testing about 10 times as slow. |
| 12 | # VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --log-file=valgrind.$* |
Bram Moolenaar | 4d2fffc | 2007-08-14 15:29:16 +0000 | [diff] [blame] | 13 | |
Bram Moolenaar | 680eeca | 2010-10-20 17:44:42 +0200 | [diff] [blame] | 14 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 15 | SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ |
| 16 | test7.out test8.out test9.out test10.out test11.out \ |
Bram Moolenaar | 9750bb1 | 2012-12-05 16:10:42 +0100 | [diff] [blame] | 17 | test12.out test13.out test14.out test15.out test17.out \ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 18 | test18.out test19.out test20.out test21.out test22.out \ |
| 19 | test23.out test24.out test25.out test26.out test27.out \ |
| 20 | test28.out test29.out test30.out test31.out test32.out \ |
| 21 | test33.out test34.out test35.out test36.out test37.out \ |
| 22 | test38.out test39.out test40.out test41.out test42.out \ |
| 23 | test43.out test44.out test45.out test46.out test47.out \ |
Bram Moolenaar | b5bf5b8 | 2004-12-24 14:35:23 +0000 | [diff] [blame] | 24 | test48.out test49.out test51.out test52.out test53.out \ |
Bram Moolenaar | 53180ce | 2005-07-05 21:48:14 +0000 | [diff] [blame] | 25 | test54.out test55.out test56.out test57.out test58.out \ |
Bram Moolenaar | 4d2fffc | 2007-08-14 15:29:16 +0000 | [diff] [blame] | 26 | test59.out test60.out test61.out test62.out test63.out \ |
Bram Moolenaar | 97b9810 | 2009-11-17 16:41:01 +0000 | [diff] [blame] | 27 | test64.out test65.out test66.out test67.out test68.out \ |
Bram Moolenaar | 680eeca | 2010-10-20 17:44:42 +0200 | [diff] [blame] | 28 | test69.out test70.out test71.out test72.out test73.out \ |
Bram Moolenaar | 978287b | 2011-06-19 04:32:15 +0200 | [diff] [blame] | 29 | test74.out test75.out test76.out test77.out test78.out \ |
Bram Moolenaar | 913077c | 2012-03-28 19:59:04 +0200 | [diff] [blame] | 30 | test79.out test80.out test81.out test82.out test83.out \ |
Bram Moolenaar | f4e5e86 | 2013-02-13 15:44:26 +0100 | [diff] [blame] | 31 | test84.out test85.out test86.out test87.out test88.out \ |
Bram Moolenaar | e3e6e57 | 2013-04-12 13:45:02 +0200 | [diff] [blame] | 32 | test89.out test90.out test91.out test92.out test93.out \ |
Bram Moolenaar | e6a2fa6 | 2013-09-19 17:00:20 +0200 | [diff] [blame] | 33 | test94.out test95.out test96.out test97.out test98.out \ |
Bram Moolenaar | 4f943c0 | 2014-02-05 22:26:05 +0100 | [diff] [blame] | 34 | test99.out test100.out test101.out test102.out test103.out \ |
Bram Moolenaar | c35b0fb | 2014-05-29 11:47:40 +0200 | [diff] [blame] | 35 | test104.out test105.out test106.out test107.out \ |
Bram Moolenaar | b96a7f3 | 2014-11-27 16:22:48 +0100 | [diff] [blame^] | 36 | test_argument_count.out \ |
Bram Moolenaar | d69bd9a | 2014-04-29 12:15:40 +0200 | [diff] [blame] | 37 | test_autoformat_join.out \ |
Bram Moolenaar | 597a422 | 2014-06-25 14:39:50 +0200 | [diff] [blame] | 38 | test_breakindent.out \ |
Bram Moolenaar | 23fb7a9 | 2014-07-30 14:05:00 +0200 | [diff] [blame] | 39 | test_changelist.out \ |
Bram Moolenaar | b96a7f3 | 2014-11-27 16:22:48 +0100 | [diff] [blame^] | 40 | test_close_count.out \ |
Bram Moolenaar | d69bd9a | 2014-04-29 12:15:40 +0200 | [diff] [blame] | 41 | test_eval.out \ |
Bram Moolenaar | 4f5ce33 | 2014-07-30 16:00:58 +0200 | [diff] [blame] | 42 | test_insertcount.out \ |
Bram Moolenaar | b5cf6c3 | 2014-08-16 18:36:43 +0200 | [diff] [blame] | 43 | test_listlbr.out \ |
| 44 | test_listlbr_utf8.out \ |
Bram Moolenaar | bdef518 | 2014-10-21 16:22:17 +0200 | [diff] [blame] | 45 | test_mapping.out \ |
Bram Moolenaar | b5cf6c3 | 2014-08-16 18:36:43 +0200 | [diff] [blame] | 46 | test_options.out \ |
| 47 | test_qf_title.out \ |
Bram Moolenaar | 482a2b5 | 2014-10-21 20:57:15 +0200 | [diff] [blame] | 48 | test_signs.out \ |
Bram Moolenaar | b5cf6c3 | 2014-08-16 18:36:43 +0200 | [diff] [blame] | 49 | test_utf8.out |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 50 | |
| 51 | SCRIPTS_GUI = test16.out |
| 52 | |
Bram Moolenaar | fda3729 | 2014-11-05 14:27:36 +0100 | [diff] [blame] | 53 | SCRIPTS_BENCH = bench_re_freeze.out |
| 54 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 55 | .SUFFIXES: .in .out |
| 56 | |
Bram Moolenaar | f2e53da | 2008-09-10 16:26:04 +0000 | [diff] [blame] | 57 | nongui: nolog $(SCRIPTS) report |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 58 | |
Bram Moolenaar | f2e53da | 2008-09-10 16:26:04 +0000 | [diff] [blame] | 59 | gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report |
| 60 | |
Bram Moolenaar | fda3729 | 2014-11-05 14:27:36 +0100 | [diff] [blame] | 61 | benchmark: $(SCRIPTS_BENCH) |
| 62 | |
Bram Moolenaar | f2e53da | 2008-09-10 16:26:04 +0000 | [diff] [blame] | 63 | report: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 64 | @echo |
Bram Moolenaar | f2e53da | 2008-09-10 16:26:04 +0000 | [diff] [blame] | 65 | @echo 'Test results:' |
| 66 | @/bin/sh -c "if test -f test.log; \ |
| 67 | then cat test.log; echo TEST FAILURE; exit 1; \ |
| 68 | else echo ALL DONE; \ |
| 69 | fi" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 70 | |
| 71 | $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG) |
| 72 | |
Bram Moolenaar | 60ec5f3 | 2012-12-05 18:21:32 +0100 | [diff] [blame] | 73 | RM_ON_RUN = test.out X* viminfo |
Bram Moolenaar | fda3729 | 2014-11-05 14:27:36 +0100 | [diff] [blame] | 74 | RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok benchmark.out |
Bram Moolenaar | 1c5a213 | 2014-05-22 13:12:29 +0200 | [diff] [blame] | 75 | RUN_VIM = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in |
Bram Moolenaar | 60ec5f3 | 2012-12-05 18:21:32 +0100 | [diff] [blame] | 76 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 77 | clean: |
Bram Moolenaar | 60ec5f3 | 2012-12-05 18:21:32 +0100 | [diff] [blame] | 78 | -rm -rf *.out *.failed *.rej *.orig test.log $(RM_ON_RUN) $(RM_ON_START) valgrind.* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 79 | |
| 80 | test1.out: test1.in |
Bram Moolenaar | 6848c8b | 2013-09-22 15:03:38 +0200 | [diff] [blame] | 81 | -rm -rf $*.failed $(RM_ON_RUN) $(RM_ON_START) wrongtermsize |
Bram Moolenaar | 60ec5f3 | 2012-12-05 18:21:32 +0100 | [diff] [blame] | 82 | $(RUN_VIM) $*.in |
Bram Moolenaar | f7dc2b5 | 2014-03-12 15:50:22 +0100 | [diff] [blame] | 83 | @/bin/sh -c "if test -f wrongtermsize; \ |
Bram Moolenaar | 6848c8b | 2013-09-22 15:03:38 +0200 | [diff] [blame] | 84 | then echo; \ |
| 85 | echo test1 FAILED - terminal size must be 80x24 or larger; \ |
| 86 | echo; exit 1; \ |
| 87 | elif diff test.out $*.ok; \ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 88 | then mv -f test.out $*.out; \ |
| 89 | else echo; \ |
| 90 | echo test1 FAILED - Something basic is wrong; \ |
| 91 | echo; exit 1; fi" |
| 92 | -rm -rf X* viminfo |
| 93 | |
| 94 | .in.out: |
Bram Moolenaar | 60ec5f3 | 2012-12-05 18:21:32 +0100 | [diff] [blame] | 95 | -rm -rf $*.failed test.ok $(RM_ON_RUN) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 96 | cp $*.ok test.ok |
Bram Moolenaar | 3f99152 | 2013-04-24 12:56:19 +0200 | [diff] [blame] | 97 | # Sleep a moment to avoid that the xterm title is messed up. |
| 98 | # 200 msec is sufficient, but only modern sleep supports a fraction of |
| 99 | # a second, fall back to a second if it fails. |
| 100 | @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1" |
Bram Moolenaar | 60ec5f3 | 2012-12-05 18:21:32 +0100 | [diff] [blame] | 101 | -$(RUN_VIM) $*.in |
| 102 | |
| 103 | # For flaky tests retry one time. |
| 104 | @/bin/sh -c "if test -f test.out -a $* = test61; then \ |
| 105 | if diff test.out $*.ok; \ |
| 106 | then echo flaky test ok first time; \ |
| 107 | else rm -rf $*.failed $(RM_ON_RUN); \ |
| 108 | $(RUN_VIM) $*.in; \ |
| 109 | fi \ |
| 110 | fi" |
| 111 | |
| 112 | # Check if the test.out file matches test.ok. |
Bram Moolenaar | fbc0d2e | 2013-05-19 19:40:29 +0200 | [diff] [blame] | 113 | @/bin/sh -c "if test -f test.out; then \ |
Bram Moolenaar | 5313dcb | 2005-02-22 08:56:13 +0000 | [diff] [blame] | 114 | if diff test.out $*.ok; \ |
| 115 | then mv -f test.out $*.out; \ |
| 116 | else echo $* FAILED >>test.log; mv -f test.out $*.failed; \ |
| 117 | fi \ |
| 118 | else echo $* NO OUTPUT >>test.log; \ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 119 | fi" |
Bram Moolenaar | fbc0d2e | 2013-05-19 19:40:29 +0200 | [diff] [blame] | 120 | @/bin/sh -c "if test -f valgrind; then\ |
| 121 | mv -f valgrind valgrind.$*; \ |
| 122 | fi" |
Bram Moolenaar | b35c338 | 2012-10-06 19:10:35 +0200 | [diff] [blame] | 123 | -rm -rf X* test.ok viminfo |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 124 | |
Bram Moolenaar | 9d2c8c1 | 2007-09-25 16:00:00 +0000 | [diff] [blame] | 125 | test49.out: test49.vim |
| 126 | |
| 127 | test60.out: test60.vim |
| 128 | |
Bram Moolenaar | fda3729 | 2014-11-05 14:27:36 +0100 | [diff] [blame] | 129 | bench_re_freeze.out: bench_re_freeze.vim |
| 130 | -rm -rf benchmark.out $(RM_ON_RUN) |
| 131 | # Sleep a moment to avoid that the xterm title is messed up. |
| 132 | # 200 msec is sufficient, but only modern sleep supports a fraction of |
| 133 | # a second, fall back to a second if it fails. |
| 134 | @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1" |
| 135 | -$(RUN_VIM) $*.in |
| 136 | @/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi" |
| 137 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 138 | nolog: |
Bram Moolenaar | f2e53da | 2008-09-10 16:26:04 +0000 | [diff] [blame] | 139 | -rm -f test.log |