patch 8.1.2133: some tests fail when run as root

Problem:    Some tests fail when run as root.
Solution:   Add CheckNotRoot and use it. (James McCoy, closes #5020)
diff --git a/src/testdir/test_swap.vim b/src/testdir/test_swap.vim
index 6e01ad0..aa67b43 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 @@
   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