annotate src/testdir/summarize.vim @ 33333:fed9c5ffde42

patch 9.0.1931: make test_compilers fails on ubuntu Commit: https://github.com/vim/vim/commit/ca0ffc0d63727850c520a80929698e4c199b17f4 Author: Dominique Pell? <dominique.pelle@tomtom.com> Date: Sun Sep 24 22:57:41 2023 +0200 patch 9.0.1931: make test_compilers fails on ubuntu Problem: make test_compilers fails on ubuntu Solution: set LC_ALL=C fix: make test_compiler failed on xubuntu 22.04.3 Problem: 'make test_compiler' failed on Linux xubuntu 22.04.3 but succeeded on e.g. macOS. To reproduce: ``` $ ./configure --with-features=huge --enable-gui=no --enable-perlinterp=yes $ make -j12 $ cd vim/src/testdir $ make test_compiler ...snip... Found errors in Test_compiler(): command line..script /home/dope/sb/vim/src/testdir/runtest.vim[601]..function RunTheTest[54]..Test_compiler line 24: command did not fail: clist command line..script /home/dope/sb/vim/src/testdir/runtest.vim[601]..function RunTheTest[54]..Test_compiler line 30: Pattern '\\n \\d\\+ Xfoo.pl:3: Global symbol "$foo" requires explicit package name' does not match '\n19 Xfoo.pl:3: Global symbol "$foo" requires explicit package name (did you forget to declare "my $foo"?)' make: *** [Makefile:70: test_compiler] Error 1 ``` Solution: set `LC_ALL` to "C" in `Test_compiler()` closes: #13173 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Dominique Pell? <dominique.pelle@tomtom.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Sep 2023 23:00:04 +0200
parents dbec60b8c253
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21783
483dc3fd596c patch 8.2.1441: running tests in tiny version gives error for summarize.vim
Bram Moolenaar <Bram@vim.org>
parents: 20980
diff changeset
1 set cpo&vim
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 if 1
17793
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
3 " This is executed only with the eval feature
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
4 set nocompatible
18995
c77d7a415e59 patch 8.2.0058: running tests changes ~/.viminfo
Bram Moolenaar <Bram@vim.org>
parents: 18184
diff changeset
5 set viminfo=
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 func Count(match, type)
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 if a:type ==# 'executed'
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 let g:executed += (a:match+0)
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 elseif a:type ==# 'failed'
16976
7160dcd5c1d2 patch 8.1.1488: summary of tests has incorrect failed count
Bram Moolenaar <Bram@vim.org>
parents: 16955
diff changeset
10 let g:failed += a:match+0
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 elseif a:type ==# 'skipped'
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 let g:skipped += 1
18184
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 17901
diff changeset
13 call extend(g:skipped_output, ["\t" .. a:match])
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 endif
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 endfunc
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 let g:executed = 0
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 let g:skipped = 0
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 let g:failed = 0
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 let g:skipped_output = []
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 let g:failed_output = []
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 let output = [""]
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23
18184
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 17901
diff changeset
24 if $TEST_FILTER != ''
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 17901
diff changeset
25 call extend(g:skipped_output, ["\tAll tests not matching $TEST_FILTER: '" .. $TEST_FILTER .. "'"])
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 17901
diff changeset
26 endif
ef35a3a70c24 patch 8.1.2087: cannot easily select one test function to execute
Bram Moolenaar <Bram@vim.org>
parents: 17901
diff changeset
27
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 try
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 " This uses the :s command to just fetch and process the output of the
17901
14122cb0ea3d patch 8.1.1947: when executing one test the report doesn't show it
Bram Moolenaar <Bram@vim.org>
parents: 17793
diff changeset
30 " tests, it doesn't actually replace anything.
17793
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
31 " And it uses "silent" to avoid reporting the number of matches.
20980
a51ce93f3e6c patch 8.2.1041: test summary is missing executed count
Bram Moolenaar <Bram@vim.org>
parents: 18995
diff changeset
32 silent %s/Executed\s\+\zs\d\+\ze\s\+tests\?/\=Count(submatch(0),'executed')/egn
17793
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
33 silent %s/^SKIPPED \zs.*/\=Count(submatch(0), 'skipped')/egn
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
34 silent %s/^\(\d\+\)\s\+FAILED:/\=Count(submatch(1), 'failed')/egn
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35
31849
dbec60b8c253 patch 9.0.1257: code style is not check in test scripts
Bram Moolenaar <Bram@vim.org>
parents: 21783
diff changeset
36 call extend(output, ["Skipped:"])
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 call extend(output, skipped_output)
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 call extend(output, [
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 \ "",
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 \ "-------------------------------",
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 \ printf("Executed: %5d Tests", g:executed),
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 \ printf(" Skipped: %5d Tests", g:skipped),
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 \ printf(" %s: %5d Tests", g:failed == 0 ? 'Failed' : 'FAILED', g:failed),
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 \ "",
17793
7f95fa061abc patch 8.1.1893: script to summarize test results can be improved
Bram Moolenaar <Bram@vim.org>
parents: 16976
diff changeset
46 \ ])
16951
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 if filereadable('test.log')
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 " outputs and indents the failed test result
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 call extend(output, ["", "Failures: "])
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 let failed_output = filter(readfile('test.log'), { v,k -> !empty(k)})
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 call extend(output, map(failed_output, { v,k -> "\t".k}))
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 " Add a final newline
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 call extend(output, [""])
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 endif
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 catch " Catch-all
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 finally
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 call writefile(output, 'test_result.log') " overwrites an existing file
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 endtry
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 endif
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61
ebdf6cd89910 patch 8.1.1476: no statistics displayed after running tests
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 q!