Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gosqlite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gosqlite
Commits
746114df
Commit
746114df
authored
Feb 21, 2016
by
gwenn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip some tests when cgocheck is enabled.
parent
40f42098
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
45 additions
and
8 deletions
+45
-8
.travis.yml
.travis.yml
+1
-0
busy_test.go
busy_test.go
+4
-0
cache_test.go
cache_test.go
+1
-1
csv_test.go
csv_test.go
+4
-0
function_test.go
function_test.go
+8
-0
hook_test.go
hook_test.go
+7
-0
sqlite_test.go
sqlite_test.go
+7
-0
stmt.go
stmt.go
+4
-4
trace_test.go
trace_test.go
+7
-3
vtab_test.go
vtab_test.go
+2
-0
No files found.
.travis.yml
View file @
746114df
...
@@ -15,4 +15,5 @@ install:
...
@@ -15,4 +15,5 @@ install:
before_script
:
before_script
:
-
go get github.com/bmizerany/assert
-
go get github.com/bmizerany/assert
script
:
script
:
-
GODEBUG=cgocheck=2 go test -v -tags all github.com/gwenn/gosqlite
-
GODEBUG=cgocheck=0 go test -v -tags all github.com/gwenn/gosqlite
-
GODEBUG=cgocheck=0 go test -v -tags all github.com/gwenn/gosqlite
busy_test.go
View file @
746114df
...
@@ -15,6 +15,8 @@ import (
...
@@ -15,6 +15,8 @@ import (
)
)
func
TestInterrupt
(
t
*
testing
.
T
)
{
func
TestInterrupt
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
db
.
CreateScalarFunction
(
"interrupt"
,
0
,
false
,
nil
,
func
(
ctx
*
ScalarContext
,
nArg
int
)
{
db
.
CreateScalarFunction
(
"interrupt"
,
0
,
false
,
nil
,
func
(
ctx
*
ScalarContext
,
nArg
int
)
{
...
@@ -85,6 +87,8 @@ func TestBusyTimeout(t *testing.T) {
...
@@ -85,6 +87,8 @@ func TestBusyTimeout(t *testing.T) {
}
}
func
TestBusyHandler
(
t
*
testing
.
T
)
{
func
TestBusyHandler
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
f
,
db1
,
db2
:=
openTwoConnSameDb
(
t
)
f
,
db1
,
db2
:=
openTwoConnSameDb
(
t
)
defer
os
.
Remove
(
f
.
Name
())
defer
os
.
Remove
(
f
.
Name
())
defer
checkClose
(
db1
,
t
)
defer
checkClose
(
db1
,
t
)
...
...
cache_test.go
View file @
746114df
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
package
sqlite_test
package
sqlite_test
import
(
import
(
"testing"
.
"github.com/gwenn/gosqlite"
.
"github.com/gwenn/gosqlite"
"testing"
)
)
func
checkCacheSize
(
t
*
testing
.
T
,
db
*
Conn
,
expectedSize
,
expectedMaxSize
int
)
{
func
checkCacheSize
(
t
*
testing
.
T
,
db
*
Conn
,
expectedSize
,
expectedMaxSize
int
)
{
...
...
csv_test.go
View file @
746114df
...
@@ -17,6 +17,8 @@ import (
...
@@ -17,6 +17,8 @@ import (
)
)
func
TestCsvModule
(
t
*
testing
.
T
)
{
func
TestCsvModule
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
err
:=
LoadCsvModule
(
db
)
err
:=
LoadCsvModule
(
db
)
...
@@ -112,6 +114,8 @@ var csvModuleTests = []struct {
...
@@ -112,6 +114,8 @@ var csvModuleTests = []struct {
}
}
func
TestCsvModuleArguments
(
t
*
testing
.
T
)
{
func
TestCsvModuleArguments
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
err
:=
LoadCsvModule
(
db
)
err
:=
LoadCsvModule
(
db
)
...
...
function_test.go
View file @
746114df
...
@@ -24,6 +24,8 @@ func half(ctx *ScalarContext, nArg int) {
...
@@ -24,6 +24,8 @@ func half(ctx *ScalarContext, nArg int) {
}
}
func
TestScalarFunction
(
t
*
testing
.
T
)
{
func
TestScalarFunction
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
err
:=
db
.
CreateScalarFunction
(
"half"
,
1
,
true
,
nil
,
half
,
nil
)
err
:=
db
.
CreateScalarFunction
(
"half"
,
1
,
true
,
nil
,
half
,
nil
)
...
@@ -71,6 +73,8 @@ func reDestroy(ad interface{}) {
...
@@ -71,6 +73,8 @@ func reDestroy(ad interface{}) {
}
}
func
TestRegexpFunction
(
t
*
testing
.
T
)
{
func
TestRegexpFunction
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
err
:=
db
.
CreateScalarFunction
(
"regexp"
,
2
,
true
,
nil
,
re
,
reDestroy
)
err
:=
db
.
CreateScalarFunction
(
"regexp"
,
2
,
true
,
nil
,
re
,
reDestroy
)
...
@@ -106,6 +110,8 @@ func user(ctx *ScalarContext, nArg int) {
...
@@ -106,6 +110,8 @@ func user(ctx *ScalarContext, nArg int) {
}
}
func
TestUserFunction
(
t
*
testing
.
T
)
{
func
TestUserFunction
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
err
:=
db
.
CreateScalarFunction
(
"user"
,
0
,
false
,
nil
,
user
,
nil
)
err
:=
db
.
CreateScalarFunction
(
"user"
,
0
,
false
,
nil
,
user
,
nil
)
...
@@ -140,6 +146,8 @@ func sumFinal(ctx *AggregateContext) {
...
@@ -140,6 +146,8 @@ func sumFinal(ctx *AggregateContext) {
}
}
func
TestSumFunction
(
t
*
testing
.
T
)
{
func
TestSumFunction
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
err
:=
db
.
CreateAggregateFunction
(
"mysum"
,
1
,
nil
,
sumStep
,
sumFinal
,
nil
)
err
:=
db
.
CreateAggregateFunction
(
"mysum"
,
1
,
nil
,
sumStep
,
sumFinal
,
nil
)
...
...
hook_test.go
View file @
746114df
...
@@ -7,6 +7,7 @@ package sqlite_test
...
@@ -7,6 +7,7 @@ package sqlite_test
import
(
import
(
"fmt"
"fmt"
"testing"
"testing"
.
"github.com/gwenn/gosqlite"
.
"github.com/gwenn/gosqlite"
)
)
...
@@ -44,6 +45,8 @@ func TestNoHook(t *testing.T) {
...
@@ -44,6 +45,8 @@ func TestNoHook(t *testing.T) {
}
}
func
TestCommitHook
(
t
*
testing
.
T
)
{
func
TestCommitHook
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
...
@@ -54,6 +57,8 @@ func TestCommitHook(t *testing.T) {
...
@@ -54,6 +57,8 @@ func TestCommitHook(t *testing.T) {
}
}
func
TestRollbackHook
(
t
*
testing
.
T
)
{
func
TestRollbackHook
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
...
@@ -64,6 +69,8 @@ func TestRollbackHook(t *testing.T) {
...
@@ -64,6 +69,8 @@ func TestRollbackHook(t *testing.T) {
}
}
func
TestUpdateHook
(
t
*
testing
.
T
)
{
func
TestUpdateHook
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
createTable
(
db
,
t
)
createTable
(
db
,
t
)
...
...
sqlite_test.go
View file @
746114df
...
@@ -6,6 +6,7 @@ package sqlite_test
...
@@ -6,6 +6,7 @@ package sqlite_test
import
(
import
(
"fmt"
"fmt"
"os"
"path"
"path"
"reflect"
"reflect"
"runtime"
"runtime"
...
@@ -23,6 +24,12 @@ func checkNoError(t *testing.T, err error, format string) {
...
@@ -23,6 +24,12 @@ func checkNoError(t *testing.T, err error, format string) {
}
}
}
}
func
skipIfCgoCheckActive
(
t
*
testing
.
T
)
{
if
runtime
.
Version
()
>=
"go1.6"
&&
!
strings
.
Contains
(
os
.
Getenv
(
"GODEBUG"
),
"cgocheck=0"
)
{
t
.
Skip
(
"cgocheck"
)
}
}
func
Must
(
b
bool
,
err
error
)
bool
{
func
Must
(
b
bool
,
err
error
)
bool
{
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
...
...
stmt.go
View file @
746114df
...
@@ -382,11 +382,11 @@ func (s *Stmt) BindByIndex(index int, value interface{}) error {
...
@@ -382,11 +382,11 @@ func (s *Stmt) BindByIndex(index int, value interface{}) error {
if
i64
&&
len
(
value
)
>
math
.
MaxInt32
{
if
i64
&&
len
(
value
)
>
math
.
MaxInt32
{
return
s
.
specificError
(
"blob too big: %d at index %d"
,
len
(
value
),
index
)
return
s
.
specificError
(
"blob too big: %d at index %d"
,
len
(
value
),
index
)
}
}
var
p
*
byte
if
len
(
value
)
==
0
{
if
len
(
value
)
>
0
{
rv
=
C
.
my_bind_blob
(
s
.
stmt
,
i
,
nil
,
0
)
p
=
&
value
[
0
]
}
else
{
rv
=
C
.
my_bind_blob
(
s
.
stmt
,
i
,
unsafe
.
Pointer
(
&
value
[
0
]),
C
.
int
(
len
(
value
)))
}
}
rv
=
C
.
my_bind_blob
(
s
.
stmt
,
i
,
unsafe
.
Pointer
(
p
),
C
.
int
(
len
(
value
)))
case
time
.
Time
:
case
time
.
Time
:
if
NullIfZeroTime
&&
value
.
IsZero
()
{
if
NullIfZeroTime
&&
value
.
IsZero
()
{
rv
=
C
.
sqlite3_bind_null
(
s
.
stmt
,
i
)
rv
=
C
.
sqlite3_bind_null
(
s
.
stmt
,
i
)
...
...
trace_test.go
View file @
746114df
...
@@ -17,12 +17,12 @@ import (
...
@@ -17,12 +17,12 @@ import (
func
init
()
{
func
init
()
{
if
os
.
Getenv
(
"SQLITE_LOG"
)
==
""
{
if
os
.
Getenv
(
"SQLITE_LOG"
)
==
""
{
err
:=
ConfigLog
(
func
(
d
interface
{},
err
error
,
msg
string
)
{
err
:=
ConfigLog
(
func
(
d
interface
{},
err
error
,
msg
string
)
{
fmt
.
Printf
(
"
%s: %s, %s
\n
"
,
d
,
err
,
msg
)
fmt
.
Printf
(
"
SQLITE: %s, %s
\n
"
,
err
,
msg
)
},
"SQLITE"
)
},
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"couldn't config log: '%s'"
,
err
))
panic
(
fmt
.
Sprintf
(
"couldn't config log: '%s'"
,
err
))
}
}
err
=
ConfigLog
(
nil
,
""
)
err
=
ConfigLog
(
nil
,
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"couldn't unset logger: '%s'"
,
err
))
panic
(
fmt
.
Sprintf
(
"couldn't unset logger: '%s'"
,
err
))
}
}
...
@@ -74,6 +74,8 @@ func TestNoTrace(t *testing.T) {
...
@@ -74,6 +74,8 @@ func TestNoTrace(t *testing.T) {
}
}
func
TestTrace
(
t
*
testing
.
T
)
{
func
TestTrace
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
db
.
Trace
(
trace
,
t
)
db
.
Trace
(
trace
,
t
)
...
@@ -88,6 +90,8 @@ func TestTrace(t *testing.T) {
...
@@ -88,6 +90,8 @@ func TestTrace(t *testing.T) {
}
}
func
TestProfile
(
t
*
testing
.
T
)
{
func
TestProfile
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
db
.
Profile
(
profile
,
t
)
db
.
Profile
(
profile
,
t
)
...
...
vtab_test.go
View file @
746114df
...
@@ -99,6 +99,8 @@ func (vc *testVTabCursor) Rowid() (int64, error) {
...
@@ -99,6 +99,8 @@ func (vc *testVTabCursor) Rowid() (int64, error) {
}
}
func
TestCreateModule
(
t
*
testing
.
T
)
{
func
TestCreateModule
(
t
*
testing
.
T
)
{
skipIfCgoCheckActive
(
t
)
db
:=
open
(
t
)
db
:=
open
(
t
)
defer
checkClose
(
db
,
t
)
defer
checkClose
(
db
,
t
)
intarray
:=
[]
int
{
1
,
2
,
3
}
intarray
:=
[]
int
{
1
,
2
,
3
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment