aboutsummaryrefslogtreecommitdiff
path: root/src/test6.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-05-03 16:36:55 +0000
committerdrh <drh@noemail.net>2010-05-03 16:36:55 +0000
commit4c846bb14896bc23e4403b01b255acbf37525ee8 (patch)
tree9e487a2c35ad6c9fb64de7f500c76c90e37c51e3 /src/test6.c
parent1fbe0f2a8fd6b5910363ac3851d4c263431224be (diff)
downloadsqlite-4c846bb14896bc23e4403b01b255acbf37525ee8.tar.gz
sqlite-4c846bb14896bc23e4403b01b255acbf37525ee8.zip
Update the crash-test VFS in test6.c to pass-through the shared-memory
methods to the real underlying VFS. This fixes the walcrash.test script. FossilOrigin-Name: ea09ff37911376505e8262ee9841224995b696f2
Diffstat (limited to 'src/test6.c')
-rw-r--r--src/test6.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/test6.c b/src/test6.c
index 3da9502fd..1ebde80e1 100644
--- a/src/test6.c
+++ b/src/test6.c
@@ -657,6 +657,33 @@ static int cfCurrentTime(sqlite3_vfs *pCfVfs, double *pTimeOut){
sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
return pVfs->xCurrentTime(pVfs, pTimeOut);
}
+static int cfShmOpen(sqlite3_vfs *pCfVfs, const char *zName, sqlite3_shm **pp){
+ sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
+ return pVfs->xShmOpen(pVfs, zName, pp);
+}
+static int cfShmSize(sqlite3_vfs *pCfVfs, sqlite3_shm *p,
+ int reqSize, int *pNew){
+ sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
+ return pVfs->xShmSize(pVfs, p, reqSize, pNew);
+}
+static int cfShmGet(sqlite3_vfs *pCfVfs, sqlite3_shm *p,
+ int reqSize, int *pSize, void **pp){
+ sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
+ return pVfs->xShmGet(pVfs, p, reqSize, pSize, pp);
+}
+static int cfShmRelease(sqlite3_vfs *pCfVfs, sqlite3_shm *p){
+ sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
+ return pVfs->xShmRelease(pVfs, p);
+}
+static int cfShmLock(sqlite3_vfs *pCfVfs, sqlite3_shm *p,
+ int desiredLock, int *gotLock){
+ sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
+ return pVfs->xShmLock(pVfs, p, desiredLock, gotLock);
+}
+static int cfShmClose(sqlite3_vfs *pCfVfs, sqlite3_shm *p, int delFlag){
+ sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
+ return pVfs->xShmClose(pVfs, p, delFlag);
+}
static int processDevSymArgs(
Tcl_Interp *interp,
@@ -764,7 +791,7 @@ static int crashEnableCmd(
){
int isEnable;
static sqlite3_vfs crashVfs = {
- 1, /* iVersion */
+ 2, /* iVersion */
0, /* szOsFile */
0, /* mxPathname */
0, /* pNext */
@@ -782,6 +809,15 @@ static int crashEnableCmd(
cfRandomness, /* xRandomness */
cfSleep, /* xSleep */
cfCurrentTime, /* xCurrentTime */
+ 0, /* xGetlastError */
+ cfShmOpen, /* xShmOpen */
+ cfShmSize, /* xShmSize */
+ cfShmGet, /* xShmGet */
+ cfShmRelease, /* xShmRelease */
+ cfShmLock, /* xShmLock */
+ cfShmClose, /* xShmClose */
+ 0, /* xRename */
+ 0, /* xCurrentTimeInt64 */
};
if( objc!=2 ){
@@ -802,6 +838,11 @@ static int crashEnableCmd(
crashVfs.mxPathname = pOriginalVfs->mxPathname;
crashVfs.pAppData = (void *)pOriginalVfs;
crashVfs.szOsFile = sizeof(CrashFile) + pOriginalVfs->szOsFile;
+ if( pOriginalVfs->iVersion<2 || pOriginalVfs->xShmOpen==0 ){
+ crashVfs.xShmOpen = 0;
+ }else{
+ crashVfs.xShmOpen = cfShmOpen;
+ }
sqlite3_vfs_register(&crashVfs, 0);
}else{
crashVfs.pAppData = 0;