patch 8.1.0347: some tests fail on Solaris

Problem:    Some tests fail on Solaris.
Solution:   Skip writefile test. Fix path to libc.so. Improve test for Turkish
            case change. (Libor Bukata, Bjorn Linse, closes #3403)
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 848e798..cc82f81 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1,4 +1,5 @@
 " Tests for various functions.
+source shared.vim
 
 " Must be done first, since the alternate buffer must be unset.
 func Test_00_bufexists()
@@ -1006,6 +1007,17 @@
     let libc = 'msvcrt.dll'
   elseif has('mac')
     let libc = 'libSystem.B.dylib'
+  elseif system('uname -s') =~ 'SunOS'
+    " Set the path to libc.so according to the architecture.
+    let test_bits = system('file ' . GetVimProg())
+    let test_arch = system('uname -p')
+    if test_bits =~ '64-bit' && test_arch =~ 'sparc'
+      let libc = '/usr/lib/sparcv9/libc.so'
+    elseif test_bits =~ '64-bit' && test_arch =~ 'i386'
+      let libc = '/usr/lib/amd64/libc.so'
+    else
+      let libc = '/usr/lib/libc.so'
+    endif
   else
     " On Unix, libc.so can be in various places.
     " Interestingly, using an empty string for the 1st argument of libcall
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index e80c35b..a06426e 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -1630,12 +1630,13 @@
   norm! V~
   call assert_equal('THIS IS A simple test: äüöss', getline('.'))
 
-  " Turkish ASCII turns to multi-byte.  On Mac the Turkish locale is available
-  " but toupper()/tolower() don't do the right thing.
-  if !has('mac') && !has('osx')
-    try
-      lang tr_TR.UTF-8
-      set casemap=
+  " Turkish ASCII turns to multi-byte.  On some systems Turkish locale
+  " is available but toupper()/tolower() don't do the right thing.
+  try
+    lang tr_TR.UTF-8
+    set casemap=
+    let iupper = toupper('i')
+    if iupper == "\u0130"
       call setline(1, 'iI')
       1normal gUU
       call assert_equal("\u0130I", getline(1))
@@ -1645,8 +1646,7 @@
       1normal guu
       call assert_equal("i\u0131", getline(1))
       call assert_equal("i\u0131", tolower("iI"))
-
-      set casemap&
+    elseif iupper == "I"
       call setline(1, 'iI')
       1normal gUU
       call assert_equal("II", getline(1))
@@ -1656,13 +1656,25 @@
       1normal guu
       call assert_equal("ii", getline(1))
       call assert_equal("ii", tolower("iI"))
+    else
+      call assert_true(false, "expected toupper('i') to be either 'I' or '\u0130'")
+    endif
+    set casemap&
+    call setline(1, 'iI')
+    1normal gUU
+    call assert_equal("II", getline(1))
+    call assert_equal("II", toupper("iI"))
 
-      lang en_US.UTF-8
-    catch /E197:/
-      " can't use Turkish locale
-      throw 'Skipped: Turkish locale not available'
-    endtry
-  endif
+    call setline(1, 'iI')
+    1normal guu
+    call assert_equal("ii", getline(1))
+    call assert_equal("ii", tolower("iI"))
+
+    lang en_US.UTF-8
+  catch /E197:/
+    " can't use Turkish locale
+    throw 'Skipped: Turkish locale not available'
+  endtry
 
   " clean up
   bw!
diff --git a/src/testdir/test_writefile.vim b/src/testdir/test_writefile.vim
index 8e621b3..d1f6346 100644
--- a/src/testdir/test_writefile.vim
+++ b/src/testdir/test_writefile.vim
@@ -33,7 +33,7 @@
 endfunc
 
 func Test_writefile_fails_conversion()
-  if !has('multi_byte') || !has('iconv')
+  if !has('multi_byte') || !has('iconv') || system('uname -s') =~ 'SunOS'
     return
   endif
   set nobackup nowritebackup
diff --git a/src/version.c b/src/version.c
index b0ed507..790cd76 100644
--- a/src/version.c
+++ b/src/version.c
@@ -795,6 +795,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    347,
+/**/
     346,
 /**/
     345,