From 998173efcda0445f1f9be700c9145ff484801911 Mon Sep 17 00:00:00 2001 From: stephan Date: Sat, 26 Sep 2026 06:23:08 +0000 Subject: [PATCH] Update some long-dormant JS test code for refactoring-/renaming breakage induced since it was last used. Remove a separate long-dormant JS demo which cannot work with the current code. FossilOrigin-Name: fc4e246dc26f3e3872dde42ceefcea70ba4158a92ba94361656b2ca0f4e3ef92 --- ext/wasm/api/opfs-common-shared.c-pp.js | 2 +- ext/wasm/index.html | 8 --- ext/wasm/test-opfs-vfs.js | 85 ------------------------- manifest | 17 +++-- manifest.uuid | 2 +- 5 files changed, 10 insertions(+), 104 deletions(-) delete mode 100644 ext/wasm/test-opfs-vfs.js diff --git a/ext/wasm/api/opfs-common-shared.c-pp.js b/ext/wasm/api/opfs-common-shared.c-pp.js index 89bce116a2..c1d43bd7b4 100644 --- a/ext/wasm/api/opfs-common-shared.c-pp.js +++ b/ext/wasm/api/opfs-common-shared.c-pp.js @@ -1171,7 +1171,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ //| capi.SQLITE_OPEN_DELETEONCLOSE | capi.SQLITE_OPEN_MAIN_DB; const pOut = wasm.scopedAlloc(8); - const dbFile = "/sanity/check/file"+randomFilename(8); + const dbFile = "/sanity/check/file"+opfsUtil.randomFilename(8); const zDbFile = wasm.scopedAllocCString(dbFile); let rc; state.s11n.serialize("This is รค string."); diff --git a/ext/wasm/index.html b/ext/wasm/index.html index 6f22dc150b..d3d20c6760 100644 --- a/ext/wasm/index.html +++ b/ext/wasm/index.html @@ -135,14 +135,6 @@ module. -
  • test-opfs-vfs - (same - with verbose output and sanity-checking tests) is an - sqlite3_vfs OPFS proxy using SharedArrayBuffer and the - Atomics APIs to regulate communication between the - synchronous sqlite3_vfs interface and the async OPFS - impl. -
  • OPFS concurrency tests using multiple workers.
  • diff --git a/ext/wasm/test-opfs-vfs.js b/ext/wasm/test-opfs-vfs.js deleted file mode 100644 index 96d0eacfc9..0000000000 --- a/ext/wasm/test-opfs-vfs.js +++ /dev/null @@ -1,85 +0,0 @@ -/* - 2022-09-17 - - The author disclaims copyright to this source code. In place of a - legal notice, here is a blessing: - - * May you do good and not evil. - * May you find forgiveness for yourself and forgive others. - * May you share freely, never taking more than you give. - - *********************************************************************** - - A testing ground for the OPFS VFS. -*/ -'use strict'; -const tryOpfsVfs = async function(sqlite3){ - const toss = function(...args){throw new Error(args.join(' '))}; - const logPrefix = "OPFS tester:"; - const log = (...args)=>console.log(logPrefix,...args); - const warn = (...args)=>console.warn(logPrefix,...args); - const error = (...args)=>console.error(logPrefix,...args); - const opfs = sqlite3.opfs; - log("tryOpfsVfs()"); - if(!sqlite3.opfs){ - const e = new Error("OPFS is not available."); - error(e); - throw e; - } - const capi = sqlite3.capi; - const pVfs = capi.sqlite3_vfs_find("opfs") || toss("Missing 'opfs' VFS."); - const oVfs = new capi.sqlite3_vfs(pVfs); - log("OPFS VFS:",pVfs, oVfs); - - const wait = async (ms)=>{ - return new Promise((resolve)=>setTimeout(resolve, ms)); - }; - - const urlArgs = new URL(self.location.href).searchParams; - const dbFile = "my-persistent.db"; - if(urlArgs.has('delete')) sqlite3.opfs.unlink(dbFile); - - const db = new sqlite3.oo1.OpfsDb(dbFile,'ct'); - log("db file:",db.filename); - try{ - if(opfs.entryExists(dbFile)){ - let n = db.selectValue("select count(*) from sqlite_schema"); - log("Persistent data found. sqlite_schema entry count =",n); - } - db.transaction((db)=>{ - db.exec({ - sql:[ - "create table if not exists t(a);", - "insert into t(a) values(?),(?),(?);", - ], - bind: [performance.now() | 0, - (performance.now() |0) / 2, - (performance.now() |0) / 4] - }); - }); - log("count(*) from t =",db.selectValue("select count(*) from t")); - - // Some sanity checks of the opfs utility functions... - const testDir = '/sqlite3-opfs-'+opfs.randomFilename(12); - const aDir = testDir+'/test/dir'; - await opfs.mkdir(aDir) || toss("mkdir failed"); - await opfs.mkdir(aDir) || toss("mkdir must pass if the dir exists"); - await opfs.unlink(testDir+'/test') && toss("delete 1 should have failed (dir not empty)"); - //await opfs.entryExists(testDir) - await opfs.unlink(testDir+'/test/dir') || toss("delete 2 failed"); - await opfs.unlink(testDir+'/test/dir') && toss("delete 2b should have failed (dir already deleted)"); - await opfs.unlink(testDir, true) || toss("delete 3 failed"); - await opfs.entryExists(testDir) && toss("entryExists(",testDir,") should have failed"); - }finally{ - db.close(); - } - - log("Done!"); -}/*tryOpfsVfs()*/; - -importScripts('jswasm/sqlite3.js'); -self.sqlite3InitModule() - .then((sqlite3)=>tryOpfsVfs(sqlite3)) - .catch((e)=>{ - console.error("Error initializing module:",e); - }); diff --git a/manifest b/manifest index 986a94ebc5..2413f8fb55 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\sdropping\san\serror\scode\sin\sfts5\scontentless-delete\smode\safter\sparsing\san\s%_docize\srecord.\sReport\s[bugs:/info/2026-09-25T15:52:10Z\s|\s2026-09-25T15:52:10Z]. -D 2026-09-25T17:42:10.701 +C Update\ssome\slong-dormant\sJS\stest\scode\sfor\srefactoring-/renaming\sbreakage\sinduced\ssince\sit\swas\slast\sused.\sRemove\sa\sseparate\slong-dormant\sJS\sdemo\swhich\scannot\swork\swith\sthe\scurrent\scode. +D 2026-09-26T06:23:08.635 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -597,7 +597,7 @@ F ext/wasm/api/README.md a905d5c6bfc3e2df875bd391d6d6b7b48d41b43bdee02ad115b4724 F ext/wasm/api/extern-post-js.c-pp.js cba0f9735f741ce266aa0c52e6e1224f9fb027f20253292d3e71480787675a05 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/opfs-common-inline.c-pp.js 496ca858af09b7fef2efaece467960611d35f57254078424bcdeac42ded9e85d -F ext/wasm/api/opfs-common-shared.c-pp.js 9bbdbc2b7d2489f07ec5d7e50dc8948ecbc194c58872c4737de65c736f720b3e +F ext/wasm/api/opfs-common-shared.c-pp.js dc60dddb24251a9efe896943c1d6004f24ea367f9c93dbfb6463ecfc1263007b F ext/wasm/api/post-js-footer.js a50c1a2c4d008aede7b2aa1f18891a7ee71437c2f415b8aeb3db237ddce2935b F ext/wasm/api/post-js-header.js f35d2dcf1ab7f22a93d565f8e0b622a2934fc4e743edf3b708e4dd8140eeff55 F ext/wasm/api/pre-js.c-pp.js 2d12b65e1caefda202edc67ccbe248918ed1aee7fd4907527bffb3e6bca599c0 @@ -635,7 +635,7 @@ F ext/wasm/fiddle/fiddle-worker.js e45bfe9ce4cf0d0270ca0ed254af8deecc7d46c399db4 F ext/wasm/fiddle/fiddle.js 2a0984cc4a35e6889c0d84ee9bf853317d5545ddb3966dfb995bbe589f923c4c F ext/wasm/fiddle/index.c-pp.html 5fd1f462864710d1b00d27fc4bc6190cb846cc865d7cc93b99644423f2c4cc84 F ext/wasm/index-dist.html db23748044e286773f2768eec287669501703b5d5f72755e8db73607dc54d290 -F ext/wasm/index.html 5bf6cf1b0a3c8b9f5f54d77f2219d7ae87a15162055ce308109c49b1dcab4239 +F ext/wasm/index.html 7b27bb7518558c58c518ac3b47220226f635fa11331bac98f4aaf0d63fc4b283 F ext/wasm/jaccwabyt/jaccwabyt.js 4e2b797dc170851c9c530c3567679f4aa509eec0fab73b466d945b00b356574b F ext/wasm/jaccwabyt/jaccwabyt.md 6aa90fa1a973d0ad10d077088bea163b241d8470c75eafdef87620a1de1dea41 F ext/wasm/libcmpp.c 9a87f4d3ca91fdf2dbb87cffacc641b78aeb16fbc4da0240f5c5bf88dc150c90 @@ -653,7 +653,6 @@ F ext/wasm/split-speedtest1-script.sh a3e271938d4d14ee49105eb05567c6a69ba4c1f129 F ext/wasm/sql/000-mandelbrot.sql 775337a4b80938ac8146aedf88808282f04d02d983d82675bd63d9c2d97a15f0 F ext/wasm/sql/001-sudoku.sql 35b7cb7239ba5d5f193bc05ec379bcf66891bce6f2a5b3879f2f78d0917299b5 F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555e685bce3da8c3f -F ext/wasm/test-opfs-vfs.js 1618670e466f424aa289859fe0ec8ded223e42e9e69b5c851f809baaaca1a00c F ext/wasm/tester1-worker.c-pp.html 441b8b12769670a6bf03be205e6f20ec05827348a565ddcee94219c44ec313e3 F ext/wasm/tester1.c-pp.html 69403505b2c0b6cd76c8a210e3a09e80a8eb84a47c3eae591ab0e81c3934af61 F ext/wasm/tester1.c-pp.js b2c1a7aebf00f835403ba9792acb5df0962cac60e4281943673828982d59f0ce @@ -2222,8 +2221,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 2cde8fd0a272170464912c62d42d9ca754a166fb0bba0ea57ea7a0c1a28fe6d4 -R a03aec2d38b40e9780df0f7ceb504646 -U dan -Z a7126769a738df89af74f5cb37d4d54c +P 52f84cfcdb4ac2d959a2f7ee4bc832e7f49204c86e8762042c99e19488d34f5b +R f81a9fcb82179e3d5240c04b3354fd82 +U stephan +Z f985a8b99d4b51cffabd5cd05fa5d846 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e634aad2c9..5229ca49b8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -52f84cfcdb4ac2d959a2f7ee4bc832e7f49204c86e8762042c99e19488d34f5b +fc4e246dc26f3e3872dde42ceefcea70ba4158a92ba94361656b2ca0f4e3ef92