diff options
Diffstat (limited to 'src/os_test.c')
-rw-r--r-- | src/os_test.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/os_test.c b/src/os_test.c index ce4055277..b36cc8fa9 100644 --- a/src/os_test.c +++ b/src/os_test.c @@ -207,14 +207,24 @@ static int writeCache2(OsTestFile *pFile, int crash){ u8 *p = pFile->apBlk[i]; if( p ){ int skip = 0; + int trash = 0; if( crash ){ char random; sqlite3Randomness(1, &random); if( random & 0x01 ){ - skip = 1; + if( 0 && random & 0x02 ){ + trash = 1; #ifdef TRACE_WRITECACHE -printf("Not writing block %d of %s\n", i, pFile->zName); +printf("Trashing block %d of %s\n", i, pFile->zName); +#endif + }else{ + skip = 1; +#ifdef TRACE_WRITECACHE +printf("Skiping block %d of %s\n", i, pFile->zName); +#endif + } }else{ +#ifdef TRACE_WRITECACHE printf("Writing block %d of %s\n", i, pFile->zName); #endif } @@ -227,6 +237,9 @@ printf("Writing block %d of %s\n", i, pFile->zName); if( BLOCK_OFFSET(i+1)>nMax ){ len = nMax-BLOCK_OFFSET(i); } + if( trash ){ + sqlite3Randomness(len, p); + } rc = sqlite3RealWrite(&pFile->fd, p, len); } sqliteFree(p); |