Skip to content

Commit

Permalink
Add shared memory build tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruces committed Apr 9, 2024
1 parent 12a69c6 commit 3854397
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cross.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ echo aix ; GOOS=aix GOARCH=ppc64 go build .
echo js ; GOOS=js GOARCH=wasm go build .
echo wasip1 ; GOOS=wasip1 GOARCH=wasm go build .
echo darwin-flock ; GOOS=darwin GOARCH=amd64 go build -tags sqlite3_flock .
echo darwin-noshm ; GOOS=darwin GOARCH=amd64 go build -tags sqlite3_noshm .
echo darwin-nosys ; GOOS=darwin GOARCH=amd64 go build -tags sqlite3_nosys .
echo linux-noshm ; GOOS=linux GOARCH=amd64 go build -tags sqlite3_noshm .
echo linux-nosys ; GOOS=linux GOARCH=amd64 go build -tags sqlite3_nosys .
echo windows-nosys ; GOOS=windows GOARCH=amd64 go build -tags sqlite3_nosys .
echo freebsd-nosys ; GOOS=freebsd GOARCH=amd64 go build -tags sqlite3_nosys .
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
run: go test -v -tags sqlite3_flock ./...
if: matrix.os == 'macos-latest'

- name: Test no shared memory
run: go test -v -tags sqlite3_noshm ./...
if: matrix.os == 'ubuntu-latest'

- name: Test no locks
run: go test -v -tags sqlite3_nosys ./tests -run TestDB_nolock

Expand Down
2 changes: 1 addition & 1 deletion internal/util/mmap.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build (linux || darwin) && (amd64 || arm64) && !sqlite3_flock && !sqlite3_nosys
//go:build (linux || darwin) && (amd64 || arm64) && !sqlite3_flock && !sqlite3_noshm && !sqlite3_nosys

package util

Expand Down
4 changes: 1 addition & 3 deletions internal/util/mmap_other.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
//go:build !(linux || darwin) || !(amd64 || arm64) || sqlite3_flock || sqlite3_nosys
//go:build !(linux || darwin) || !(amd64 || arm64) || sqlite3_flock || sqlite3_noshm || sqlite3_nosys

package util

import "context"

type mmapState struct{}

func (s mmapState) closeNotify() {}

func (s *mmapState) init(ctx context.Context, _ bool) context.Context {
return ctx
}
Expand Down
2 changes: 1 addition & 1 deletion vfs/shm.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build (linux || darwin) && (amd64 || arm64) && !sqlite3_flock && !sqlite3_nosys
//go:build (linux || darwin) && (amd64 || arm64) && !sqlite3_flock && !sqlite3_noshm && !sqlite3_nosys

package vfs

Expand Down
6 changes: 1 addition & 5 deletions vfs/shm_other.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//go:build !(linux || darwin) || !(amd64 || arm64) || sqlite3_flock || sqlite3_nosys
//go:build !(linux || darwin) || !(amd64 || arm64) || sqlite3_flock || sqlite3_noshm || sqlite3_nosys

package vfs

import "github.com/tetratelabs/wazero/api"

// SupportsSharedMemory is true on platforms that support shared memory.
// To enable shared memory support on those platforms,
// you need to set the appropriate [wazero.RuntimeConfig];
Expand All @@ -14,8 +12,6 @@ import "github.com/tetratelabs/wazero/api"
// [EXCLUSIVE locking mode]: https://sqlite.org/pragma.html#pragma_locking_mode
const SupportsSharedMemory = false

func vfsVersion(api.Module) uint32 { return 0 }

type vfsShm struct{}

func (vfsShm) Close() error { return nil }

0 comments on commit 3854397

Please sign in to comment.