Fix a problem in shared_err.test preventing it from running properly and add a test to corrupt2.test to cover another corruption detection case. (CVS 5355)

FossilOrigin-Name: 2dcd5287a0d71140baa23aae2ab3d95d78a5676d
diff --git a/test/shared_err.test b/test/shared_err.test
index 457c987..95e8c90 100644
--- a/test/shared_err.test
+++ b/test/shared_err.test
@@ -13,7 +13,7 @@
 # cache context. What happens to connection B if one connection A encounters
 # an IO-error whilst reading or writing the file-system?
 #
-# $Id: shared_err.test,v 1.20 2008/07/07 14:56:57 danielk1977 Exp $
+# $Id: shared_err.test,v 1.21 2008/07/07 17:55:29 danielk1977 Exp $
 
 proc skip {args} {}
 
@@ -291,17 +291,6 @@
   db2 close
 }
 
-# Only run these tests if memory debugging is turned on.
-#
-ifcapable !memdebug {
-   puts "Skipping tests shared_err-4 through -9:\
-         not compiled with -DSQLITE_MEMDEBUG..."
-   db close
-   sqlite3_enable_shared_cache $::enable_shared_cache
-   finish_test
-   return
-}
-
 # Provoke a malloc() failure when a cursor position is being saved. This
 # only happens with index cursors (because they malloc() space to save the
 # current key value). It does not happen with tables, because an integer
@@ -416,7 +405,7 @@
     set res [catchsql {SELECT a FROM t1} db2]
     set ans [lindex $res 1]
     if {[lindex $res 0]} {
-       set r [expr {$ans=="disk I/O error"}]
+       set r [expr {$ans=="disk I/O error" || $ans=="out of memory"}]
     } else {
        set r [expr {[lrange $ans 0 1]=="0000000000 1111111111"}]
     }
@@ -441,7 +430,6 @@
   expr $::aborted>=1
 } {1}
 
-
 # This test is designed to catch a specific bug that was present during
 # development of 3.5.0. If a malloc() failed while setting the page-size,
 # a buffer (Pager.pTmpSpace) was being freed. This could cause a seg-fault
@@ -499,6 +487,9 @@
   execsql { SELECT * FROM sqlite_master }
 }
 
+catch {db close}
+catch {db2 close}
+
 do_malloc_test shared_err-12 -sqlbody {
   CREATE TABLE abc(a, b, c);
   INSERT INTO abc VALUES(1, 2, 3);