aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/wasm/GNUmakefile14
-rw-r--r--ext/wasm/api/sqlite3-wasm.c19
-rw-r--r--ext/wasm/tester1.js2
-rw-r--r--ext/wasm/wasmfs.make4
4 files changed, 20 insertions, 19 deletions
diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile
index b76ed5cd2..993c66869 100644
--- a/ext/wasm/GNUmakefile
+++ b/ext/wasm/GNUmakefile
@@ -568,12 +568,14 @@ oz: clean
include fiddle.make
-ifneq (,$(filter wasmfs,$(MAKECMDGOALS)))
-# wasmfs build disabled 2022-10-19 per /chat
-# discussion. OPFS-over-wasmfs was initially a stopgap measure and a
-# convenient point of comparison for the OPFS sqlite3_vfs's
-# performance, but it currently doubles our deliverables and build
-# maintenance burden for very little, if any, benefit.
+# Only add wasmfs if wasmfs.enable=1 or we're running (dist)clean
+wasmfs.enable ?= $(if $(filter %clean,$(MAKECMDGOALS)),1,0)
+ifeq (1,$(wasmfs.enable))
+# wasmfs build disabled 2022-10-19 per /chat discussion.
+# OPFS-over-wasmfs was initially a stopgap measure and a convenient
+# point of comparison for the OPFS sqlite3_vfs's performance, but it
+# currently doubles our deliverables and build maintenance burden for
+# little, if any, benefit.
#
########################################################################
# Some platforms do not support the WASMFS build. Raspberry Pi OS is one
diff --git a/ext/wasm/api/sqlite3-wasm.c b/ext/wasm/api/sqlite3-wasm.c
index 62082edda..203e70a3e 100644
--- a/ext/wasm/api/sqlite3-wasm.c
+++ b/ext/wasm/api/sqlite3-wasm.c
@@ -15,9 +15,11 @@
#define SQLITE_WASM
#ifdef SQLITE_WASM_ENABLE_C_TESTS
/*
-** Functions blocked off by SQLITE_WASM_TESTS are intended solely for
-** use in unit/regression testing. They may be safely omitted from
-** client-side builds.
+** Code blocked off by SQLITE_WASM_TESTS is intended solely for use in
+** unit/regression testing. They may be safely omitted from
+** client-side builds. The main unit test script, tester1.js, will
+** skip related tests if it doesn't find the corresponding functions
+** in the WASM exports.
*/
# define SQLITE_WASM_TESTS 1
#else
@@ -1026,7 +1028,7 @@ int sqlite3_wasm_vfs_create_file( sqlite3_vfs *pVfs,
pPos += n;
}
if( 0==rc && nData>0 ){
- assert(nData<512);
+ assert( nData<blockSize );
rc = pIo->xWrite(pFile, pPos, nData, (sqlite3_int64)(pPos - pData));
}
}
@@ -1072,7 +1074,7 @@ sqlite3_kvvfs_methods * sqlite3_wasm_kvvfs_methods(void){
return &sqlite3KvvfsMethods;
}
-#if defined(__EMSCRIPTEN__) && defined(SQLITE_WASM_WASMFS)
+#if defined(__EMSCRIPTEN__) && defined(SQLITE_ENABLE_WASMFS)
#include <emscripten/wasmfs.h>
/*
@@ -1093,7 +1095,7 @@ sqlite3_kvvfs_methods * sqlite3_wasm_kvvfs_methods(void){
**
** Returns 0 on success, SQLITE_NOMEM if instantiation of the backend
** object fails, SQLITE_IOERR if mkdir() of the zMountPoint dir in
-** the virtual FS fails. In builds compiled without SQLITE_WASM_WASMFS
+** the virtual FS fails. In builds compiled without SQLITE_ENABLE_WASMFS
** defined, SQLITE_NOTFOUND is returned without side effects.
*/
SQLITE_WASM_KEEP
@@ -1102,9 +1104,6 @@ int sqlite3_wasm_init_wasmfs(const char *zMountPoint){
if( !zMountPoint || !*zMountPoint ) zMountPoint = "/opfs";
if( !pOpfs ){
pOpfs = wasmfs_create_opfs_backend();
- if( pOpfs ){
- emscripten_console_log("Created WASMFS OPFS backend.");
- }
}
/** It's not enough to instantiate the backend. We have to create a
mountpoint in the VFS and attach the backend to it. */
@@ -1128,7 +1127,7 @@ int sqlite3_wasm_init_wasmfs(const char *zUnused){
if(zUnused){/*unused*/}
return SQLITE_NOTFOUND;
}
-#endif /* __EMSCRIPTEN__ && SQLITE_WASM_WASMFS */
+#endif /* __EMSCRIPTEN__ && SQLITE_ENABLE_WASMFS */
#if SQLITE_WASM_TESTS
diff --git a/ext/wasm/tester1.js b/ext/wasm/tester1.js
index 825d529f6..3fe6a0ac7 100644
--- a/ext/wasm/tester1.js
+++ b/ext/wasm/tester1.js
@@ -1782,7 +1782,7 @@
sh = await fh.createSyncAccessHandle();
T.assert(fSize === await sh.getSize());
}finally{
- if(sh) sh.close();
+ if(sh) await sh.close();
unlink();
}
}
diff --git a/ext/wasm/wasmfs.make b/ext/wasm/wasmfs.make
index 12144f790..81b41870c 100644
--- a/ext/wasm/wasmfs.make
+++ b/ext/wasm/wasmfs.make
@@ -26,7 +26,7 @@ sqlite3-wasmfs.cflags :=
sqlite3-wasmfs.cflags += -std=c99 -fPIC
sqlite3-wasmfs.cflags += -pthread
sqlite3-wasmfs.cflags += $(cflags.common)
-sqlite3-wasmfs.cflags += $(SQLITE_OPT) -DSQLITE_WASM_WASMFS
+sqlite3-wasmfs.cflags += $(SQLITE_OPT) -DSQLITE_ENABLE_WASMFS
########################################################################
# emcc flags specific to building the final .js/.wasm file...
@@ -88,7 +88,7 @@ all: wasmfs
speedtest1-wasmfs.js := $(dir.wasmfs)/speedtest1-wasmfs.js
speedtest1-wasmfs.wasm := $(subst .js,.wasm,$(speedtest1-wasmfs.js))
speedtest1-wasmfs.eflags := $(sqlite3-wasmfs.fsflags)
-speedtest1-wasmfs.eflags += $(SQLITE_OPT) -DSQLITE_WASM_WASMFS
+speedtest1-wasmfs.eflags += $(SQLITE_OPT) -DSQLITE_ENABLE_WASMFS
speedtest1-wasmfs.eflags += -sALLOW_MEMORY_GROWTH=0
speedtest1-wasmfs.eflags += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.128)
$(eval $(call call-make-pre-js,speedtest1-wasmfs))