To: vim_dev@googlegroups.com Subject: Patch 8.0.0955 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0955 Problem: Test_existent_file() fails on some file systems. Solution: Run the test again with a sleep when the test fails without a sleep. (James McCoy, closes #1984) Files: src/testdir/test_stat.vim *** ../vim-8.0.0954/src/testdir/test_stat.vim 2017-02-01 22:05:22.598481671 +0100 --- src/testdir/test_stat.vim 2017-08-17 17:34:06.398070760 +0200 *************** *** 1,20 **** " Tests for stat functions and checktime ! func Test_existent_file() let fname = 'Xtest.tmp' let ts = localtime() let fl = ['Hello World!'] call writefile(fl, fname) let tf = getftime(fname) let te = localtime() ! call assert_true(ts <= tf && tf <= te) ! call assert_equal(strlen(fl[0] . "\n"), getfsize(fname)) ! call assert_equal('file', getftype(fname)) ! call assert_equal('rw-', getfperm(fname)[0:2]) call delete(fname) endfunc func Test_existent_directory() --- 1,41 ---- " Tests for stat functions and checktime ! func CheckFileTime(doSleep) let fname = 'Xtest.tmp' + let result = 0 let ts = localtime() + if a:doSleep + sleep 1 + endif let fl = ['Hello World!'] call writefile(fl, fname) let tf = getftime(fname) + if a:doSleep + sleep 1 + endif let te = localtime() ! let time_correct = (ts <= tf && tf <= te) ! if a:doSleep || time_correct ! call assert_true(time_correct) ! call assert_equal(strlen(fl[0] . "\n"), getfsize(fname)) ! call assert_equal('file', getftype(fname)) ! call assert_equal('rw-', getfperm(fname)[0:2]) ! let result = 1 ! endif call delete(fname) + return result + endfunc + + func Test_existent_file() + " On some systems the file timestamp is rounded to a multiple of 2 seconds. + " We need to sleep to handle that, but that makes the test slow. First try + " without the sleep, and if it fails try again with the sleep. + if CheckFileTime(0) == 0 + call CheckFileTime(1) + endif endfunc func Test_existent_directory() *** ../vim-8.0.0954/src/version.c 2017-08-17 17:20:58.207273018 +0200 --- src/version.c 2017-08-17 17:31:51.050993839 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 955, /**/ -- OLD WOMAN: King of the WHO? ARTHUR: The Britons. OLD WOMAN: Who are the Britons? "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///