]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
In the OOM testing logic, add the sqlite3FirstFault() routine as a place to
authordrh <drh@noemail.net>
Thu, 24 May 2018 17:38:00 +0000 (17:38 +0000)
committerdrh <drh@noemail.net>
Thu, 24 May 2018 17:38:00 +0000 (17:38 +0000)
set a breakpoint the first time any simulated OOM fault occurs for a single
test case.

FossilOrigin-Name: b4d80bd287ca7f3a6d182ba2435273266035b94fdf6a44047a64a4eff931c571

manifest
manifest.uuid
src/test_malloc.c

index 1071a5813f5eb555ed48dee934d3fda96a14edc5..02f369cbf6c15a43207adb0e2145eb4048c5c074 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\stypo\sin\sa\scomment\sused\sto\sgenerate\sVDBE\sopcode\sdocumentation.\s\sNo\ncode\schanges.
-D 2018-05-24T17:25:35.177
+C In\sthe\sOOM\stesting\slogic,\sadd\sthe\ssqlite3FirstFault()\sroutine\sas\sa\splace\sto\nset\sa\sbreakpoint\sthe\sfirst\stime\sany\ssimulated\sOOM\sfault\soccurs\sfor\sa\ssingle\ntest\scase.
+D 2018-05-24T17:38:00.681
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in bfc40f350586923e0419d2ea4b559c37ec10ee4b6e210e08c14401f8e340f0da
@@ -531,7 +531,7 @@ F src/test_intarray.c 988fc61cb0ff539f4172c0d95f15287c92516f64
 F src/test_intarray.h f3b7672f5d1056eac563c0d6ea8480a660b1475c
 F src/test_journal.c 619f2aa10e0d7a5f87c0f06825bc61dfce1c6b9c7f3ad990fb13de6c3b8874a3
 F src/test_loadext.c 337056bae59f80b9eb00ba82088b39d0f4fe6dfd
-F src/test_malloc.c 5201422e2403e66a7a9c2b7d8df806acd8d2a0429822adb7e932f324e7b5b3c6
+F src/test_malloc.c dec0aa821b230773aeb3dd11d652c1193f7cedb18a20b25659bc672288115242
 F src/test_md5.c 7268e1e8c399d4a5e181b64ac20e1e6f3bc4dd9fc87abac02db145a3d951fa8c
 F src/test_multiplex.c e054459f7633f3ff8ce1245da724f9a8be189e4e
 F src/test_multiplex.h 5436d03f2d0501d04f3ed50a75819e190495b635
@@ -1729,7 +1729,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 95f2d62cf3cf8dbe0f12b652b47fe1f8e0f52bc269e269955fafdf802afc47c1
-R feb4f88886f01280dec4144b6c4a9227
+P 36cdfbf2ce1811691c790fde3eaeed0238c03b4dc97dc3a20d1e0397520145d1
+R 085dc0bd34d45e9f6435a293683fda7b
 U drh
-Z ad2bc326f1608b0e430647ea2c2e00b0
+Z 2f994e2ed2922ec0ed95eb384d135eee
index 35931eb0563d46e65c935836c87f5c1b5cc3af88..7278a0f019def3c4116e0c3909cffaa6d3a2ae1f 100644 (file)
@@ -1 +1 @@
-36cdfbf2ce1811691c790fde3eaeed0238c03b4dc97dc3a20d1e0397520145d1
\ No newline at end of file
+b4d80bd287ca7f3a6d182ba2435273266035b94fdf6a44047a64a4eff931c571
\ No newline at end of file
index 33bc3807bad320564fd3f1e97b533e7e03384fe3..32a03e71911e847d8a986aa762adc8952205b50c 100644 (file)
@@ -32,6 +32,8 @@ static struct MemFault {
   int nRepeat;            /* Number of times to repeat the failure */
   int nBenign;            /* Number of benign failures seen since last config */
   int nFail;              /* Number of failures seen since last config */
+  int nOkBefore;          /* Successful allocations prior to the first fault */
+  int nOkAfter;           /* Successful allocations after a fault */
   u8 enable;              /* True if enabled */
   int isInstalled;        /* True if the fault simulation layer is installed */
   int isBenignMode;       /* True if malloc failures are considered benign */
@@ -47,18 +49,32 @@ static void sqlite3Fault(void){
   cnt++;
 }
 
+/*
+** This routine exists as a place to set a breakpoint that will
+** fire the first time any malloc() fails on a single test case.
+** The sqlite3Fault() routine above runs on every malloc() failure.
+** This routine only runs on the first such failure.
+*/
+static void sqlite3FirstFault(void){
+  static int cnt2 = 0;
+  cnt2++;
+}
+
 /*
 ** Check to see if a fault should be simulated.  Return true to simulate
 ** the fault.  Return false if the fault should not be simulated.
 */
 static int faultsimStep(void){
   if( likely(!memfault.enable) ){
+    memfault.nOkAfter++;
     return 0;
   }
   if( memfault.iCountdown>0 ){
     memfault.iCountdown--;
+    memfault.nOkBefore++;
     return 0;
   }
+  if( memfault.nFail==0 ) sqlite3FirstFault();
   sqlite3Fault();
   memfault.nFail++;
   if( memfault.isBenignMode>0 ){
@@ -133,6 +149,8 @@ static void faultsimConfig(int nDelay, int nRepeat){
   memfault.nRepeat = nRepeat;
   memfault.nBenign = 0;
   memfault.nFail = 0;
+  memfault.nOkBefore = 0;
+  memfault.nOkAfter = 0;
   memfault.enable = nDelay>=0;
 
   /* Sometimes, when running multi-threaded tests, the isBenignMode