Add the "atomic-batch-write" permutation to permutations.test. This

permutation fails if not run on a file-system that supports
atomic-batch-writes.

FossilOrigin-Name: 9f1b83fae9c973eee80eefefe7bd3a1eb7bba8af4cd919d7a2ce911900dd9087
This commit is contained in:
dan 2017-07-22 16:58:47 +00:00
parent 2df9478f5f
commit 4da30f8888
7 changed files with 103 additions and 33 deletions

View File

@ -1,5 +1,5 @@
C Keep\sbatch-atomic-writes\sturned\son\sfor\sjournal_mode=MEMORY,\sbut\sturn\sthem\noff\sfor\ssynchronous=OFF.\s\sRefuse\sto\scompile\swith\sboth\sSQLITE_MMAP_READWRITE\nand\sSQLITE_ENABLE_BATCH_ATOMIC_WRITE.\s\sFix\sup\ssome\scomments\sin\sthe\scommit\nlogic.
D 2017-07-22T16:32:33.230
C Add\sthe\s"atomic-batch-write"\spermutation\sto\spermutations.test.\sThis\npermutation\sfails\sif\snot\srun\son\sa\sfile-system\sthat\ssupports\natomic-batch-writes.
D 2017-07-22T16:58:47.336
F Makefile.in d9873c9925917cca9990ee24be17eb9613a668012c85a343aef7e5536ae266e8
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 02b469e9dcd5b7ee63fc1fb05babc174260ee4cfa4e0ef2e48c3c6801567a016
@ -463,7 +463,7 @@ F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6
F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
F src/tclsqlite.c 2c29b0b76e91edfd1b43bf135c32c8674710089197327682b6b7e6af88062c3d
F src/test1.c cfb78b728b37ae3a2b14fe1b3a6c766e0da41370eda112594e698c94011b622e
F src/test1.c 8513b17ca4a7a9ba28748535d178b6e472ec7394ae0eea53907f2d3bcdbab2df
F src/test2.c 3efb99ab7f1fc8d154933e02ae1378bac9637da5
F src/test3.c b8434949dfb8aff8dfa082c8b592109e77844c2135ed3c492113839b6956255b
F src/test4.c 18ec393bb4d0ad1de729f0b94da7267270f3d8e6
@ -754,7 +754,7 @@ F test/exists.test 79a75323c78f02bbe9c251ea502a092f9ef63dac
F test/expr.test 66a2c9ac34f74f036faa4092f5402c7d3162fc93
F test/extension01.test 00d13cec817f331a687a243e0e5a2d87b0e358c9
F test/extraquick.test cb254400bd42bfb777ff675356aabf3287978f79
F test/fallocate.test 3e979af17dfa7e5e9dda5eba1a696c04fa9d47f7
F test/fallocate.test 87b5e43c872b7e69cd80b7b8813eb102b571a75d45dda24e38b65537bcc85733
F test/filectrl.test 6e871c2d35dead1d9a88e176e8d2ca094fec6bb3
F test/filefmt.test f393e80c4b8d493b7a7f8f3809a8425bbf4292af1f5140f01cb1427798a2bbd4
F test/fkey1.test ba64806ff9a04eecab2679caad377ae99a5e94e4
@ -1029,7 +1029,7 @@ F test/minmax.test 6751e87b409fe11b02e70a306d846fa544e25a41
F test/minmax2.test b44bae787fc7b227597b01b0ca5575c7cb54d3bc
F test/minmax3.test cc1e8b010136db0d01a6f2a29ba5a9f321034354
F test/minmax4.test 936941484ebdceb8adec7c86b6cd9b6e5e897c1f
F test/misc1.test 6430dabfb4b4fa480633590118964201f94d3ccc
F test/misc1.test 51ec3f56a2a7965de226964cff856695e743186826561536647f1e8b7d1d0eb3
F test/misc2.test 00d7de54eda90e237fc9a38b9e5ccc769ebf6d4d
F test/misc3.test cf3dda47d5dda3e53fc5804a100d3c82be736c9d
F test/misc4.test 0d8be3466adf123a7791a66ba2bc8e8d229e87f3
@ -1087,7 +1087,7 @@ F test/parser1.test 391b9bf9a229547a129c61ac345ed1a6f5eb1854
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test 5e2e5439642898e0947ced066ad09b82bd817ddfb83dc71291b4c957efc84b62
F test/permutations.test 3b94f8fd431d39fac4952eb5dc38e1bb2b4518e1ac967d66f5abc815c104aeb6
F test/pragma.test f274259d6393b6681eb433beb8dd39a26ec06a4431052a4880b43b84912a3f58
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
F test/pragma3.test 14c12bc5352b1e100e0b6b44f371053a81ccf8ed
@ -1113,7 +1113,7 @@ F test/regexp2.test 40e894223b3d6672655481493f1be12012f2b33c
F test/reindex.test 44edd3966b474468b823d481eafef0c305022254
F test/releasetest.tcl 7bb585433ce7fb2a2c255ae4b5e24f1bc27fe177ec1120f886cc4852f48f5ee9 x
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/rollback.test 458fe73eb3ffdfdf9f6ba3e9b7350a6220414dea
F test/rollback.test f580934279800d480a19176c6b44909df31ce7ad45267ea475a541daa522f3d3
F test/rollback2.test 8435d6ff0f13f51d2a4181c232e706005fa90fc5
F test/rollbackfault.test 0e646aeab8840c399cfbfa43daab46fd609cf04a
F test/rowallock.test 3f88ec6819489d0b2341c7a7528ae17c053ab7cc
@ -1637,7 +1637,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P a89b62c4966cd297326e8712da40e0962d2328d7ba1f201d5abcec911eeef347
R 88801a01fa2ca8fc5930da1c8e878132
U drh
Z dd2162169e6c906aa4638965a08ee342
P 2e80e19e4faac30947ed56aa3601c45c758cafb27f84780df255fdbcdc9a6999
R f3cc9474e40dfdafd1378160ccb50876
U dan
Z e9e3d5840c0aa48b88a9ce806cb1e69e

View File

@ -1 +1 @@
2e80e19e4faac30947ed56aa3601c45c758cafb27f84780df255fdbcdc9a6999
9f1b83fae9c973eee80eefefe7bd3a1eb7bba8af4cd919d7a2ce911900dd9087

View File

@ -2553,6 +2553,46 @@ static int SQLITE_TCLAPI test_delete_database(
return TCL_OK;
}
/*
** Usage: atomic_batch_write PATH
*/
static int SQLITE_TCLAPI test_atomic_batch_write(
void * clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *CONST objv[]
){
char *zFile = 0; /* Path to file to test */
sqlite3 *db = 0; /* Database handle */
sqlite3_file *pFd = 0; /* SQLite fd open on zFile */
int bRes = 0; /* Integer result of this command */
int dc = 0; /* Device-characteristics mask */
int rc; /* sqlite3_open() return code */
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "PATH");
return TCL_ERROR;
}
zFile = Tcl_GetString(objv[1]);
rc = sqlite3_open(zFile, &db);
if( rc!=SQLITE_OK ){
Tcl_AppendResult(interp, sqlite3_errmsg(db), 0);
sqlite3_close(db);
return TCL_ERROR;
}
rc = sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, (void*)&pFd);
dc = pFd->pMethods->xDeviceCharacteristics(pFd);
if( dc & SQLITE_IOCAP_BATCH_ATOMIC ){
bRes = 1;
}
Tcl_SetObjResult(interp, Tcl_NewIntObj(bRes));
sqlite3_close(db);
return TCL_OK;
}
/*
** Usage: sqlite3_next_stmt DB STMT
**
@ -7645,6 +7685,7 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite3_snapshot_cmp_blob", test_snapshot_cmp_blob, 0 },
#endif
{ "sqlite3_delete_database", test_delete_database, 0 },
{ "atomic_batch_write", test_atomic_batch_write, 0 },
};
static int bitmask_size = sizeof(Bitmask)*8;
static int longdouble_size = sizeof(LONGDOUBLE_TYPE);

View File

@ -59,7 +59,9 @@ do_test fallocate-1.6 {
#
do_test fallocate-1.7 {
execsql { BEGIN; INSERT INTO t1 VALUES(1, 2); }
if {[permutation] != "inmemory_journal"} {
if {[permutation] != "inmemory_journal"
&& [permutation] != "atomic-batch-write"
} {
hexio_get_int [hexio_read test.db-journal 16 4]
} else {
set {} 1024

View File

@ -479,26 +479,28 @@ ifcapable curdir {
# Make sure a database connection still works after changing the
# working directory.
#
do_test misc1-14.1 {
file mkdir tempdir
cd tempdir
execsql {BEGIN}
file exists ./test.db-journal
} {0}
do_test misc1-14.2a {
execsql {UPDATE t1 SET a=a||'x' WHERE 0}
file exists ../test.db-journal
} {0}
do_test misc1-14.2b {
execsql {UPDATE t1 SET a=a||'y' WHERE 1}
file exists ../test.db-journal
} {1}
do_test misc1-14.3 {
cd ..
forcedelete tempdir
execsql {COMMIT}
file exists ./test.db-journal
} {0}
if {[atomic_batch_write test.db]==0} {
do_test misc1-14.1 {
file mkdir tempdir
cd tempdir
execsql {BEGIN}
file exists ./test.db-journal
} {0}
do_test misc1-14.2a {
execsql {UPDATE t1 SET a=a||'x' WHERE 0}
file exists ../test.db-journal
} {0}
do_test misc1-14.2b {
execsql {UPDATE t1 SET a=a||'y' WHERE 1}
file exists ../test.db-journal
} {1}
do_test misc1-14.3 {
cd ..
forcedelete tempdir
execsql {COMMIT}
file exists ./test.db-journal
} {0}
}
}
# A failed create table should not leave the table in the internal

View File

@ -389,6 +389,30 @@ test_suite "vfslog" -prefix "" -description {
wal* mmap*
]
test_suite "atomic-batch-write" -prefix "" -description {
Like veryquick.test, but must be run on a file-system that supports
atomic-batch-writes. Tests that depend on the journal file being present
are omitted.
} -files [
test_set $allquicktests -exclude *malloc* *ioerr* *fault* *bigfile* *_err* \
*fts5corrupt* *fts5big* *fts5aj* \
crash8.test delete_db.test \
exclusive.test journal3.test \
journal1.test \
jrnlmode.test jrnlmode2.test \
lock4.test pager1.test \
pager3.test sharedA.test \
symlink.test stmt.test \
sync.test sync2.test \
tempdb.test tkt3457.test \
vacuum5.test wal2.test \
walmode.test zerodamage.test
] -initialize {
if {[atomic_batch_write test.db]==0} {
error "File system does NOT support atomic-batch-write"
}
}
lappend ::testsuitelist xxx
#-------------------------------------------------------------------------
# Define the coverage related test suites:

View File

@ -82,6 +82,7 @@ do_test rollback-1.9 {
if {$tcl_platform(platform) == "unix"
&& [permutation] ne "onefile"
&& [permutation] ne "inmemory_journal"
&& [permutation] ne "atomic-batch-write"
} {
do_test rollback-2.1 {
execsql {