Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: third_party/sqlite/src/src/test6.c

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/src/test5.c ('k') | third_party/sqlite/src/src/test7.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/src/test6.c
diff --git a/third_party/sqlite/src/src/test6.c b/third_party/sqlite/src/src/test6.c
index 306482dcd30964268958e854eae4fb87bda06ad0..5304bcc31f20b012501aa544ffe6a618a1c12671 100644
--- a/third_party/sqlite/src/src/test6.c
+++ b/third_party/sqlite/src/src/test6.c
@@ -16,7 +16,11 @@
*/
#if SQLITE_TEST /* This file is used for testing only */
#include "sqliteInt.h"
-#include "tcl.h"
+#if defined(INCLUDE_SQLITE_TCL_H)
+# include "sqlite_tcl.h"
+#else
+# include "tcl.h"
+#endif
#ifndef SQLITE_OMIT_DISKIO /* This file is a no-op if disk I/O is disabled */
@@ -215,7 +219,9 @@ static int writeListSync(CrashFile *pFile, int isCrash){
}
#ifdef TRACE_CRASHTEST
- printf("Sync %s (is %s crash)\n", pFile->zName, (isCrash?"a":"not a"));
+ if( pFile ){
+ printf("Sync %s (is %s crash)\n", pFile->zName, (isCrash?"a":"not a"));
+ }
#endif
ppPtr = &g.pWriteList;
@@ -701,6 +707,10 @@ static int cfCurrentTime(sqlite3_vfs *pCfVfs, double *pTimeOut){
sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
return pVfs->xCurrentTime(pVfs, pTimeOut);
}
+static int cfGetLastError(sqlite3_vfs *pCfVfs, int n, char *z){
+ sqlite3_vfs *pVfs = (sqlite3_vfs *)pCfVfs->pAppData;
+ return pVfs->xGetLastError(pVfs, n, z);
+}
static int processDevSymArgs(
Tcl_Interp *interp,
@@ -796,12 +806,33 @@ static int processDevSymArgs(
}
/*
+** tclcmd: sqlite3_crash_now
+**
+** Simulate a crash immediately. This function does not return
+** (writeListSync() calls exit(-1)).
+*/
+static int SQLITE_TCLAPI crashNowCmd(
+ void * clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *CONST objv[]
+){
+ if( objc!=1 ){
+ Tcl_WrongNumArgs(interp, 1, objv, "");
+ return TCL_ERROR;
+ }
+ writeListSync(0, 1);
+ assert( 0 );
+ return TCL_OK;
+}
+
+/*
** tclcmd: sqlite_crash_enable ENABLE
**
** Parameter ENABLE must be a boolean value. If true, then the "crash"
** vfs is added to the system. If false, it is removed.
*/
-static int crashEnableCmd(
+static int SQLITE_TCLAPI crashEnableCmd(
void * clientData,
Tcl_Interp *interp,
int objc,
@@ -827,7 +858,7 @@ static int crashEnableCmd(
cfRandomness, /* xRandomness */
cfSleep, /* xSleep */
cfCurrentTime, /* xCurrentTime */
- 0, /* xGetlastError */
+ cfGetLastError, /* xGetLastError */
0, /* xCurrentTimeInt64 */
};
@@ -876,7 +907,7 @@ static int crashEnableCmd(
** sqlite_crashparams -sect 1024 -char {atomic sequential} ./test.db 1
**
*/
-static int crashParamsObjCmd(
+static int SQLITE_TCLAPI crashParamsObjCmd(
void * clientData,
Tcl_Interp *interp,
int objc,
@@ -923,7 +954,7 @@ error:
return TCL_ERROR;
}
-static int devSymObjCmd(
+static int SQLITE_TCLAPI devSymObjCmd(
void * clientData,
Tcl_Interp *interp,
int objc,
@@ -940,12 +971,33 @@ static int devSymObjCmd(
devsym_register(iDc, iSectorSize);
return TCL_OK;
+
+}
+
+/*
+** tclcmd: unregister_devsim
+*/
+static int SQLITE_TCLAPI dsUnregisterObjCmd(
+ void * clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *CONST objv[]
+){
+ void devsym_unregister(void);
+
+ if( objc!=1 ){
+ Tcl_WrongNumArgs(interp, 1, objv, "");
+ return TCL_ERROR;
+ }
+
+ devsym_unregister();
+ return TCL_OK;
}
/*
** tclcmd: register_jt_vfs ?-default? PARENT-VFS
*/
-static int jtObjCmd(
+static int SQLITE_TCLAPI jtObjCmd(
void * clientData,
Tcl_Interp *interp,
int objc,
@@ -983,7 +1035,7 @@ static int jtObjCmd(
/*
** tclcmd: unregister_jt_vfs
*/
-static int jtUnregisterObjCmd(
+static int SQLITE_TCLAPI jtUnregisterObjCmd(
void * clientData,
Tcl_Interp *interp,
int objc,
@@ -1009,7 +1061,9 @@ int Sqlitetest6_Init(Tcl_Interp *interp){
#ifndef SQLITE_OMIT_DISKIO
Tcl_CreateObjCommand(interp, "sqlite3_crash_enable", crashEnableCmd, 0, 0);
Tcl_CreateObjCommand(interp, "sqlite3_crashparams", crashParamsObjCmd, 0, 0);
+ Tcl_CreateObjCommand(interp, "sqlite3_crash_now", crashNowCmd, 0, 0);
Tcl_CreateObjCommand(interp, "sqlite3_simulate_device", devSymObjCmd, 0, 0);
+ Tcl_CreateObjCommand(interp, "unregister_devsim", dsUnregisterObjCmd, 0, 0);
Tcl_CreateObjCommand(interp, "register_jt_vfs", jtObjCmd, 0, 0);
Tcl_CreateObjCommand(interp, "unregister_jt_vfs", jtUnregisterObjCmd, 0, 0);
#endif
« no previous file with comments | « third_party/sqlite/src/src/test5.c ('k') | third_party/sqlite/src/src/test7.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698