patch 8.1.0471: some tests are flaky or fail on some systems

Problem:    Some tests are flaky or fail on some systems.
Solution:   Increase waiting time for port number. Use "cmd /c" to execute
            "echo" on win32. (Ken Takata, closes #3534)
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim
index 6911409..92aacfa 100644
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -49,7 +49,8 @@
 " Read the port number from the Xportnr file.
 func GetPort()
   let l = []
-  for i in range(200)
+  " with 200 it sometimes failed
+  for i in range(400)
     try
       let l = readfile("Xportnr")
     catch
@@ -274,6 +275,10 @@
   let cmd = GetVimCommand()
   let cmd = substitute(cmd, '-u NONE', '--clean', '')
   let cmd = substitute(cmd, '--not-a-term', '', '')
+
+  " Optionally run Vim under valgrind
+  " let cmd = 'valgrind --tool=memcheck --leak-check=yes --num-callers=25 --log-file=valgrind ' . cmd
+
   return cmd
 endfunc