diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-10-10 16:46:17 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-10-10 16:46:17 +0200 |
commit | 07282f01da06c158bab4787adc89ec15d7eeb202 (patch) | |
tree | ef74e4e842d0b3f04cd2ebb99f452ee2848f62a8 /src/testdir/test_swap.vim | |
parent | a129974bc71fcb86e05a29387bcaba9aae2f296a (diff) | |
download | vim-git-07282f01da06c158bab4787adc89ec15d7eeb202.tar.gz |
patch 8.1.2133: some tests fail when run as rootv8.1.2133
Problem: Some tests fail when run as root.
Solution: Add CheckNotRoot and use it. (James McCoy, closes #5020)
Diffstat (limited to 'src/testdir/test_swap.vim')
-rw-r--r-- | src/testdir/test_swap.vim | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/testdir/test_swap.vim b/src/testdir/test_swap.vim index 6e01ad00d..aa67b430e 100644 --- a/src/testdir/test_swap.vim +++ b/src/testdir/test_swap.vim @@ -1,5 +1,7 @@ " Tests for the swap feature +source shared.vim + func s:swapname() return trim(execute('swapname')) endfunc @@ -196,14 +198,17 @@ func Test_swapfile_delete() quit call assert_equal(fnamemodify(swapfile_name, ':t'), fnamemodify(s:swapname, ':t')) - " Write the swapfile with a modified PID, now it will be automatically - " deleted. Process one should never be Vim. - let swapfile_bytes[24:27] = 0z01000000 - call writefile(swapfile_bytes, swapfile_name) - let s:swapname = '' - split XswapfileText - quit - call assert_equal('', s:swapname) + " This test won't work as root because root can successfully run kill(1, 0) + if !IsRoot() + " Write the swapfile with a modified PID, now it will be automatically + " deleted. Process one should never be Vim. + let swapfile_bytes[24:27] = 0z01000000 + call writefile(swapfile_bytes, swapfile_name) + let s:swapname = '' + split XswapfileText + quit + call assert_equal('', s:swapname) + endif " Now set the modified flag, the swap file will not be deleted let swapfile_bytes[28 + 80 + 899] = 0x55 |