Skip to content

Commit e0a2099

Browse files
committed
Enable more tests.
1 parent 67d859a commit e0a2099

File tree

8 files changed

+50
-15
lines changed

8 files changed

+50
-15
lines changed

driver/driver_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build !sqlite3_nosys
2-
31
package driver
42

53
import (
@@ -17,6 +15,7 @@ import (
1715
_ "github.com/ncruces/go-sqlite3/embed"
1816
"github.com/ncruces/go-sqlite3/internal/util"
1917
_ "github.com/ncruces/go-sqlite3/tests/testcfg"
18+
"github.com/ncruces/go-sqlite3/vfs"
2019
)
2120

2221
func Test_Open_dir(t *testing.T) {
@@ -82,6 +81,9 @@ func Test_Open_pragma_invalid(t *testing.T) {
8281
}
8382

8483
func Test_Open_txLock(t *testing.T) {
84+
if !vfs.SupportsFileLocking {
85+
t.Skip("skipping without locks")
86+
}
8587
t.Parallel()
8688

8789
db, err := sql.Open("sqlite3", "file:"+
@@ -128,6 +130,9 @@ func Test_Open_txLock_invalid(t *testing.T) {
128130
}
129131

130132
func Test_BeginTx(t *testing.T) {
133+
if !vfs.SupportsFileLocking {
134+
t.Skip("skipping without locks")
135+
}
131136
t.Parallel()
132137

133138
ctx, cancel := context.WithCancel(context.Background())

driver/example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !sqlite3_nosys
1+
//go:build (linux || darwin || windows || freebsd) && !sqlite3_nosys
22

33
package driver_test
44

tests/backup_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build !sqlite3_nosys
2-
31
package tests
42

53
import (
@@ -9,9 +7,13 @@ import (
97
"github.com/ncruces/go-sqlite3"
108
_ "github.com/ncruces/go-sqlite3/embed"
119
_ "github.com/ncruces/go-sqlite3/tests/testcfg"
10+
"github.com/ncruces/go-sqlite3/vfs"
1211
)
1312

1413
func TestBackup(t *testing.T) {
14+
if !vfs.SupportsFileLocking {
15+
t.Skip("skipping without locks")
16+
}
1517
t.Parallel()
1618

1719
backupName := filepath.Join(t.TempDir(), "backup.db")

tests/bradfitz/sql_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !sqlite3_nosys
1+
//go:build (linux || darwin || windows || freebsd) && !sqlite3_nosys
22

33
package bradfitz
44

tests/parallel/parallel_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build !sqlite3_nosys
2-
31
package tests
42

53
import (
@@ -21,6 +19,10 @@ import (
2119
)
2220

2321
func Test_parallel(t *testing.T) {
22+
if !vfs.SupportsFileLocking {
23+
t.Skip("skipping without locks")
24+
}
25+
2426
var iter int
2527
if testing.Short() {
2628
iter = 1000
@@ -65,6 +67,10 @@ func Test_memdb(t *testing.T) {
6567
}
6668

6769
func Test_adiantum(t *testing.T) {
70+
if !vfs.SupportsFileLocking {
71+
t.Skip("skipping without locks")
72+
}
73+
6874
var iter int
6975
if testing.Short() {
7076
iter = 1000
@@ -81,6 +87,9 @@ func Test_adiantum(t *testing.T) {
8187
}
8288

8389
func TestMultiProcess(t *testing.T) {
90+
if !vfs.SupportsFileLocking {
91+
t.Skip("skipping without locks")
92+
}
8493
if testing.Short() {
8594
t.Skip("skipping in short mode")
8695
}

tests/wal_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build !sqlite3_nosys
2-
31
package tests
42

53
import (
@@ -14,6 +12,9 @@ import (
1412
)
1513

1614
func TestWAL_enter_exit(t *testing.T) {
15+
if !vfs.SupportsFileLocking {
16+
t.Skip("skipping without locks")
17+
}
1718
t.Parallel()
1819

1920
file := filepath.Join(t.TempDir(), "test.db")
@@ -49,7 +50,6 @@ func TestWAL_readonly(t *testing.T) {
4950
if !vfs.SupportsSharedMemory {
5051
t.Skip("skipping without shared memory")
5152
}
52-
5353
t.Parallel()
5454

5555
tmp := filepath.Join(t.TempDir(), "test.db")
@@ -76,6 +76,9 @@ func TestWAL_readonly(t *testing.T) {
7676
}
7777

7878
func TestConn_WalCheckpoint(t *testing.T) {
79+
if !vfs.SupportsFileLocking {
80+
t.Skip("skipping without locks")
81+
}
7982
t.Parallel()
8083

8184
file := filepath.Join(t.TempDir(), "test.db")

vfs/lock_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build !sqlite3_nosys
2-
31
package vfs
42

53
import (
@@ -13,6 +11,10 @@ import (
1311
)
1412

1513
func Test_vfsLock(t *testing.T) {
14+
if !SupportsFileLocking {
15+
t.Skip("skipping without locks")
16+
}
17+
1618
name := filepath.Join(t.TempDir(), "test.db")
1719

1820
// Create a temporary file.

vfs/tests/mptest/mptest_test.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//go:build !sqlite3_nosys
2-
31
package mptest
42

53
import (
@@ -104,6 +102,10 @@ func system(ctx context.Context, mod api.Module, ptr uint32) uint32 {
104102
}
105103

106104
func Test_config01(t *testing.T) {
105+
if !vfs.SupportsFileLocking {
106+
t.Skip("skipping without locks")
107+
}
108+
107109
ctx := util.NewContext(newContext(t))
108110
name := filepath.Join(t.TempDir(), "test.db")
109111
cfg := config(ctx).WithArgs("mptest", name, "config01.test")
@@ -121,6 +123,9 @@ func Test_config02(t *testing.T) {
121123
if os.Getenv("CI") != "" {
122124
t.Skip("skipping in CI")
123125
}
126+
if !vfs.SupportsFileLocking {
127+
t.Skip("skipping without locks")
128+
}
124129

125130
ctx := util.NewContext(newContext(t))
126131
name := filepath.Join(t.TempDir(), "test.db")
@@ -139,6 +144,9 @@ func Test_crash01(t *testing.T) {
139144
if os.Getenv("CI") != "" {
140145
t.Skip("skipping in CI")
141146
}
147+
if !vfs.SupportsFileLocking {
148+
t.Skip("skipping without locks")
149+
}
142150

143151
ctx := util.NewContext(newContext(t))
144152
name := filepath.Join(t.TempDir(), "test.db")
@@ -154,6 +162,9 @@ func Test_multiwrite01(t *testing.T) {
154162
if testing.Short() {
155163
t.Skip("skipping in short mode")
156164
}
165+
if !vfs.SupportsFileLocking {
166+
t.Skip("skipping without locks")
167+
}
157168

158169
ctx := util.NewContext(newContext(t))
159170
name := filepath.Join(t.TempDir(), "test.db")
@@ -241,6 +252,9 @@ func Test_crash01_adiantum(t *testing.T) {
241252
if os.Getenv("CI") != "" {
242253
t.Skip("skipping in CI")
243254
}
255+
if !vfs.SupportsFileLocking {
256+
t.Skip("skipping without locks")
257+
}
244258

245259
ctx := util.NewContext(newContext(t))
246260
name := "file:" + filepath.Join(t.TempDir(), "test.db") +

0 commit comments

Comments
 (0)