1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Add some tests for the atomic-write optimization. (CVS 4275)

FossilOrigin-Name: e2cc7b4a3476a733b2701546f6b4ec9abc18152b
This commit is contained in:
danielk1977
2007-08-23 08:06:44 +00:00
parent aa9f112137
commit 2ca0f86354
6 changed files with 359 additions and 102 deletions

View File

@@ -58,13 +58,35 @@ int sqlite3OsBreakLock(sqlite3_file *id){
int sqlite3OsCheckReservedLock(sqlite3_file *id){
return id->pMethods->xCheckReservedLock(id);
}
int sqlite3OsSectorSize(sqlite3_file *id){
int (*xSectorSize)(sqlite3_file*) = id->pMethods->xSectorSize;
return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE);
}
int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
return id->pMethods->xDeviceCharacteristics(id);
}
#ifdef SQLITE_TEST
/* The following two variables are used to override the values returned
** by the xSectorSize() and xDeviceCharacteristics() vfs methods for
** testing purposes. They are usually set by a test command implemented
** in test6.c.
*/
int sqlite3_test_sector_size = 0;
int sqlite3_test_device_characteristics = 0;
int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
int dc = id->pMethods->xDeviceCharacteristics(id);
return dc | sqlite3_test_device_characteristics;
}
int sqlite3OsSectorSize(sqlite3_file *id){
if( sqlite3_test_sector_size==0 ){
int (*xSectorSize)(sqlite3_file*) = id->pMethods->xSectorSize;
return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE);
}
return sqlite3_test_sector_size;
}
#else
int sqlite3OsSectorSize(sqlite3_file *id){
int (*xSectorSize)(sqlite3_file*) = id->pMethods->xSectorSize;
return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE);
}
int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
return id->pMethods->xDeviceCharacteristics(id);
}
#endif
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
/* These methods are currently only used for testing and debugging. */