Patch 8.2.2031
Problem:    Some tests fail when run under valgrind.
Solution:   Avoid timing problems.
Files:      src/testdir/test_vim9_func.vim, src/testdir/test_channel.vim,
            src/testdir/test_clientserver.vim, src/testdir/test_debugger.vim,
            src/testdir/test_quotestar.vim


*** ../vim-8.2.2030/src/testdir/test_vim9_func.vim      2020-11-20 
19:26:45.081207924 +0100
--- src/testdir/test_vim9_func.vim      2020-11-22 12:13:09.707502937 +0100
***************
*** 37,43 ****
      for i in range(1, 9)
        text ..= term_getline(buf, i)
      endfor
!     if text =~ 'Error detected'
        break
      endif
      sleep 20m
--- 37,43 ----
      for i in range(1, 9)
        text ..= term_getline(buf, i)
      endfor
!     if text =~ 'Variable not found: nothing'
        break
      endif
      sleep 20m
*** ../vim-8.2.2030/src/testdir/test_channel.vim        2020-09-04 
21:18:40.480161935 +0200
--- src/testdir/test_channel.vim        2020-11-22 14:14:10.778484275 +0100
***************
*** 2181,2198 ****
    else
      let cmd = 'grep foo'
    endif
    let g:job = job_start(cmd, {})
    call job_stop(g:job)
!   sleep 50m
!   call assert_equal(-1, job_info(g:job).exitval)
    let g:job = job_start(cmd, {})
-   call job_stop(g:job, 'term')
    sleep 50m
!   call assert_equal(-1, job_info(g:job).exitval)
    let g:job = job_start(cmd, {})
-   call job_stop(g:job, 'kill')
    sleep 50m
!   call assert_equal(-1, job_info(g:job).exitval)
  endfunc
  
  func Test_issue_5485()
--- 2181,2201 ----
    else
      let cmd = 'grep foo'
    endif
+ 
    let g:job = job_start(cmd, {})
+   sleep 50m  " give the job time to start
    call job_stop(g:job)
!   call WaitForAssert({-> assert_equal(-1, job_info(g:job).exitval)})
! 
    let g:job = job_start(cmd, {})
    sleep 50m
!   call job_stop(g:job, 'term')
!   call WaitForAssert({-> assert_equal(-1, job_info(g:job).exitval)})
! 
    let g:job = job_start(cmd, {})
    sleep 50m
!   call job_stop(g:job, 'kill')
!   call WaitForAssert({-> assert_equal(-1, job_info(g:job).exitval)})
  endfunc
  
  func Test_issue_5485()
*** ../vim-8.2.2030/src/testdir/test_clientserver.vim   2020-09-04 
21:18:40.480161935 +0200
--- src/testdir/test_clientserver.vim   2020-11-22 12:44:35.806844622 +0100
***************
*** 63,70 ****
        call remote_send(name, ":gui -f\<CR>")
      endif
      " Wait for the server to be up and answering requests.
!     sleep 100m
!     call WaitForAssert({-> assert_true(name->remote_expr("v:version", "", 1) 
!= "")})
  
      call remote_send(name, ":let testvar = 'maybe'\<CR>")
      call WaitForAssert({-> assert_equal('maybe', remote_expr(name, "testvar", 
"", 2))})
--- 63,71 ----
        call remote_send(name, ":gui -f\<CR>")
      endif
      " Wait for the server to be up and answering requests.
!     " When using valgrind this can be very, very slow.
!     sleep 1
!     call WaitForAssert({-> assert_match('\d', name->remote_expr("v:version", 
"", 1))}, 10000)
  
      call remote_send(name, ":let testvar = 'maybe'\<CR>")
      call WaitForAssert({-> assert_equal('maybe', remote_expr(name, "testvar", 
"", 2))})
*** ../vim-8.2.2030/src/testdir/test_debugger.vim       2020-10-03 
14:14:52.378304963 +0200
--- src/testdir/test_debugger.vim       2020-11-22 13:14:04.269559196 +0100
***************
*** 17,30 ****
  endfunc
  command! -nargs=0 -bar CheckCWD call CheckCWD()
  
  func CheckDbgOutput(buf, lines, options = {})
    " Verify the expected output
    let lnum = 20 - len(a:lines)
    for l in a:lines
      if get(a:options, 'match', 'equal') ==# 'pattern'
!       call WaitForAssert({-> assert_match(l, term_getline(a:buf, lnum))}, 200)
      else
!       call WaitForAssert({-> assert_equal(l, term_getline(a:buf, lnum))}, 200)
      endif
      let lnum += 1
    endfor
--- 17,34 ----
  endfunc
  command! -nargs=0 -bar CheckCWD call CheckCWD()
  
+ " "options" argument can contain:
+ " 'msec' - time to wait for a match
+ " 'match' - "pattern" to use "lines" as pattern instead of text
  func CheckDbgOutput(buf, lines, options = {})
    " Verify the expected output
    let lnum = 20 - len(a:lines)
+   let msec = get(a:options, 'msec', 1000)
    for l in a:lines
      if get(a:options, 'match', 'equal') ==# 'pattern'
!       call WaitForAssert({-> assert_match(l, term_getline(a:buf, lnum))}, 
msec)
      else
!       call WaitForAssert({-> assert_equal(l, term_getline(a:buf, lnum))}, 
msec)
      endif
      let lnum += 1
    endfor
***************
*** 198,204 ****
  
    " Start a debug session, so that reading the last line from the terminal
    " works properly.
!   call RunDbgCmd(buf, ':debug echo Foo()')
  
    " No breakpoints
    call RunDbgCmd(buf, 'breakl', ['No breakpoints defined'])
--- 202,208 ----
  
    " Start a debug session, so that reading the last line from the terminal
    " works properly.
!   call RunDbgCmd(buf, ':debug echo Foo()', ['cmd: echo Foo()'])
  
    " No breakpoints
    call RunDbgCmd(buf, 'breakl', ['No breakpoints defined'])
***************
*** 809,817 ****
          \ '-S Xtest1.vim -c "debug call GlobalFunction()"',
          \ {'wait_for_ruler': 0})
  
!   " Need to wait for the vim-in-terminal to be ready
    call CheckDbgOutput(buf, ['command line',
!                             \ 'cmd: call GlobalFunction()'])
  
    " At this point the ontly thing in the stack is the cmdline
    call RunDbgCmd(buf, 'backtrace', [
--- 813,822 ----
          \ '-S Xtest1.vim -c "debug call GlobalFunction()"',
          \ {'wait_for_ruler': 0})
  
!   " Need to wait for the vim-in-terminal to be ready.
!   " With valgrind this can take quite long.
    call CheckDbgOutput(buf, ['command line',
!                             \ 'cmd: call GlobalFunction()'], #{msec: 5000})
  
    " At this point the ontly thing in the stack is the cmdline
    call RunDbgCmd(buf, 'backtrace', [
***************
*** 960,973 ****
    " set a breakpoint and source file1.vim
    let buf = RunVimInTerminal(
          \ '-c "breakadd file 1 Xtest1.vim" -S Xtest1.vim',
!         \ #{ wait_for_ruler: 0 } )
  
    call CheckDbgOutput(buf, [
          \ 'Breakpoint in "' .. file1 .. '" line 1',
          \ 'Entering Debug mode.  Type "cont" to continue.',
          \ 'command line..script ' .. file1,
          \ 'line 1: let s:file1_var = ''file1'''
!         \ ])
  
    " step throught the initial declarations
    call RunDbgCmd(buf, 'step', [ 'line 2: let g:global_var = ''global''' ] )
--- 965,978 ----
    " set a breakpoint and source file1.vim
    let buf = RunVimInTerminal(
          \ '-c "breakadd file 1 Xtest1.vim" -S Xtest1.vim',
!         \ #{wait_for_ruler: 0})
  
    call CheckDbgOutput(buf, [
          \ 'Breakpoint in "' .. file1 .. '" line 1',
          \ 'Entering Debug mode.  Type "cont" to continue.',
          \ 'command line..script ' .. file1,
          \ 'line 1: let s:file1_var = ''file1'''
!         \ ], #{msec: 5000})
  
    " step throught the initial declarations
    call RunDbgCmd(buf, 'step', [ 'line 2: let g:global_var = ''global''' ] )
*** ../vim-8.2.2030/src/testdir/test_quotestar.vim      2020-08-12 
18:50:31.883655785 +0200
--- src/testdir/test_quotestar.vim      2020-11-22 13:18:17.853118055 +0100
***************
*** 98,105 ****
  
      " Running in a terminal and the GUI is available: Tell the server to open
      " the GUI and check that the remote command still works.
-     " Need to wait for the GUI to start up, otherwise the send hangs in trying
-     " to send to the terminal window.
      if has('gui_athena') || has('gui_motif')
        " For those GUIs, ignore the 'failed to create input context' error.
        call remote_send(name, ":call test_ignore_error('E285') | gui -f\<CR>")
--- 98,103 ----
***************
*** 107,113 ****
--- 105,114 ----
        call remote_send(name, ":gui -f\<CR>")
      endif
      " Wait for the server in the GUI to be up and answering requests.
+     " First need to wait for the GUI to start up, otherwise the send hangs in
+     " trying to send to the terminal window.
      " On some systems and with valgrind this can be very slow.
+     sleep 1
      call WaitForAssert({-> assert_match("1", remote_expr(name, 
"has('gui_running')", "", 1))}, 10000)
  
      call remote_send(name, ":let @* = 'maybe'\<CR>")
*** ../vim-8.2.2030/src/version.c       2020-11-21 21:41:36.186011139 +0100
--- src/version.c       2020-11-22 14:22:42.423601960 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2031,
  /**/

-- 
Just think of all the things we haven't thought of yet.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202011221324.0AMDOVtO1209210%40masaka.moolenaar.net.

Raspunde prin e-mail lui