patch 8.2.5143: some tests fail when using valgrind

Problem:    Some tests fail when using valgrind. Spurious leak reports.
Solution:   Use WaitForAssert().  Avoid failing fork/exec.  Skip tests where a
            job is killed when running valgrind.
diff --git a/src/testdir/test_iminsert.vim b/src/testdir/test_iminsert.vim
index a0e9db0..9f3ede3 100644
--- a/src/testdir/test_iminsert.vim
+++ b/src/testdir/test_iminsert.vim
@@ -81,11 +81,9 @@
   END
   call writefile(lines, 'Xscript')
   let buf = RunVimInTerminal('-S Xscript', {})
-  call term_wait(buf)
   call assert_notequal('abc', term_getline(buf, 2))
   call term_sendkeys(buf, "/abc\n")
-  call term_wait(buf)
-  call assert_equal('abc', term_getline(buf, 2))
+  call WaitForAssert({-> assert_equal('abc', term_getline(buf, 2))})
 
   " clean up
   call StopVimInTerminal(buf)