Skip to content

Commit

Permalink
Fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruces committed Nov 6, 2024
1 parent 23737a6 commit 38da27b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ jobs:
- name: Test ppc64le (interpreter)
run: GOARCH=ppc64le go test -v -short ./...

- name: Test s390x (big-endian, z/OS like)
run: GOARCH=s390x go test -v -short -tags sqlite3_flock ./...
- name: Test s390x (big-endian)
run: GOARCH=s390x go test -v -short -tags sqlite3_dotlk ./...

test-vm:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions vfs/shm_dotlk.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,21 @@ func (s *vfsShm) shmMap(ctx context.Context, mod api.Module, id, size int32, ext
defer s.Unlock()
defer s.shmAcquire()

// Extend shared memory.
if int(id) >= len(s.shared) {
if !extend {
return 0, _OK
}
s.shared = append(s.shared, make([][_WALINDEX_PGSZ]byte, int(id)-len(s.shared)+1)...)
}

// Allocate shadow memory.
if int(id) >= len(s.shadow) {
s.shadow = append(s.shadow, make([][_WALINDEX_PGSZ]byte, int(id)-len(s.shadow)+1)...)
s.shadow[0][4] = 1 // force invalidation
}

// Allocate local memory.
for int(id) >= len(s.ptrs) {
s.stack[0] = uint64(size)
if err := s.alloc.CallWithStack(ctx, s.stack[:]); err != nil {
Expand Down
19 changes: 9 additions & 10 deletions vfs/shm_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,20 @@ func (s *vfsShm) shmMap(ctx context.Context, mod api.Module, id, size int32, ext
}
}

// Map the region into memory.
r, err := util.MapRegion(ctx, mod, s.File, int64(id)*int64(size), size)
if err != nil {
return 0, _IOERR_SHMMAP
}
s.regions = append(s.regions, r)

if int(id) >= len(s.shared) {
s.shared = append(s.shared, make([][]byte, int(id)-len(s.shared)+1)...)
// Maps regions into memory.
for int(id) >= len(s.shared) {
r, err := util.MapRegion(ctx, mod, s.File, int64(id)*int64(size), size)
if err != nil {
return 0, _IOERR_SHMMAP
}
s.regions = append(s.regions, r)
s.shared = append(s.shared, r.Data)
}
s.shared[id] = r.Data

// Allocate shadow memory.
if int(id) >= len(s.shadow) {
s.shadow = append(s.shadow, make([][_WALINDEX_PGSZ]byte, int(id)-len(s.shadow)+1)...)
s.shadow[0][4] = 1 // force invalidation
}

// Allocate local memory.
Expand Down
14 changes: 8 additions & 6 deletions vfs/tests/mptest/mptest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ var compressed string
//go:embed testdata/*.*test
var scripts embed.FS

const qemuCI = runtime.GOARCH != "386" && runtime.GOARCH != "amd64" && runtime.GOARCH != "arm64"

var (
rt wazero.Runtime
module wazero.CompiledModule
Expand Down Expand Up @@ -160,8 +162,8 @@ func Test_crash01(t *testing.T) {
}

func Test_multiwrite01(t *testing.T) {
if testing.Short() {
t.Skip("skipping in short mode")
if os.Getenv("CI") != "" && qemuCI {
t.Skip("skipping in CI")
}
if !vfs.SupportsFileLocking {
t.Skip("skipping without locks")
Expand Down Expand Up @@ -190,8 +192,8 @@ func Test_config01_memory(t *testing.T) {
}

func Test_multiwrite01_memory(t *testing.T) {
if testing.Short() {
t.Skip("skipping in short mode")
if os.Getenv("CI") != "" && qemuCI {
t.Skip("skipping in CI")
}

memdb.Create("test.db", nil)
Expand Down Expand Up @@ -225,8 +227,8 @@ func Test_crash01_wal(t *testing.T) {
}

func Test_multiwrite01_wal(t *testing.T) {
if testing.Short() {
t.Skip("skipping in short mode")
if os.Getenv("CI") != "" && qemuCI {
t.Skip("skipping in CI")
}
if !vfs.SupportsSharedMemory {
t.Skip("skipping without shared memory")
Expand Down

0 comments on commit 38da27b

Please sign in to comment.