Resolve missing kvvfs JS test: sqlite3_initialize() must be called by the client in this build. Add basic sanity test of kvvfs using sessionStorage().

FossilOrigin-Name: 250a935aeb94d3fadec0d3fe22de85de4e658e2fdb3be3aa9a8bbc8f7b7d8414
This commit is contained in:
stephan 2022-09-12 13:05:54 +00:00
parent 6b013afb88
commit 2811759d5e
3 changed files with 44 additions and 12 deletions

View File

@ -36,10 +36,42 @@
log("Loaded module:",capi.sqlite3_libversion(), capi.sqlite3_sourceid()); log("Loaded module:",capi.sqlite3_libversion(), capi.sqlite3_sourceid());
log("Build options:",wasm.compileOptionUsed()); log("Build options:",wasm.compileOptionUsed());
self.S = sqlite3; self.S = sqlite3;
T.assert(0 === capi.sqlite3_vfs_find(null));
log("vfs(null) =",capi.sqlite3_vfs_find(null)) S.capi.sqlite3_initialize();
log("vfs('kvvfs') =",capi.sqlite3_vfs_find('kvvfs')) T.assert( Number.isFinite( capi.sqlite3_vfs_find(null) ) );
//const db = new oo.DB("session"); const stores = {
local: localStorage,
session: sessionStorage
};
const cleanupStore = function(n){
const s = stores[n];
const isKv = (key)=>key.startsWith('kvvfs-'+n);
let i, k, toRemove = [];
for( i = 0; (k = s.key(i)); ++i) {
if(isKv(k)) toRemove.push(k);
}
toRemove.forEach((k)=>s.removeItem(k));
};
const dbStorage = 1 ? 'session' : 'local';
const db = new oo.DB(dbStorage);
try {
db.exec("create table if not exists t(a)");
if(undefined===db.selectValue("select a from t limit 1")){
log("New db. Populating..");
db.exec("insert into t(a) values(1),(2),(3)");
}else{
log("Found existing table data:");
db.exec({
sql: "select * from t order by a",
rowMode: 0,
callback: function(v){log(v)}
});
}
}finally{
const n = db.filename;
db.close();
//cleanupStore(n);
}
log("Init done. Proceed from the dev console."); log("Init done. Proceed from the dev console.");
}; };

View File

@ -1,5 +1,5 @@
C Fix\sthe\samalgamation\sso\sthat\sit\sbuilds\swith\sthe\sstandard\sunix\sbackend\sagain. C Resolve\smissing\skvvfs\sJS\stest:\ssqlite3_initialize()\smust\sbe\scalled\sby\sthe\sclient\sin\sthis\sbuild.\sAdd\sbasic\ssanity\stest\sof\skvvfs\susing\ssessionStorage().
D 2022-09-12T12:41:07.918 D 2022-09-12T13:05:54.108
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -504,7 +504,7 @@ F ext/wasm/jaccwabyt/jaccwabyt_test.c 39e4b865a33548f943e2eb9dd0dc8d619a80de05d5
F ext/wasm/jaccwabyt/jaccwabyt_test.exports 5ff001ef975c426ffe88d7d8a6e96ec725e568d2c2307c416902059339c06f19 F ext/wasm/jaccwabyt/jaccwabyt_test.exports 5ff001ef975c426ffe88d7d8a6e96ec725e568d2c2307c416902059339c06f19
F ext/wasm/kvvfs.make 7cc9cf10e744c3ba523c3eaf5c4af47028f3a5bb76db304ea8044a9b2a9d496f F ext/wasm/kvvfs.make 7cc9cf10e744c3ba523c3eaf5c4af47028f3a5bb76db304ea8044a9b2a9d496f
F ext/wasm/kvvfs1.html 2acb241a6110a4ec581adbf07a23d5fc2ef9c7142aa9d60856732a102abc5016 F ext/wasm/kvvfs1.html 2acb241a6110a4ec581adbf07a23d5fc2ef9c7142aa9d60856732a102abc5016
F ext/wasm/kvvfs1.js 461d571234244bd682725f1dd73195b1d9a7eabdd57c0181ff41dc7c55252313 F ext/wasm/kvvfs1.js 46afaf4faba041bf938355627bc529854295e561f49db3a240c914e75a529338
F ext/wasm/testing1.html 0bf3ff224628c1f1e3ed22a2dc1837c6c73722ad8c0ad9c8e6fb9e6047667231 F ext/wasm/testing1.html 0bf3ff224628c1f1e3ed22a2dc1837c6c73722ad8c0ad9c8e6fb9e6047667231
F ext/wasm/testing1.js cba7134901a965743fa9289d82447ab71de4690b1ee5d06f6cb83e8b569d7943 F ext/wasm/testing1.js cba7134901a965743fa9289d82447ab71de4690b1ee5d06f6cb83e8b569d7943
F ext/wasm/testing2.html 73e5048e666fd6fb28b6e635677a9810e1e139c599ddcf28d687c982134b92b8 F ext/wasm/testing2.html 73e5048e666fd6fb28b6e635677a9810e1e139c599ddcf28d687c982134b92b8
@ -2004,8 +2004,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 1a2f24a0bdfc6eaae478916b8f4f9c6b63ead9964534fc2951fb4e995ffe61f1 P 0adf158f4e5791339988185cc29347c75056b062e0db65b5999fdfa1f433c1ed
R fe9e8080b230bfa064abaa9f8e686ee1 R 034fe3ea9e2b85698d729ef37913abeb
U drh U stephan
Z 78a6c00935086fa910a2a1532a85cf90 Z 428f2bf7fe12828b5f66501dd0945c6a
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
0adf158f4e5791339988185cc29347c75056b062e0db65b5999fdfa1f433c1ed 250a935aeb94d3fadec0d3fe22de85de4e658e2fdb3be3aa9a8bbc8f7b7d8414