speedtest1: use the current (or default) vfs->xDelete method to unlink the db. This is specifically necessary when running the opfs vfs in a wasm build of speedtest1. This worked without this fix until recently because the affected test code was performing similar acrobatics in its stead.
FossilOrigin-Name: d3c830bd37a402161b486d3631feceae5d00f89c2522aed65fcd2e666bd64238
This commit is contained in:
+14
-1
@@ -2423,7 +2423,6 @@ int main(int argc, char **argv){
|
||||
}
|
||||
}
|
||||
#undef ARGC_VALUE_CHECK
|
||||
if( zDbName!=0 ) unlink(zDbName);
|
||||
#if SQLITE_VERSION_NUMBER>=3006001
|
||||
if( nHeap>0 ){
|
||||
pHeap = malloc( nHeap );
|
||||
@@ -2446,6 +2445,20 @@ int main(int argc, char **argv){
|
||||
#endif
|
||||
sqlite3_initialize();
|
||||
|
||||
if( zDbName!=0 ){
|
||||
sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs);
|
||||
/* For some VFSes, e.g. opfs, unlink() is not sufficient. Use the
|
||||
** selected (or default) VFS's xDelete method to delete the
|
||||
** database. This is specifically important for the "opfs" VFS
|
||||
** when running from a WASM build of speedtest1, so that the db
|
||||
** can be cleaned up properly. For historical compatibility, we'll
|
||||
** also simply unlink(). */
|
||||
if( pVfs!=0 ){
|
||||
pVfs->xDelete(pVfs, zDbName, 1);
|
||||
}
|
||||
unlink(zDbName);
|
||||
}
|
||||
|
||||
/* Open the database and the input file */
|
||||
if( sqlite3_open_v2(memDb ? ":memory:" : zDbName, &g.db,
|
||||
openFlags, zVfs) ){
|
||||
|
||||
Reference in New Issue
Block a user