Modify logging code in test_osinst.c. No changes to production code. (CVS 5120)
FossilOrigin-Name: 85c54a16c7aecea3e0e5040ee8aca06d8b6a2b2b
This commit is contained in:
parent
f19dfc4e0a
commit
27467047e9
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Use\sshort\stimeout\sfor\slocking\soperations\sby\sdefault\sto\sbe\smore\sin\ssync\swith\sthe\sother\splatforms.\s(CVS\s5119)
|
||||
D 2008-05-12T00:32:09
|
||||
C Modify\slogging\scode\sin\stest_osinst.c.\sNo\schanges\sto\sproduction\scode.\s(CVS\s5120)
|
||||
D 2008-05-12T07:42:20
|
||||
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
|
||||
F Makefile.in 8b9b8263852f0217157f9042b8e3dae7427ec739
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -156,7 +156,7 @@ F src/test_loadext.c 22065d601a18878e5542191001f0eaa5d77c0ed8
|
||||
F src/test_malloc.c c92a65e8f9b31bb2b332448d92d2016c000a963d
|
||||
F src/test_md5.c bca40b727c57462ddb415e57c5323445a1bb1a40
|
||||
F src/test_onefile.c 2fea6d22f13f5f286356c80c77ffd41f995f2b7a
|
||||
F src/test_osinst.c f84ac00d61145af1be287754c153d04048b67888
|
||||
F src/test_osinst.c 32b97dea6401b32354ce120873dd2cef80ff368a
|
||||
F src/test_schema.c e3f93725f7c5b2cff84a69dc4332040dfbc8f81a
|
||||
F src/test_server.c a6ece6c835e7eae835054124e09e947e422b1ac5
|
||||
F src/test_tclvar.c b2d1115e4d489179d3f029e765211b2ad527ba59
|
||||
@ -326,7 +326,7 @@ F test/in.test 763a29007a4850d611ac4441bfa488fb9969ad30
|
||||
F test/in2.test b1f447f4f0f67e9f83ff931e7e2e30873f9ea055
|
||||
F test/in3.test dc62b080ed79898121c61c91118b4d1e111f1438
|
||||
F test/incrblob.test 4455fffd08b2f9418a9257e18b135d72273eff3e
|
||||
F test/incrblob_err.test 5273097dc7c97f9b7008423a6ffd5c80d21923cb
|
||||
F test/incrblob_err.test 00a8bcb25cb493d53f4efed0f5cf09c386534940
|
||||
F test/incrvacuum.test 1a2b0bddc76629afeb41e3d8ea3e4563982d16b9
|
||||
F test/incrvacuum2.test 46ef65f377e3937cfd1ba66e818309dab46f590d
|
||||
F test/incrvacuum_ioerr.test ebc94092ac1545d9ce518a673988aef88197ca4e
|
||||
@ -458,7 +458,7 @@ F test/tableapi.test 791f7e3891d9b70bdb43b311694bf5e9befcbc34
|
||||
F test/tclsqlite.test 3dfb48f46de4353376fad835390b493ba066b4dc
|
||||
F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1
|
||||
F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125
|
||||
F test/tester.tcl e4d3e8295a23deb5b5f35a4d79c93c9f2b5b87de
|
||||
F test/tester.tcl 39997d1f45f7df7b4708b31e319beda937d2746f
|
||||
F test/thread001.test 8fbd9559da0bbdc273e00318c7fd66c162020af7
|
||||
F test/thread002.test 2c4ad2c386f60f6fe268cd91c769ee35b3c1fd0b
|
||||
F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
|
||||
@ -634,7 +634,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P 3eff0ef2cfe70389bc80a270902702206be178f3
|
||||
R b1a6d9dd6c243fc481c507726cbfc5f5
|
||||
U pweilbacher
|
||||
Z bbb6661c7d1c5df1872673db954da30a
|
||||
P d00a015dbcc5a7fc4aa7cb41f9740a712af510ae
|
||||
R 4a6ee907ca9c22b7d594b8e9b8315e1b
|
||||
U danielk1977
|
||||
Z 743f5f254fe0a69c211a56ed51e765c8
|
||||
|
@ -1 +1 @@
|
||||
d00a015dbcc5a7fc4aa7cb41f9740a712af510ae
|
||||
85c54a16c7aecea3e0e5040ee8aca06d8b6a2b2b
|
@ -181,7 +181,7 @@ static int instRandomness(sqlite3_vfs*, int nByte, char *zOut);
|
||||
static int instSleep(sqlite3_vfs*, int microseconds);
|
||||
static int instCurrentTime(sqlite3_vfs*, double*);
|
||||
|
||||
static void binarylog_blob(sqlite3_vfs *, const char *, int);
|
||||
static void binarylog_blob(sqlite3_vfs *, const char *, int, int);
|
||||
|
||||
static sqlite3_vfs inst_vfs = {
|
||||
1, /* iVersion */
|
||||
@ -284,7 +284,10 @@ static int instRead(
|
||||
int iAmt,
|
||||
sqlite_int64 iOfst
|
||||
){
|
||||
OS_TIME_IO(OS_READ, iAmt, iOfst, p->pReal->pMethods->xRead(p->pReal, zBuf, iAmt, iOfst));
|
||||
sqlite3_vfs *pVfs = (sqlite3_vfs *)(((inst_file *)pFile)->pInstVfs);
|
||||
OS_TIME_IO(OS_READ, iAmt, (binarylog_blob(pVfs, zBuf, iAmt, 1), iOfst),
|
||||
p->pReal->pMethods->xRead(p->pReal, zBuf, iAmt, iOfst)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -296,7 +299,11 @@ static int instWrite(
|
||||
int iAmt,
|
||||
sqlite_int64 iOfst
|
||||
){
|
||||
OS_TIME_IO(OS_WRITE, iAmt, iOfst, p->pReal->pMethods->xWrite(p->pReal, z, iAmt, iOfst));
|
||||
sqlite3_vfs *pVfs = (sqlite3_vfs *)(((inst_file *)pFile)->pInstVfs);
|
||||
binarylog_blob(pVfs, z, iAmt, 1);
|
||||
OS_TIME_IO(OS_WRITE, iAmt, iOfst,
|
||||
p->pReal->pMethods->xWrite(p->pReal, z, iAmt, iOfst)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -384,7 +391,7 @@ static int instOpen(
|
||||
p->flags = flags;
|
||||
p->iFileId = ++p->pInstVfs->iNextFileId;
|
||||
|
||||
binarylog_blob(pVfs, zName, -1);
|
||||
binarylog_blob(pVfs, zName, -1, 0);
|
||||
OS_TIME_VFS(OS_OPEN, zName, flags, p->iFileId, 0,
|
||||
REALVFS(pVfs)->xOpen(REALVFS(pVfs), zName, p->pReal, flags, pOutFlags)
|
||||
);
|
||||
@ -396,7 +403,7 @@ static int instOpen(
|
||||
** returning.
|
||||
*/
|
||||
static int instDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
|
||||
binarylog_blob(pVfs, zPath, -1);
|
||||
binarylog_blob(pVfs, zPath, -1, 0);
|
||||
OS_TIME_VFS(OS_DELETE, zPath, 0, dirSync, 0,
|
||||
REALVFS(pVfs)->xDelete(REALVFS(pVfs), zPath, dirSync)
|
||||
);
|
||||
@ -407,7 +414,7 @@ static int instDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
|
||||
** is available, or false otherwise.
|
||||
*/
|
||||
static int instAccess(sqlite3_vfs *pVfs, const char *zPath, int flags){
|
||||
binarylog_blob(pVfs, zPath, -1);
|
||||
binarylog_blob(pVfs, zPath, -1, 0);
|
||||
OS_TIME_VFS(OS_ACCESS, zPath, 0, flags, 0,
|
||||
REALVFS(pVfs)->xAccess(REALVFS(pVfs), zPath, flags)
|
||||
);
|
||||
@ -616,12 +623,13 @@ void sqlite3_instvfs_get(
|
||||
*pnCall = p->aCount[eEvent];
|
||||
}
|
||||
|
||||
#define BINARYLOG_BUFFERSIZE 1024
|
||||
#define BINARYLOG_BUFFERSIZE 8192
|
||||
|
||||
struct InstVfsBinaryLog {
|
||||
int nBuf;
|
||||
char *zBuf;
|
||||
sqlite3_int64 iOffset;
|
||||
int log_data;
|
||||
sqlite3_file *pOut;
|
||||
char *zOut; /* Log file name */
|
||||
};
|
||||
@ -707,33 +715,37 @@ static void binarylog_xdel(void *p){
|
||||
static void binarylog_blob(
|
||||
sqlite3_vfs *pVfs,
|
||||
const char *zBlob,
|
||||
int nBlob
|
||||
int nBlob,
|
||||
int isBinary
|
||||
){
|
||||
unsigned char *zRec;
|
||||
int nWrite;
|
||||
InstVfs *pInstVfs = (InstVfs *)pVfs;
|
||||
InstVfsBinaryLog *pLog;
|
||||
InstVfs *pInstVfs = (InstVfs *)pVfs;
|
||||
|
||||
if( pVfs->xOpen!=instOpen || pInstVfs->xCall!=binarylog_xcall ){
|
||||
return;
|
||||
}
|
||||
|
||||
pLog = (InstVfsBinaryLog *)pInstVfs->pClient;
|
||||
if( nBlob<0 ){
|
||||
nBlob = strlen(zBlob);
|
||||
}
|
||||
nWrite = nBlob + 28;
|
||||
if( !isBinary || pLog->log_data ){
|
||||
unsigned char *zRec;
|
||||
int nWrite;
|
||||
|
||||
if( (nWrite+pLog->nBuf)>BINARYLOG_BUFFERSIZE ){
|
||||
binarylog_flush(pLog);
|
||||
if( nBlob<0 ){
|
||||
nBlob = strlen(zBlob);
|
||||
}
|
||||
nWrite = nBlob + 28;
|
||||
|
||||
if( (nWrite+pLog->nBuf)>BINARYLOG_BUFFERSIZE ){
|
||||
binarylog_flush(pLog);
|
||||
}
|
||||
|
||||
zRec = (unsigned char *)&pLog->zBuf[pLog->nBuf];
|
||||
memset(zRec, 0, nWrite);
|
||||
put32bits(&zRec[0], BINARYLOG_STRING);
|
||||
put32bits(&zRec[4], (int)nBlob);
|
||||
put32bits(&zRec[8], (int)isBinary);
|
||||
memcpy(&zRec[28], zBlob, nBlob);
|
||||
pLog->nBuf += nWrite;
|
||||
}
|
||||
|
||||
zRec = (unsigned char *)&pLog->zBuf[pLog->nBuf];
|
||||
memset(zRec, 0, nWrite);
|
||||
put32bits(&zRec[0], BINARYLOG_STRING);
|
||||
put32bits(&zRec[4], (int)nBlob);
|
||||
memcpy(&zRec[28], zBlob, nBlob);
|
||||
pLog->nBuf += nWrite;
|
||||
}
|
||||
|
||||
void sqlite3_instvfs_binarylog_marker(
|
||||
@ -742,14 +754,15 @@ void sqlite3_instvfs_binarylog_marker(
|
||||
){
|
||||
InstVfs *pInstVfs = (InstVfs *)pVfs;
|
||||
InstVfsBinaryLog *pLog = (InstVfsBinaryLog *)pInstVfs->pClient;
|
||||
binarylog_blob(pVfs, zMarker, -1);
|
||||
binarylog_blob(pVfs, zMarker, -1, 0);
|
||||
binarylog_xcall(pLog, BINARYLOG_MARKER, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
sqlite3_vfs *sqlite3_instvfs_binarylog(
|
||||
const char *zVfs,
|
||||
const char *zParentVfs,
|
||||
const char *zLog
|
||||
const char *zLog,
|
||||
int log_data
|
||||
){
|
||||
InstVfsBinaryLog *p;
|
||||
sqlite3_vfs *pVfs;
|
||||
@ -769,6 +782,7 @@ sqlite3_vfs *sqlite3_instvfs_binarylog(
|
||||
p->zBuf = sqlite3_malloc(BINARYLOG_BUFFERSIZE);
|
||||
p->zOut = (char *)&p[1];
|
||||
p->pOut = (sqlite3_file *)sqlite3_malloc(pParent->szOsFile);
|
||||
p->log_data = log_data;
|
||||
pParent->xFullPathname(pParent, zLog, pParent->mxPathname, p->zOut);
|
||||
flags = SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_MASTER_JOURNAL;
|
||||
pParent->xDelete(pParent, p->zOut, 0);
|
||||
@ -891,28 +905,33 @@ static int test_sqlite3_instvfs(
|
||||
char *zParent = 0;
|
||||
sqlite3_vfs *p;
|
||||
int isDefault = 0;
|
||||
int isLogdata = 0;
|
||||
int argbase = 2;
|
||||
|
||||
if( objc>2 && 0==strcmp("-default", Tcl_GetString(objv[argbase])) ){
|
||||
isDefault = 1;
|
||||
argbase++;
|
||||
}
|
||||
if( objc>(argbase+1)
|
||||
&& 0==strcmp("-parent", Tcl_GetString(objv[argbase]))
|
||||
){
|
||||
zParent = Tcl_GetString(objv[argbase+1]);
|
||||
argbase += 2;
|
||||
for(argbase=2; argbase<(objc-2); argbase++){
|
||||
if( 0==strcmp("-default", Tcl_GetString(objv[argbase])) ){
|
||||
isDefault = 1;
|
||||
}
|
||||
else if( 0==strcmp("-parent", Tcl_GetString(objv[argbase])) ){
|
||||
argbase++;
|
||||
zParent = Tcl_GetString(objv[argbase]);
|
||||
}
|
||||
else if( 0==strcmp("-logdata", Tcl_GetString(objv[argbase])) ){
|
||||
isLogdata = 1;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( (objc-argbase)!=2 ){
|
||||
Tcl_WrongNumArgs(
|
||||
interp, 2, objv, "?-default? ?-parent VFS? NAME LOGFILE"
|
||||
interp, 2, objv, "?-default? ?-parent VFS? ?-logdata? NAME LOGFILE"
|
||||
);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
zName = Tcl_GetString(objv[argbase]);
|
||||
zLog = Tcl_GetString(objv[argbase+1]);
|
||||
p = sqlite3_instvfs_binarylog(zName, zParent, zLog);
|
||||
p = sqlite3_instvfs_binarylog(zName, zParent, zLog, isLogdata);
|
||||
if( !p ){
|
||||
Tcl_AppendResult(interp, "error creating vfs ", 0);
|
||||
return TCL_ERROR;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# $Id: incrblob_err.test,v 1.8 2007/09/12 17:01:45 danielk1977 Exp $
|
||||
# $Id: incrblob_err.test,v 1.9 2008/05/12 07:42:20 danielk1977 Exp $
|
||||
#
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
@ -72,6 +72,7 @@ do_malloc_test 3 -tclprep {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
do_ioerr_test incrblob_err-4 -cksum 1 -sqlprep {
|
||||
CREATE TABLE blobs(k, v BLOB);
|
||||
INSERT INTO blobs VALUES(1, $::data);
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This file implements some common TCL routines used for regression
|
||||
# testing the SQLite library
|
||||
#
|
||||
# $Id: tester.tcl,v 1.121 2008/05/08 16:51:12 danielk1977 Exp $
|
||||
# $Id: tester.tcl,v 1.122 2008/05/12 07:42:20 danielk1977 Exp $
|
||||
|
||||
#
|
||||
# What for user input before continuing. This gives an opportunity
|
||||
@ -73,7 +73,7 @@ for {set i 0} {$i<[llength $argv]} {incr i} {
|
||||
|
||||
|
||||
proc ostrace_call {zCall nClick zFile i32 i64} {
|
||||
set s "INSERT INTO ostrace VALUES( '$zCall', $nClick, '$zFile', $i32, $i64);"
|
||||
set s "INSERT INTO ostrace VALUES('$zCall', $nClick, '$zFile', $i32, $i64);"
|
||||
puts $::ostrace_fd $s
|
||||
}
|
||||
|
||||
@ -94,8 +94,12 @@ for {set i 0} {$i<[llength $argv]} {incr i} {
|
||||
}
|
||||
if {[lindex $argv $i] eq "--binarylog"} {
|
||||
set tester_do_binarylog 1
|
||||
|
||||
# sqlite3_simulate_device -char safe_append
|
||||
# sqlite3_instvfs binarylog -default -parent devsym binarylog ostrace.bin
|
||||
sqlite3_instvfs binarylog -default binarylog ostrace.bin
|
||||
set argv [lreplace $argv $i $i]
|
||||
sqlite3_instvfs marker binarylog "$argv0 $argv"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user