diff --git a/embed/README.md b/embed/README.md index 191867c..e5a64c4 100644 --- a/embed/README.md +++ b/embed/README.md @@ -1,6 +1,6 @@ # Embeddable WASM build of SQLite -This folder includes an embeddable WASM build of SQLite 3.43.1 for use with +This folder includes an embeddable WASM build of SQLite 3.43.2 for use with [`github.com/ncruces/go-sqlite3`](https://pkg.go.dev/github.com/ncruces/go-sqlite3). The following optional features are compiled in: diff --git a/embed/sqlite3.wasm b/embed/sqlite3.wasm index 873a7dc..a0e7afa 100755 Binary files a/embed/sqlite3.wasm and b/embed/sqlite3.wasm differ diff --git a/sqlite3/download.sh b/sqlite3/download.sh index d86db22..020407b 100755 --- a/sqlite3/download.sh +++ b/sqlite3/download.sh @@ -3,7 +3,7 @@ set -euo pipefail cd -P -- "$(dirname -- "$0")" -curl -#OL "https://sqlite.org/2023/sqlite-amalgamation-3430100.zip" +curl -#OL "https://sqlite.org/2023/sqlite-amalgamation-3430200.zip" unzip -d . sqlite-amalgamation-*.zip mv sqlite-amalgamation-*/sqlite3* . rm -rf sqlite-amalgamation-* @@ -12,24 +12,24 @@ cat *.patch | patch --posix mkdir -p ext/ cd ext/ -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/ext/misc/decimal.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/ext/misc/uint.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/ext/misc/uuid.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/ext/misc/base64.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/ext/misc/regexp.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/ext/misc/series.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/ext/misc/anycollseq.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/ext/misc/decimal.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/ext/misc/uint.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/ext/misc/uuid.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/ext/misc/base64.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/ext/misc/regexp.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/ext/misc/series.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/ext/misc/anycollseq.c" cd ~- cd ../vfs/tests/mptest/testdata/ -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/mptest/mptest.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/mptest/config01.test" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/mptest/config02.test" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/mptest/crash01.test" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/mptest/crash02.subtest" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/mptest/multiwrite01.test" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/mptest/mptest.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/mptest/config01.test" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/mptest/config02.test" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/mptest/crash01.test" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/mptest/crash02.subtest" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/mptest/multiwrite01.test" cd ~- cd ../vfs/tests/speedtest1/testdata/ -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.1/test/speedtest1.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.43.2/test/speedtest1.c" cd ~- \ No newline at end of file diff --git a/vfs/tests/mptest/mptest_test.go b/vfs/tests/mptest/mptest_test.go index 9f7ce5b..2cc2b2d 100644 --- a/vfs/tests/mptest/mptest_test.go +++ b/vfs/tests/mptest/mptest_test.go @@ -2,6 +2,7 @@ package mptest import ( "bytes" + "compress/bzip2" "context" "crypto/rand" "embed" @@ -24,8 +25,8 @@ import ( "github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1" ) -//go:embed testdata/mptest.wasm -var binary []byte +//go:embed testdata/mptest.wasm.bz2 +var compressed string //go:embed testdata/*.*test var scripts embed.FS @@ -48,6 +49,11 @@ func TestMain(m *testing.M) { panic(err) } + binary, err := io.ReadAll(bzip2.NewReader(strings.NewReader(compressed))) + if err != nil { + panic(err) + } + module, err = rt.CompileModule(ctx, binary) if err != nil { panic(err) diff --git a/vfs/tests/mptest/testdata/.gitattributes b/vfs/tests/mptest/testdata/.gitattributes index 86eff9f..3473a26 100644 --- a/vfs/tests/mptest/testdata/.gitattributes +++ b/vfs/tests/mptest/testdata/.gitattributes @@ -1,2 +1,2 @@ -mptest.wasm filter=lfs diff=lfs merge=lfs -text +mptest.wasm.bz2 filter=lfs diff=lfs merge=lfs -text *.*test -crlf \ No newline at end of file diff --git a/vfs/tests/mptest/testdata/build.sh b/vfs/tests/mptest/testdata/build.sh index 758e43a..acf3c2d 100755 --- a/vfs/tests/mptest/testdata/build.sh +++ b/vfs/tests/mptest/testdata/build.sh @@ -28,4 +28,5 @@ WASI_SDK="$ROOT/tools/wasi-sdk-20.0/bin" --enable-simd --enable-mutable-globals --enable-multivalue \ --enable-bulk-memory --enable-reference-types \ --enable-nontrapping-float-to-int --enable-sign-ext -mv mptest.tmp mptest.wasm \ No newline at end of file +mv mptest.tmp mptest.wasm +bzip2 -9f mptest.wasm \ No newline at end of file diff --git a/vfs/tests/mptest/testdata/mptest.wasm b/vfs/tests/mptest/testdata/mptest.wasm deleted file mode 100644 index f05cd6c..0000000 --- a/vfs/tests/mptest/testdata/mptest.wasm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5b77e9e13a487e976a6e71bc698542098433d1cc586ad8f24784f1f325ffb8dd -size 1459145 diff --git a/vfs/tests/mptest/testdata/mptest.wasm.bz2 b/vfs/tests/mptest/testdata/mptest.wasm.bz2 new file mode 100644 index 0000000..659d11f --- /dev/null +++ b/vfs/tests/mptest/testdata/mptest.wasm.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:816ddd36a255d2b3995f75924bdebd9dc7c4378eeccbe28176751434cfb788ca +size 508404 diff --git a/vfs/tests/speedtest1/speedtest1_test.go b/vfs/tests/speedtest1/speedtest1_test.go index 41dccac..5be9853 100644 --- a/vfs/tests/speedtest1/speedtest1_test.go +++ b/vfs/tests/speedtest1/speedtest1_test.go @@ -2,6 +2,7 @@ package speedtest1 import ( "bytes" + "compress/bzip2" "context" "crypto/rand" "flag" @@ -23,8 +24,8 @@ import ( _ "github.com/ncruces/go-sqlite3/vfs/memdb" ) -//go:embed testdata/speedtest1.wasm -var binary []byte +//go:embed testdata/speedtest1.wasm.bz2 +var compressed string var ( rt wazero.Runtime @@ -45,6 +46,11 @@ func TestMain(m *testing.M) { panic(err) } + binary, err := io.ReadAll(bzip2.NewReader(strings.NewReader(compressed))) + if err != nil { + panic(err) + } + module, err = rt.CompileModule(ctx, binary) if err != nil { panic(err) diff --git a/vfs/tests/speedtest1/testdata/.gitattributes b/vfs/tests/speedtest1/testdata/.gitattributes index f4493d4..af895aa 100644 --- a/vfs/tests/speedtest1/testdata/.gitattributes +++ b/vfs/tests/speedtest1/testdata/.gitattributes @@ -1 +1 @@ -speedtest1.wasm filter=lfs diff=lfs merge=lfs -text \ No newline at end of file +speedtest1.wasm.bz2 filter=lfs diff=lfs merge=lfs -text \ No newline at end of file diff --git a/vfs/tests/speedtest1/testdata/build.sh b/vfs/tests/speedtest1/testdata/build.sh index fbed177..1c16bfe 100755 --- a/vfs/tests/speedtest1/testdata/build.sh +++ b/vfs/tests/speedtest1/testdata/build.sh @@ -23,4 +23,5 @@ WASI_SDK="$ROOT/tools/wasi-sdk-20.0/bin" --enable-simd --enable-mutable-globals --enable-multivalue \ --enable-bulk-memory --enable-reference-types \ --enable-nontrapping-float-to-int --enable-sign-ext -mv speedtest1.tmp speedtest1.wasm \ No newline at end of file +mv speedtest1.tmp speedtest1.wasm +bzip2 -9f speedtest1.wasm \ No newline at end of file diff --git a/vfs/tests/speedtest1/testdata/speedtest1.wasm b/vfs/tests/speedtest1/testdata/speedtest1.wasm deleted file mode 100644 index 3104668..0000000 --- a/vfs/tests/speedtest1/testdata/speedtest1.wasm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3b52de3306965ac3f812592be29697d75232802a13bb16a34344f8d81dbf0637 -size 1499410 diff --git a/vfs/tests/speedtest1/testdata/speedtest1.wasm.bz2 b/vfs/tests/speedtest1/testdata/speedtest1.wasm.bz2 new file mode 100644 index 0000000..df2fa97 --- /dev/null +++ b/vfs/tests/speedtest1/testdata/speedtest1.wasm.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0c551f14aeb338ab652f2bded33ba58188b76f2cb24ca076576c968341f841e +size 523315