comparison src/testdir/runtest.vim @ 19795:1c7f92a1100e v8.2.0454

patch 8.2.0454: some tests fail when the system is slow Commit: https://github.com/vim/vim/commit/3ed9efc2b15b624268bcce4e4d312fb35840a12b Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 26 16:50:57 2020 +0100 patch 8.2.0454: some tests fail when the system is slow Problem: Some tests fail when the system is slow. Solution: Make the run number global, use in the test to increase the waiting time. (closes #5841)
author Bram Moolenaar <Bram@vim.org>
date Thu, 26 Mar 2020 17:00:04 +0100
parents 2bd03926397a
children e373843e2980
comparison
equal deleted inserted replaced
19794:37fc7cc2d83b 19795:1c7f92a1100e
404 for s:test in sort(s:tests) 404 for s:test in sort(s:tests)
405 " Silence, please! 405 " Silence, please!
406 set belloff=all 406 set belloff=all
407 let prev_error = '' 407 let prev_error = ''
408 let total_errors = [] 408 let total_errors = []
409 let run_nr = 1 409 let g:run_nr = 1
410 410
411 " A test can set test_is_flaky to retry running the test. 411 " A test can set test_is_flaky to retry running the test.
412 let test_is_flaky = 0 412 let test_is_flaky = 0
413 413
414 call RunTheTest(s:test) 414 call RunTheTest(s:test)
421 \ || test_is_flaky) 421 \ || test_is_flaky)
422 while 1 422 while 1
423 call add(s:messages, 'Found errors in ' . s:test . ':') 423 call add(s:messages, 'Found errors in ' . s:test . ':')
424 call extend(s:messages, v:errors) 424 call extend(s:messages, v:errors)
425 425
426 call add(total_errors, 'Run ' . run_nr . ':') 426 call add(total_errors, 'Run ' . g:run_nr . ':')
427 call extend(total_errors, v:errors) 427 call extend(total_errors, v:errors)
428 428
429 if run_nr == 5 || prev_error == v:errors[0] 429 if g:run_nr == 5 || prev_error == v:errors[0]
430 call add(total_errors, 'Flaky test failed too often, giving up') 430 call add(total_errors, 'Flaky test failed too often, giving up')
431 let v:errors = total_errors 431 let v:errors = total_errors
432 break 432 break
433 endif 433 endif
434 434
439 " time. 439 " time.
440 sleep 2 440 sleep 2
441 441
442 let prev_error = v:errors[0] 442 let prev_error = v:errors[0]
443 let v:errors = [] 443 let v:errors = []
444 let run_nr += 1 444 let g:run_nr += 1
445 445
446 call RunTheTest(s:test) 446 call RunTheTest(s:test)
447 447
448 if len(v:errors) == 0 448 if len(v:errors) == 0
449 " Test passed on rerun. 449 " Test passed on rerun.