diff src/testdir/screendump.vim @ 28710:54e33757d1ec v8.2.4879

patch 8.2.4879: screendump test may fail when using valgrind Commit: https://github.com/vim/vim/commit/3e79427803927be42409e9e50c0a308526b83656 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 6 11:21:19 2022 +0100 patch 8.2.4879: screendump test may fail when using valgrind Problem: Screendump test may fail when using valgrind. Solution: Wait longer for the first screendump.
author Bram Moolenaar <Bram@vim.org>
date Fri, 06 May 2022 12:30:03 +0200
parents 95d6e3c9aa1e
children 9dce192d1ac2
line wrap: on
line diff
--- a/src/testdir/screendump.vim
+++ b/src/testdir/screendump.vim
@@ -15,15 +15,18 @@ endif
 
 " Verify that Vim running in terminal buffer "buf" matches the screen dump.
 " "options" is passed to term_dumpwrite().
+" Additionally, the "wait" entry can specify the maximum time to wait for the
+" screen dump to match in msec (default 1000 msec).
 " The file name used is "dumps/{filename}.dump".
 " Optionally an extra argument can be passed which is prepended to the error
 " message.  Use this when using the same dump file with different options.
-" Will wait for up to a second for the screen dump to match.
 " Returns non-zero when verification fails.
 func VerifyScreenDump(buf, filename, options, ...)
   let reference = 'dumps/' . a:filename . '.dump'
   let testfile = 'failed/' . a:filename . '.dump'
 
+  let max_loops = get(a:options, 'wait', 1000) / 10
+
   " Starting a terminal to make a screendump is always considered flaky.
   let g:test_is_flaky = 1
 
@@ -60,7 +63,7 @@ func VerifyScreenDump(buf, filename, opt
       endif
       break
     endif
-    if i == 100
+    if i == max_loops
       " Leave the failed dump around for inspection.
       if filereadable(reference)
 	let msg = 'See dump file difference: call term_dumpdiff("testdir/' .. testfile .. '", "testdir/' .. reference .. '")'