mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
Add kvvfs tests to tester1.js. Fix a scopedAlloc() misuse in oo1.DB ctor caused by refactoring earlier this morning (and caught by these new tests).
FossilOrigin-Name: 8e0f001ab76de6dbc17295b9085f7f61ce274c43f8c432ea4d2ec3153d248ff3
This commit is contained in:
@ -87,7 +87,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
|||||||
being-construct DB object as its "this". See the DB constructor
|
being-construct DB object as its "this". See the DB constructor
|
||||||
for the argument docs. This is split into a separate function
|
for the argument docs. This is split into a separate function
|
||||||
in order to enable simple creation of special-case DB constructors,
|
in order to enable simple creation of special-case DB constructors,
|
||||||
e.g. JsStorageDB and OpfsDb.
|
e.g. JsStorageDb and OpfsDb.
|
||||||
|
|
||||||
Expects to be passed a configuration object with the following
|
Expects to be passed a configuration object with the following
|
||||||
properties:
|
properties:
|
||||||
@ -152,10 +152,7 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
|||||||
const stack = wasm.pstack.pointer;
|
const stack = wasm.pstack.pointer;
|
||||||
try {
|
try {
|
||||||
const pPtr = wasm.pstack.allocPtr() /* output (sqlite3**) arg */;
|
const pPtr = wasm.pstack.allocPtr() /* output (sqlite3**) arg */;
|
||||||
const pVfsName = vfsName ? (
|
let rc = capi.sqlite3_open_v2(fn, pPtr, oflags, vfsName || 0);
|
||||||
('number'===typeof vfsName ? vfsName : wasm.scopedAllocCString(vfsName))
|
|
||||||
): 0;
|
|
||||||
let rc = capi.sqlite3_open_v2(fn, pPtr, oflags, pVfsName);
|
|
||||||
pDb = wasm.getPtrValue(pPtr);
|
pDb = wasm.getPtrValue(pPtr);
|
||||||
checkSqlite3Rc(pDb, rc);
|
checkSqlite3Rc(pDb, rc);
|
||||||
if(flagsStr.indexOf('t')>=0){
|
if(flagsStr.indexOf('t')>=0){
|
||||||
|
@ -40,7 +40,11 @@ span.labeled-input {
|
|||||||
.faded { opacity: 0.5; }
|
.faded { opacity: 0.5; }
|
||||||
.group-start { color: blue; }
|
.group-start { color: blue; }
|
||||||
.group-end { color: blue; }
|
.group-end { color: blue; }
|
||||||
.input-wrapper { white-space: nowrap; }
|
.input-wrapper {
|
||||||
|
white-space: nowrap;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
#test-output {
|
#test-output {
|
||||||
border: 1px inset;
|
border: 1px inset;
|
||||||
border-radius: 0.25em;
|
border-radius: 0.25em;
|
||||||
@ -54,3 +58,4 @@ span.labeled-input {
|
|||||||
#test-output.reverse {
|
#test-output.reverse {
|
||||||
flex-direction: column-reverse;
|
flex-direction: column-reverse;
|
||||||
}
|
}
|
||||||
|
label[for] { cursor: pointer }
|
||||||
|
@ -15,6 +15,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>sqlite3 WASM/JS tester #1 (Worker thread)</h1>
|
<h1>sqlite3 WASM/JS tester #1 (Worker thread)</h1>
|
||||||
|
<div>See <a href='tester1.html' target='tester1.html'>tester1.html</a>
|
||||||
|
for the UI-thread variant.</div>
|
||||||
|
<div class='input-wrapper'>
|
||||||
|
<input type='checkbox' id='cb-log-reverse' checked>
|
||||||
|
<label for='cb-log-reverse'>Reverse log order?</label>
|
||||||
|
</div>
|
||||||
<div id='test-output'></div>
|
<div id='test-output'></div>
|
||||||
<script>(function(){
|
<script>(function(){
|
||||||
const logTarget = document.querySelector('#test-output');
|
const logTarget = document.querySelector('#test-output');
|
||||||
@ -28,6 +34,12 @@
|
|||||||
ln.append(document.createTextNode(args.join(' ')));
|
ln.append(document.createTextNode(args.join(' ')));
|
||||||
logTarget.append(ln);
|
logTarget.append(ln);
|
||||||
};
|
};
|
||||||
|
const cbReverse = document.querySelector('#cb-log-reverse');
|
||||||
|
const cbReverseIt = ()=>{
|
||||||
|
logTarget.classList[cbReverse.checked ? 'add' : 'remove']('reverse');
|
||||||
|
};
|
||||||
|
cbReverse.addEventListener('change',cbReverseIt,true);
|
||||||
|
cbReverseIt();
|
||||||
const w = new Worker("tester1.js?sqlite3.dir=jswasm");
|
const w = new Worker("tester1.js?sqlite3.dir=jswasm");
|
||||||
w.onmessage = function({data}){
|
w.onmessage = function({data}){
|
||||||
switch(data.type){
|
switch(data.type){
|
||||||
|
@ -15,6 +15,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>sqlite3 WASM/JS tester #1 (UI thread)</h1>
|
<h1>sqlite3 WASM/JS tester #1 (UI thread)</h1>
|
||||||
|
<div>See <a href='tester1-worker.html' target='tester1-worker.html'>tester1-worker.html</a>
|
||||||
|
for the Worker-thread variant.</div>
|
||||||
|
<div class='input-wrapper'>
|
||||||
|
<input type='checkbox' id='cb-log-reverse' checked>
|
||||||
|
<label for='cb-log-reverse'>Reverse log order?</label>
|
||||||
|
</div>
|
||||||
<div id='test-output'></div>
|
<div id='test-output'></div>
|
||||||
<script src="jswasm/sqlite3.js"></script>
|
<script src="jswasm/sqlite3.js"></script>
|
||||||
<script src="tester1.js"></script>
|
<script src="tester1.js"></script>
|
||||||
|
@ -78,6 +78,17 @@
|
|||||||
ln.append(document.createTextNode(normalizeArgs(args).join(' ')));
|
ln.append(document.createTextNode(normalizeArgs(args).join(' ')));
|
||||||
logTarget.append(ln);
|
logTarget.append(ln);
|
||||||
};
|
};
|
||||||
|
const cbReverse = document.querySelector('#cb-log-reverse');
|
||||||
|
const cbReverseKey = 'tester1:cb-log-reverse';
|
||||||
|
const cbReverseIt = ()=>{
|
||||||
|
logTarget.classList[cbReverse.checked ? 'add' : 'remove']('reverse');
|
||||||
|
localStorage.setItem(cbReverseKey, cbReverse.checked ? 1 : 0);
|
||||||
|
};
|
||||||
|
cbReverse.addEventListener('change',cbReverseIt,true);
|
||||||
|
if(localStorage.getItem(cbReverseKey)){
|
||||||
|
cbReverse.checked = !!(+localStorage.getItem(cbReverseKey));
|
||||||
|
}
|
||||||
|
cbReverseIt();
|
||||||
}else{ /* Worker thread */
|
}else{ /* Worker thread */
|
||||||
console.log("Running in a Worker thread.");
|
console.log("Running in a Worker thread.");
|
||||||
logClass = function(cssClass,...args){
|
logClass = function(cssClass,...args){
|
||||||
@ -227,9 +238,9 @@
|
|||||||
const assertCount = TestUtil.counter;
|
const assertCount = TestUtil.counter;
|
||||||
const groupState = Object.create(null);
|
const groupState = Object.create(null);
|
||||||
const skipped = [];
|
const skipped = [];
|
||||||
let runtime = 0;
|
let runtime = 0, i = 0;
|
||||||
for(let i in this.tests){
|
for(const t of this.tests){
|
||||||
const t = this.tests[i];
|
++i;
|
||||||
const n = this.number+"."+i;
|
const n = this.number+"."+i;
|
||||||
log(indent, n+":", t.name);
|
log(indent, n+":", t.name);
|
||||||
if(t.predicate && !t.predicate(sqlite3)){
|
if(t.predicate && !t.predicate(sqlite3)){
|
||||||
@ -1578,13 +1589,50 @@
|
|||||||
})
|
})
|
||||||
;/* end of oo1 checks */
|
;/* end of oo1 checks */
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
T.g('kvvfs (Worker thread only)', isWorker)
|
||||||
|
.t({
|
||||||
|
name: 'kvvfs is disabled',
|
||||||
|
test: ()=>{
|
||||||
|
T.assert(
|
||||||
|
!capi.sqlite3_vfs_find('kvvfs'),
|
||||||
|
"Expecting kvvfs to be unregistered."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
T.g('kvvfs (UI thread only)', isUIThread)
|
||||||
|
.t({
|
||||||
|
name: 'kvvfs sanity checks',
|
||||||
|
test: function(sqlite3){
|
||||||
|
const filename = 'session';
|
||||||
|
const pVfs = capi.sqlite3_vfs_find('kvvfs');
|
||||||
|
T.assert(pVfs);
|
||||||
|
const JDb = sqlite3.oo1.JsStorageDb;
|
||||||
|
const unlink = ()=>JDb.clearStorage(filename);
|
||||||
|
unlink();
|
||||||
|
let db = new JDb(filename);
|
||||||
|
db.exec([
|
||||||
|
'create table kvvfs(a);',
|
||||||
|
'insert into kvvfs(a) values(1),(2),(3)'
|
||||||
|
]);
|
||||||
|
T.assert(3 === db.selectValue('select count(*) from kvvfs'));
|
||||||
|
db.close();
|
||||||
|
db = new JDb(filename);
|
||||||
|
db.exec('insert into kvvfs(a) values(4),(5),(6)');
|
||||||
|
T.assert(6 === db.selectValue('select count(*) from kvvfs'));
|
||||||
|
db.close();
|
||||||
|
unlink();
|
||||||
|
}
|
||||||
|
}/*kvvfs sanity checks*/)
|
||||||
|
;/* end kvvfs tests */
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
T.g('OPFS (Worker thread only and only in supported browsers)',
|
T.g('OPFS (Worker thread only and only in supported browsers)',
|
||||||
(sqlite3)=>{return !!sqlite3.opfs})
|
(sqlite3)=>{return !!sqlite3.opfs})
|
||||||
.t({
|
.t({
|
||||||
name: 'OPFS sanity checks',
|
name: 'OPFS sanity checks',
|
||||||
test: function(sqlite3){
|
test: function(sqlite3){
|
||||||
const filename = 'tester1.js';
|
const filename = 'sqlite3-tester1.db';
|
||||||
const pVfs = capi.sqlite3_vfs_find('opfs');
|
const pVfs = capi.sqlite3_vfs_find('opfs');
|
||||||
T.assert(pVfs);
|
T.assert(pVfs);
|
||||||
const unlink = (fn=filename)=>wasm.sqlite3_wasm_vfs_unlink(pVfs,fn);
|
const unlink = (fn=filename)=>wasm.sqlite3_wasm_vfs_unlink(pVfs,fn);
|
||||||
|
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
|||||||
C Add\stiming\sinfo\sand\sOPFS\ssanity\stests\sto\stester1.js
|
C Add\skvvfs\stests\sto\stester1.js.\sFix\sa\sscopedAlloc()\smisuse\sin\soo1.DB\sctor\scaused\sby\srefactoring\searlier\sthis\smorning\s(and\scaught\sby\sthese\snew\stests).
|
||||||
D 2022-10-21T06:26:17.258
|
D 2022-10-21T06:58:27.888
|
||||||
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
|
||||||
@ -485,7 +485,7 @@ F ext/wasm/api/post-js-header.js 2e5c886398013ba2af88028ecbced1e4b22dc96a86467f1
|
|||||||
F ext/wasm/api/pre-js.js 151e0616614a49f3db19ed544fa13b38c87c108959fbcd4029ea8399a562d94f
|
F ext/wasm/api/pre-js.js 151e0616614a49f3db19ed544fa13b38c87c108959fbcd4029ea8399a562d94f
|
||||||
F ext/wasm/api/sqlite3-api-cleanup.js 4d07a7524dc9b7b050acfde57163e839243ad2383bd7ee0de0178b1b3e988588
|
F ext/wasm/api/sqlite3-api-cleanup.js 4d07a7524dc9b7b050acfde57163e839243ad2383bd7ee0de0178b1b3e988588
|
||||||
F ext/wasm/api/sqlite3-api-glue.js 6e4e472eb5afc732a695cd7c5ded6dee6ef8b480e61aa0d648a3fc9033c84745
|
F ext/wasm/api/sqlite3-api-glue.js 6e4e472eb5afc732a695cd7c5ded6dee6ef8b480e61aa0d648a3fc9033c84745
|
||||||
F ext/wasm/api/sqlite3-api-oo1.js a8f48c76b127c6e20af8937e519e059626e8b859d17036266ae1b1b18c96a31f
|
F ext/wasm/api/sqlite3-api-oo1.js ca41ffe58bfbbefc98181081fba0b7af58afcc2770e963558f4f6a408c583fc0
|
||||||
F ext/wasm/api/sqlite3-api-opfs.js 22d60ba956e873b65e2e0591e239178082bd53a6d563c3c58db7dc03e562e8f7
|
F ext/wasm/api/sqlite3-api-opfs.js 22d60ba956e873b65e2e0591e239178082bd53a6d563c3c58db7dc03e562e8f7
|
||||||
F ext/wasm/api/sqlite3-api-prologue.js fa00d55f927e5a4ec51cf2c80f6f0eaed2f4f5774341ecf3d63a0ea4c738f8f5
|
F ext/wasm/api/sqlite3-api-prologue.js fa00d55f927e5a4ec51cf2c80f6f0eaed2f4f5774341ecf3d63a0ea4c738f8f5
|
||||||
F ext/wasm/api/sqlite3-api-worker1.js a7f38f03275d6c27ab2aef3e83215d3c97ce09c43e6904df47c3764d9d4572b4
|
F ext/wasm/api/sqlite3-api-worker1.js a7f38f03275d6c27ab2aef3e83215d3c97ce09c43e6904df47c3764d9d4572b4
|
||||||
@ -499,7 +499,7 @@ F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d
|
|||||||
F ext/wasm/batch-runner.js 5bae81684728b6be157d1f92b39824153f0fd019345b39f2ab8930f7ee2a57d8
|
F ext/wasm/batch-runner.js 5bae81684728b6be157d1f92b39824153f0fd019345b39f2ab8930f7ee2a57d8
|
||||||
F ext/wasm/common/SqliteTestUtil.js 647bf014bd30bdd870a7e9001e251d12fc1c9ec9ce176a1004b838a4b33c5c05
|
F ext/wasm/common/SqliteTestUtil.js 647bf014bd30bdd870a7e9001e251d12fc1c9ec9ce176a1004b838a4b33c5c05
|
||||||
F ext/wasm/common/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
|
F ext/wasm/common/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
|
||||||
F ext/wasm/common/testing.css c5f37db26f0c86c06503fdbe813f4786c454de2b4ec1e4437ace49256417f54d
|
F ext/wasm/common/testing.css 739b58c44511f642f16f57b701c84dc9ee412d8bc47b3d8a99d947babfa69d9d
|
||||||
F ext/wasm/common/whwasmutil.js 50d2ede0b0fa01c1d467e1801fab79f5e46bb02bcbd2b0232e4fdc6090a47818
|
F ext/wasm/common/whwasmutil.js 50d2ede0b0fa01c1d467e1801fab79f5e46bb02bcbd2b0232e4fdc6090a47818
|
||||||
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
|
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
|
||||||
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
|
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
|
||||||
@ -531,9 +531,9 @@ F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d826
|
|||||||
F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5
|
F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5
|
||||||
F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555e685bce3da8c3f
|
F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555e685bce3da8c3f
|
||||||
F ext/wasm/test-opfs-vfs.js 48fc59110e8775bb43c9be25b6d634fc07ebadab7da8fbd44889e8129c6e2548
|
F ext/wasm/test-opfs-vfs.js 48fc59110e8775bb43c9be25b6d634fc07ebadab7da8fbd44889e8129c6e2548
|
||||||
F ext/wasm/tester1-worker.html dae897329d095a56ec48881878f3b17c2833ebc850aef0b7ddc06ce075917267
|
F ext/wasm/tester1-worker.html 906feeb0528fed0fbdc2833eeb8397a4637af9b0cf36831b20dae5b425b4d877
|
||||||
F ext/wasm/tester1.html 37ccc958fa0d95074af2d72b7241c8e2d982bbec6dda4dc790241af3d933c3b6
|
F ext/wasm/tester1.html 6dc6594f0182ae84f70b58cf4102f2bb8994bbef588cedc45ea38d396937d5f4
|
||||||
F ext/wasm/tester1.js bbdf1ff6446f767871c0a88bb9c05dba14139ee9e04c236bea48da014090f825
|
F ext/wasm/tester1.js 031fae6b912d8a3df462febde99b6fed2f43bd13d20832d6fd99e01d427f9f3b
|
||||||
F ext/wasm/version-info.c 5fa356d38859d71a0369b5c37e1935def7413fcc8a4e349a39d9052c1d0479f4
|
F ext/wasm/version-info.c 5fa356d38859d71a0369b5c37e1935def7413fcc8a4e349a39d9052c1d0479f4
|
||||||
F ext/wasm/wasmfs.make ee0004813e16c283ff633e08b482008d56adf9b7d42f6c5612f7ab002b924f69
|
F ext/wasm/wasmfs.make ee0004813e16c283ff633e08b482008d56adf9b7d42f6c5612f7ab002b924f69
|
||||||
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
|
||||||
@ -2036,8 +2036,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 f07ce15479b7224b0d1ba9f147a433136e70c1461aa667d2737d4a918f778f55
|
P 99915b0076422487cdd181a54e55694404fba13e4a540329b5ede9e2c9e12532
|
||||||
R 9850bd6041ab5774a27f08fd128a0d0d
|
R a5a8d00ecb4b4c8e0659b56352a632c1
|
||||||
U stephan
|
U stephan
|
||||||
Z 22f5514a98dfdd6ddf86c9b4efb8fd0e
|
Z 0c3f60384d64eebf1bbc2e3f1ead88de
|
||||||
# Remove this line to create a well-formed Fossil manifest.
|
# Remove this line to create a well-formed Fossil manifest.
|
||||||
|
@ -1 +1 @@
|
|||||||
99915b0076422487cdd181a54e55694404fba13e4a540329b5ede9e2c9e12532
|
8e0f001ab76de6dbc17295b9085f7f61ce274c43f8c432ea4d2ec3153d248ff3
|
Reference in New Issue
Block a user