0
0
mirror of https://gitlab.com/cznic/sqlite.git synced 2025-06-01 23:30:52 +00:00

add linux/386 support

This commit is contained in:
Jan Mercl
2020-09-08 13:28:55 +02:00
parent 3ff11fb2cf
commit 0d7a764447
20 changed files with 280760 additions and 956 deletions

@ -6,18 +6,19 @@
grep=--include=*.go --include=*.l --include=*.y --include=*.yy
ngrep='TODOOK\|internal\/vfs\|internal\/bin\|internal\/mptest\|.*stringer.*\.go'
log=log-$(shell go env GOOS)-$(shell go env GOARCH)
all: editor
date
go version 2>&1 | tee log
go version 2>&1 | tee $(log)
./unconvert.sh
gofmt -l -s -w *.go
go test -i
go test -v 2>&1 -timeout 1h | tee -a log
go test -v 2>&1 -timeout 24h | tee -a $(log)
go run speedtest1/main_$(shell go env GOOS)_$(shell go env GOARCH).go
#TODO GOOS=linux GOARCH=arm go build -v ./...
#TODO GOOS=linux GOARCH=arm64 go build -v ./...
#TODO GOOS=linux GOARCH=386 go build -v ./...
GOOS=linux GOARCH=386 go build -v ./...
GOOS=linux GOARCH=amd64 go build -v ./...
#TODO GOOS=windows GOARCH=386 go build -v ./...
#TODO GOOS=windows GOARCH=amd64 go build -v ./...
@ -26,9 +27,19 @@ all: editor
staticcheck || true
maligned || true
git diff --unified=0 testdata *.golden
grep -n --color=always 'FAIL\|PASS' log
grep -n --color=always 'FAIL\|PASS' $(log)
go version
date 2>&1 | tee -a log
date 2>&1 | tee -a $(log)
linux_386:
CCGO_CPP=i686-linux-gnu-cpp TARGET_GOARCH=386 TARGET_GOOS=linux \
go generate 2>&1 | tee /tmp/log-generate-tcl-linux-386
GOOS=linux GOARCH=386 go build -v ./...
linux_amd64:
TARGET_GOOS=linux TARGET_GOARCH=amd64 \
go generate 2>&1 | tee /tmp/log-generate-sqlite-linux-amd64
GOOS=linux GOARCH=amd64 go build -v ./...
extraquick:
go test -timeout 24h -v -run Tcl -suite extraquick -maxerror 1 2>&1 | tee log-extraquick

@ -326,6 +326,14 @@ func fail(s string, args ...interface{}) {
func main() {
env := os.Getenv("GO_GENERATE")
goarch := runtime.GOARCH
goos := runtime.GOOS
if s := os.Getenv("TARGET_GOOS"); s != "" {
goos = s
}
if s := os.Getenv("TARGET_GOARCH"); s != "" {
goarch = s
}
var more []string
if env != "" {
more = strings.Split(env, ",")
@ -338,10 +346,10 @@ func main() {
}
more = append(more, ndebug...)
download()
makeSqlite(more)
makeMpTest(more)
makeSpeedTest(more)
makeTestfixture(more)
makeSqlite(goos, goarch, more)
makeMpTest(goos, goarch, more)
makeSpeedTest(goos, goarch, more)
makeTestfixture(goos, goarch, more)
dst := filepath.FromSlash("testdata/tcl")
if err := os.MkdirAll(dst, 0770); err != nil {
@ -406,7 +414,7 @@ func newCmd(bin string, args ...string) *exec.Cmd {
return r
}
func makeTestfixture(more []string) {
func makeTestfixture(goos, goarch string, more []string) {
dir := filepath.FromSlash(fmt.Sprintf("internal/testfixture"))
files := []string{
"ext/expert/sqlite3expert.c",
@ -507,7 +515,7 @@ func makeTestfixture(more []string) {
"-ccgo-export-defines", "",
"-ccgo-export-fields", "F",
"-lmodernc.org/tcl/lib,modernc.org/sqlite/internal/libc2,modernc.org/sqlite/lib",
"-o", filepath.Join(dir, fmt.Sprintf("testfixture_%s_%s.go", runtime.GOOS, runtime.GOARCH)),
"-o", filepath.Join(dir, fmt.Sprintf("testfixture_%s_%s.go", goos, goarch)),
fmt.Sprintf("-I%s", filepath.Join(sqliteSrcDir, filepath.FromSlash("ext/async"))),
fmt.Sprintf("-I%s", filepath.Join(sqliteSrcDir, filepath.FromSlash("ext/fts3"))),
fmt.Sprintf("-I%s", filepath.Join(sqliteSrcDir, filepath.FromSlash("ext/icu"))),
@ -527,12 +535,12 @@ func makeTestfixture(more []string) {
}
}
func makeSpeedTest(more []string) {
func makeSpeedTest(goos, goarch string, more []string) {
cmd := newCmd(
"ccgo",
join(
[]string{
"-o", filepath.FromSlash(fmt.Sprintf("speedtest1/main_%s_%s.go", runtime.GOOS, runtime.GOARCH)),
"-o", filepath.FromSlash(fmt.Sprintf("speedtest1/main_%s_%s.go", goos, goarch)),
filepath.Join(sqliteSrcDir, "test", "speedtest1.c"),
fmt.Sprintf("-I%s", sqliteDir),
"-l", "modernc.org/sqlite/lib",
@ -545,12 +553,12 @@ func makeSpeedTest(more []string) {
}
}
func makeMpTest(more []string) {
func makeMpTest(goos, goarch string, more []string) {
cmd := newCmd(
"ccgo",
join(
[]string{
"-o", filepath.FromSlash(fmt.Sprintf("internal/mptest/main_%s_%s.go", runtime.GOOS, runtime.GOARCH)),
"-o", filepath.FromSlash(fmt.Sprintf("internal/mptest/main_%s_%s.go", goos, goarch)),
filepath.Join(sqliteSrcDir, "mptest", "mptest.c"),
fmt.Sprintf("-I%s", sqliteDir),
"-l", "modernc.org/sqlite/lib",
@ -563,7 +571,7 @@ func makeMpTest(more []string) {
}
}
func makeSqlite(more []string) {
func makeSqlite(goos, goarch string, more []string) {
cmd := newCmd(
"ccgo",
join(
@ -575,7 +583,7 @@ func makeSqlite(more []string) {
"-ccgo-export-fields", "F",
"-ccgo-export-typedefs", "",
"-ccgo-pkgname", "sqlite3",
"-o", filepath.FromSlash(fmt.Sprintf("lib/sqlite_%s_%s.go", runtime.GOOS, runtime.GOARCH)),
"-o", filepath.FromSlash(fmt.Sprintf("lib/sqlite_%s_%s.go", goos, goarch)),
//TODO "-ccgo-volatile", "sqlite3_io_error_pending,sqlite3_open_file_count,sqlite3_pager_readdb_count,sqlite3_search_count,sqlite3_sort_count",
filepath.Join(sqliteDir, "sqlite3.c"),
},

4
go.mod

@ -3,7 +3,7 @@ module modernc.org/sqlite
go 1.15
require (
modernc.org/libc v1.1.1
modernc.org/libc v1.2.0
modernc.org/mathutil v1.1.1
modernc.org/tcl v1.2.0
modernc.org/tcl v1.3.0
)

19
go.sum

@ -1,8 +1,5 @@
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -10,17 +7,13 @@ golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6 h1:DvY3Zkh7KabQE/kfzMvYvKirS
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
honnef.co/go/netdb v0.0.0-20150201073656-a416d700ae39 h1:Oyv66NRkI9fnsvTlaB9foJojt8Lt34vcX8SMNqsvw6U=
honnef.co/go/netdb v0.0.0-20150201073656-a416d700ae39/go.mod h1:rbNo0ST5hSazCG4rGfpHrwnwvzP1QX62WbhzD+ghGzs=
modernc.org/cc/v3 v3.25.2/go.mod h1:NZ//ji5AVKCoutHdl35YtsWflZrIWMQAMgDtmKq2eyA=
modernc.org/httpfs v1.0.0 h1:LtuKNg6JMiaBKVQHKd6Phhvk+2GFp+pUcmDQgRjrds0=
modernc.org/httpfs v1.0.0/go.mod h1:BSkfoMUcahSijQD5J/Vu4UMOxzmEf5SNRwyXC4PJBEw=
modernc.org/libc v1.1.1 h1:KPZz/w/YsBQmGHFUqxN3HpIhP7YU9QvXxfGKCJO8c4w=
modernc.org/libc v1.1.1/go.mod h1:pPop4OK7nOvqg26XpsLJeEkNQmb7AlZOQUldxz1Q7nA=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=
modernc.org/libc v1.2.0 h1:VJhQ3BRr2roUj00oWKTA6ncYE/LCgJys5P5zeoHsn9I=
modernc.org/libc v1.2.0/go.mod h1:f8sp9GAfEyGYh3lsRIKtBh/XwACdFvGznxm6GJmQvXk=
modernc.org/mathutil v1.1.1 h1:FeylZSVX8S+58VsyJlkEj2bcpdytmp9MmDKZkKx8OIE=
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/memory v1.0.0 h1:Tm1p6vBp/U/SGR9/EeFhMvGzaVpUWeePopZhhIpW2YE=
modernc.org/memory v1.0.0/go.mod h1:TXr4iJDvK3g0hW+sV+Kohu7BoeHfqw7QEFZWkBExdZc=
modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
modernc.org/tcl v1.2.0 h1:yhxQGv0Y5tAJMKIiYUP3NzP7J/DpI7znRcYcuh68swI=
modernc.org/tcl v1.2.0/go.mod h1:j3SIZYKBDa5DLImg/6NtYba3XuN2nMnv4FhHxkBHoa4=
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/memory v1.0.1 h1:bhVo78NAdgvRD4N+b2hGnAwL5RP2+QyiEJDsX3jpeDA=
modernc.org/memory v1.0.1/go.mod h1:NSjvC08+g3MLOpcAxQbdctcThAEX4YlJ20WWHYEhvRg=
modernc.org/tcl v1.3.0 h1:EUTlkhinuEK3ka9yGziQeeJq7pazLAsxtgFmvw3SnB0=
modernc.org/tcl v1.3.0/go.mod h1:LOdH9HU7lxFguupAxWfpYKEkUdfzWZrJmF0ADP79JkE=

@ -0,0 +1,21 @@
// Copyright 2020 The Sqlite Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package libc2 // import "modernc.org/sqlite/internal/libc2"
var CAPI = map[string]struct{}{
"pthread_cond_broadcast": {},
"pthread_cond_destroy": {},
"pthread_cond_init": {},
"pthread_cond_signal": {},
"pthread_cond_wait": {},
"pthread_create": {},
"pthread_detach": {},
"pthread_mutex_destroy": {},
"pthread_mutex_init": {},
"pthread_mutex_lock": {},
"pthread_mutex_trylock": {},
"pthread_mutex_unlock": {},
"sched_yield": {},
}

File diff suppressed because it is too large Load Diff

@ -728,7 +728,7 @@ type sqlite3_callback = uintptr /* sqlite3.h:338:13 */
// for their own use. The pMethods entry is a pointer to an
// [sqlite3_io_methods] object that defines methods for performing
// I/O operations on the open file.
type sqlite3_file1 = struct{ pMethods uintptr }
type sqlite3_file1 = struct{ pMethods uintptr } /* sqlite3.h:683:9 */
// CAPI3REF: Result Codes
// KEYWORDS: {result code definitions}
@ -860,7 +860,7 @@ type sqlite3_io_methods1 = struct {
xShmUnmap uintptr
xFetch uintptr
xUnfetch uintptr
}
} /* sqlite3.h:683:9 */
// CAPI3REF: OS Interface File Virtual Methods Object
//
@ -1146,7 +1146,7 @@ type sqlite3_vfs1 = struct {
xSetSystemCall uintptr
xGetSystemCall uintptr
xNextSystemCall uintptr
}
} /* sqlite3.h:1367:9 */
// CAPI3REF: OS Interface Object
//
@ -1388,7 +1388,7 @@ type sqlite3_mem_methods1 = struct {
xInit uintptr
xShutdown uintptr
pAppData uintptr
}
} /* sqlite3.h:1665:9 */
// CAPI3REF: Memory Allocation Routines
//
@ -1479,7 +1479,7 @@ type sqlite3_vtab1 = struct {
pModule uintptr
nRef int32
zErrMsg uintptr
}
} /* sqlite3.h:6689:9 */
// The interface to the virtual-table mechanism is currently considered
// to be experimental. The interface might change in incompatible ways.
@ -1504,10 +1504,10 @@ type sqlite3_index_info1 = struct {
estimatedRows sqlite3_int64
idxFlags int32
colUsed sqlite3_uint64
}
} /* sqlite3.h:6690:9 */
type sqlite3_index_info = sqlite3_index_info1 /* sqlite3.h:6690:35 */
type sqlite3_vtab_cursor1 = struct{ pVtab uintptr }
type sqlite3_index_info = sqlite3_index_info1 /* sqlite3.h:6690:35 */
type sqlite3_vtab_cursor1 = struct{ pVtab uintptr } /* sqlite3.h:6691:9 */
type sqlite3_vtab_cursor = sqlite3_vtab_cursor1 /* sqlite3.h:6691:36 */
type sqlite3_module1 = struct {
@ -1535,7 +1535,7 @@ type sqlite3_module1 = struct {
xRelease uintptr
xRollbackTo uintptr
xShadowName uintptr
}
} /* sqlite3.h:6689:9 */
type sqlite3_module = sqlite3_module1 /* sqlite3.h:6692:31 */
@ -1644,7 +1644,7 @@ type sqlite3_index_constraint = struct {
op uint8
usable uint8
iTermOffset int32
}
} /* sqlite3.h:6690:9 */
// CAPI3REF: Virtual Table Indexing Information
// KEYWORDS: sqlite3_index_info
@ -1750,7 +1750,7 @@ type sqlite3_index_orderby = struct {
iColumn int32
desc uint8
_ [3]byte
}
} /* sqlite3.h:6690:9 */
// CAPI3REF: Virtual Table Indexing Information
// KEYWORDS: sqlite3_index_info
@ -1856,7 +1856,7 @@ type sqlite3_index_constraint_usage = struct {
argvIndex int32
omit uint8
_ [3]byte
}
} /* sqlite3.h:6690:9 */
// CAPI3REF: Mutex Methods Object
//
@ -1931,7 +1931,7 @@ type sqlite3_mutex_methods1 = struct {
xMutexLeave uintptr
xMutexHeld uintptr
xMutexNotheld uintptr
}
} /* sqlite3.h:7524:9 */
// CAPI3REF: Mutex Methods Object
//
@ -2009,7 +2009,7 @@ type sqlite3_mutex_methods = sqlite3_mutex_methods1 /* sqlite3.h:7524:38 */
type sqlite3_pcache_page1 = struct {
pBuf uintptr
pExtra uintptr
}
} /* sqlite3.h:8277:9 */
// CAPI3REF: Custom Page Cache Object
//
@ -2192,7 +2192,7 @@ type sqlite3_pcache_methods21 = struct {
xTruncate uintptr
xDestroy uintptr
xShrink uintptr
}
} /* sqlite3.h:8442:9 */
// CAPI3REF: Application Defined Page Cache.
// KEYWORDS: {page cache}
@ -2368,7 +2368,7 @@ type sqlite3_pcache_methods1 = struct {
xRekey uintptr
xTruncate uintptr
xDestroy uintptr
}
} /* sqlite3.h:8465:9 */
// This is the obsolete pcache_methods object that has now been replaced
// by sqlite3_pcache_methods2. This object is not used by SQLite. It is
@ -2393,7 +2393,7 @@ type sqlite3_pcache_methods = sqlite3_pcache_methods1 /* sqlite3.h:8465:39 */
// version of the database file so that it is possible to later open a new read
// transaction that sees that historical version of the database rather than
// the most recent version.
type sqlite3_snapshot1 = struct{ hidden [48]uint8 }
type sqlite3_snapshot1 = struct{ hidden [48]uint8 } /* sqlite3.h:9512:9 */
// CAPI3REF: Database Snapshot
// KEYWORDS: {snapshot} {sqlite3_snapshot}
@ -2456,7 +2456,7 @@ type sqlite3_rtree_geometry1 = struct {
aParam uintptr
pUser uintptr
xDelUser uintptr
}
} /* sqlite3.h:9839:9 */
// CAPI3REF: Flags for sqlite3_deserialize()
//
@ -2511,7 +2511,7 @@ type sqlite3_rtree_query_info1 = struct {
eWithin int32
rScore sqlite3_rtree_dbl
apSqlParam uintptr
}
} /* sqlite3.h:9840:9 */
type sqlite3_rtree_query_info = sqlite3_rtree_query_info1 /* sqlite3.h:9840:41 */
@ -2571,7 +2571,7 @@ type Fts5ExtensionApi1 = struct {
xPhraseNext uintptr
xPhraseFirstColumn uintptr
xPhraseNextColumn uintptr
}
} /* sqlite3.h:11634:9 */
// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.
@ -2608,7 +2608,7 @@ type Fts5ExtensionApi = Fts5ExtensionApi1 /* sqlite3.h:11634:33 */
type Fts5PhraseIter1 = struct {
a uintptr
b uintptr
}
} /* sqlite3.h:11636:9 */
type Fts5PhraseIter = Fts5PhraseIter1 /* sqlite3.h:11636:31 */
@ -2617,7 +2617,7 @@ type fts5_tokenizer1 = struct {
xCreate uintptr
xDelete uintptr
xTokenize uintptr
}
} /* sqlite3.h:12097:9 */
type fts5_tokenizer = fts5_tokenizer1 /* sqlite3.h:12097:31 */
@ -2638,7 +2638,7 @@ type fts5_api1 = struct {
xCreateTokenizer uintptr
xFindTokenizer uintptr
xCreateFunction uintptr
}
} /* sqlite3.h:12133:9 */
// Flags that may be passed as the third argument to xTokenize()
@ -2663,7 +2663,7 @@ type _G_fpos_t = struct {
__count int32
__value struct{ __wch uint32 }
}
}
} /* __fpos_t.h:10:9 */
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2018 Free Software Foundation, Inc.
@ -2694,7 +2694,7 @@ type _G_fpos64_t = struct {
__count int32
__value struct{ __wch uint32 }
}
}
} /* __fpos64_t.h:10:9 */
type _IO_FILE = struct {
_flags int32
@ -2726,7 +2726,7 @@ type _IO_FILE = struct {
__pad5 size_t
_mode int32
_unused2 [20]int8
}
} /* __FILE.h:4:1 */
// The opaque type of streams. This is the definition used elsewhere.
type FILE = _IO_FILE /* FILE.h:7:25 */
@ -2760,12 +2760,14 @@ type FILE = _IO_FILE /* FILE.h:7:25 */
// ISO C Standard: 7.15 Variable arguments <stdarg.h>
type off_t = int64 /* stdio.h:63:17 */
type off_t = int64 /* stdio.h:65:19 */
type off64_t = int64 /* stdio.h:70:19 */
type ssize_t = int64 /* stdio.h:77:19 */
// The type of the second argument to `fgetpos' and `fsetpos'.
type fpos_t = _G_fpos_t /* stdio.h:84:18 */
type fpos_t = _G_fpos64_t /* stdio.h:86:20 */
type fpos64_t = _G_fpos64_t /* stdio.h:89:20 */
// If we are compiling with optimizing read this file. It contains
// several optimizing inline functions and macros.
@ -3347,7 +3349,8 @@ type u_quad_t = uint64 /* types.h:38:20 */
type fsid_t = struct{ __val [2]int32 } /* types.h:39:18 */
type loff_t = int64 /* types.h:42:18 */
type ino_t = uint64 /* types.h:47:17 */
type ino_t = uint64 /* types.h:49:19 */
type ino64_t = uint64 /* types.h:54:19 */
type dev_t = uint64 /* types.h:59:17 */
@ -3624,7 +3627,7 @@ type sigset_t = struct{ __val [16]uint64 } /* sigset_t.h:7:20 */
type timeval = struct {
tv_sec int64
tv_usec int64
}
} /* struct_timeval.h:8:1 */
// NB: Include guard matches what <linux/time.h> uses.
@ -3653,7 +3656,7 @@ type timeval = struct {
type timespec = struct {
tv_sec int64
tv_nsec int64
}
} /* struct_timespec.h:9:1 */
type suseconds_t = int64 /* select.h:43:23 */
@ -3673,9 +3676,13 @@ type fd_mask = int64 /* select.h:77:19 */
type blksize_t = int64 /* types.h:202:21 */
// Types from the Large File Support interface.
type blkcnt_t = int64 /* types.h:209:20 */ // Type to count number of disk blocks.
type fsblkcnt_t = uint64 /* types.h:213:22 */ // Type to count file system blocks.
type fsfilcnt_t = uint64 /* types.h:217:22 */ // Type to count file system inodes.
type blkcnt_t = int64 /* types.h:222:22 */ // Type to count number of disk blocks.
type fsblkcnt_t = uint64 /* types.h:226:24 */ // Type to count file system blocks.
type fsfilcnt_t = uint64 /* types.h:230:24 */ // Type to count file system inodes.
type blkcnt64_t = int64 /* types.h:236:22 */ // Type to count number of disk blocks.
type fsblkcnt64_t = uint64 /* types.h:237:24 */ // Type to count file system blocks.
type fsfilcnt64_t = uint64 /* types.h:238:24 */ // Type to count file system inodes.
// Now add the thread types.
// Declaration of common pthread types for all architectures.
@ -3807,14 +3814,14 @@ type __pthread_rwlock_arch_t = struct {
__pad2 uint64
__flags uint32
_ [4]byte
}
} /* pthreadtypes-arch.h:65:1 */
// Common definition of pthread_mutex_t.
type __pthread_internal_list = struct {
__prev uintptr
__next uintptr
}
} /* thread-shared-types.h:82:9 */
// Lock elision support.
@ -3830,7 +3837,7 @@ type __pthread_mutex_s = struct {
__prev uintptr
__next uintptr
}
}
} /* thread-shared-types.h:118:1 */
// Common definition of pthread_cond_t.
@ -3842,7 +3849,7 @@ type __pthread_cond_s = struct {
__g1_orig_size uint32
__wrefs uint32
__g_signals [2]uint32
}
} /* thread-shared-types.h:171:1 */
// Thread identifiers. The structure of the attribute type is not
// exposed on purpose.
@ -3871,7 +3878,7 @@ type pthread_once_t = int32 /* pthreadtypes.h:53:30 */
type pthread_attr_t1 = struct {
_ [0]uint64
__size [56]int8
}
} /* pthreadtypes.h:56:1 */
type pthread_attr_t = pthread_attr_t1 /* pthreadtypes.h:62:30 */
@ -3915,7 +3922,7 @@ type random_data = struct {
rand_deg int32
rand_sep int32
end_ptr uintptr
}
} /* stdlib.h:423:1 */
// Data structure for communication with thread safe versions. This
// type is to be regarded as opaque. It's only exported because users
@ -3926,7 +3933,7 @@ type drand48_data = struct {
__c uint16
__init uint16
__a uint64
}
} /* stdlib.h:490:1 */
// POSIX.1-2008 extended locale interface (see locale.h).
// Definition of locale_t.
@ -3977,7 +3984,7 @@ type __locale_struct = struct {
__ctype_tolower uintptr
__ctype_toupper uintptr
__names [13]uintptr
}
} /* __locale_t.h:28:1 */
type locale_t = uintptr /* locale_t.h:24:20 */
@ -4006,7 +4013,7 @@ type Global = struct {
nTest int32
iTimeout int32
bSync int32
}
} /* mptest.c:72:8 */
// The suffix to append to the child command lines, if any
@ -4382,7 +4389,7 @@ type String1 = struct {
z uintptr
n int32
nAlloc int32
}
} /* mptest.c:408:9 */
// Structure for holding an arbitrary length string
type String = String1 /* mptest.c:408:23 */
@ -4658,7 +4665,7 @@ func readFile(tls *libc.TLS, zFilename uintptr) uintptr { /* mptest.c:684:13: */
bp := tls.Alloc(8)
defer tls.Free(8)
var in uintptr = libc.Xfopen(tls, zFilename, ts+864 /* "rb" */)
var in uintptr = libc.Xfopen64(tls, zFilename, ts+864 /* "rb" */)
var sz int64
var z uintptr
if in == uintptr(0) {
@ -5326,12 +5333,12 @@ func main1(tls *libc.TLS, argc int32, argv uintptr) int32 { /* mptest.c:1279:18:
g.bSqlTrace = (libc.Bool32(findOption(tls, (argv+uintptr(2)*8), bp+232 /* &n */, ts+2548 /* "sqltrace" */, 0) != uintptr(0)))
g.bSync = (libc.Bool32(findOption(tls, (argv+uintptr(2)*8), bp+232 /* &n */, ts+2557 /* "sync" */, 0) != uintptr(0)))
if g.zErrLog != 0 {
g.pErrLog = libc.Xfopen(tls, g.zErrLog, ts+2562 /* "a" */)
g.pErrLog = libc.Xfopen64(tls, g.zErrLog, ts+2562 /* "a" */)
} else {
g.pErrLog = libc.Xstderr
}
if g.zLog != 0 {
g.pLog = libc.Xfopen(tls, g.zLog, ts+2562 /* "a" */)
g.pLog = libc.Xfopen64(tls, g.zLog, ts+2562 /* "a" */)
} else {
g.pLog = libc.Xstdout
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

1278
lib/capi_linux_386.go Normal file

File diff suppressed because it is too large Load Diff

14
lib/hooks.go Normal file

@ -0,0 +1,14 @@
// Copyright 2019 The Sqlite Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sqlite3
import (
"modernc.org/libc"
)
// Format and write a message to the log if logging is enabled.
func X__ccgo_sqlite3_log(t *libc.TLS, iErrCode int32, zFormat uintptr, va uintptr) { /* sqlite3.c:29405:17: */
libc.X__ccgo_sqlite3_log(t, iErrCode, zFormat, va)
}

183200
lib/sqlite_linux_386.go Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

6141
speedtest1/main_linux_386.go Normal file

File diff suppressed because one or more lines are too long

@ -686,7 +686,7 @@ type sqlite3_callback = uintptr /* sqlite3.h:338:13 */
// for their own use. The pMethods entry is a pointer to an
// [sqlite3_io_methods] object that defines methods for performing
// I/O operations on the open file.
type sqlite3_file1 = struct{ pMethods uintptr }
type sqlite3_file1 = struct{ pMethods uintptr } /* sqlite3.h:683:9 */
// CAPI3REF: Result Codes
// KEYWORDS: {result code definitions}
@ -818,7 +818,7 @@ type sqlite3_io_methods1 = struct {
xShmUnmap uintptr
xFetch uintptr
xUnfetch uintptr
}
} /* sqlite3.h:683:9 */
// CAPI3REF: OS Interface File Virtual Methods Object
//
@ -1104,7 +1104,7 @@ type sqlite3_vfs1 = struct {
xSetSystemCall uintptr
xGetSystemCall uintptr
xNextSystemCall uintptr
}
} /* sqlite3.h:1367:9 */
// CAPI3REF: OS Interface Object
//
@ -1346,7 +1346,7 @@ type sqlite3_mem_methods1 = struct {
xInit uintptr
xShutdown uintptr
pAppData uintptr
}
} /* sqlite3.h:1665:9 */
// CAPI3REF: Memory Allocation Routines
//
@ -1437,7 +1437,7 @@ type sqlite3_vtab1 = struct {
pModule uintptr
nRef int32
zErrMsg uintptr
}
} /* sqlite3.h:6689:9 */
// The interface to the virtual-table mechanism is currently considered
// to be experimental. The interface might change in incompatible ways.
@ -1462,10 +1462,10 @@ type sqlite3_index_info1 = struct {
estimatedRows sqlite3_int64
idxFlags int32
colUsed sqlite3_uint64
}
} /* sqlite3.h:6690:9 */
type sqlite3_index_info = sqlite3_index_info1 /* sqlite3.h:6690:35 */
type sqlite3_vtab_cursor1 = struct{ pVtab uintptr }
type sqlite3_index_info = sqlite3_index_info1 /* sqlite3.h:6690:35 */
type sqlite3_vtab_cursor1 = struct{ pVtab uintptr } /* sqlite3.h:6691:9 */
type sqlite3_vtab_cursor = sqlite3_vtab_cursor1 /* sqlite3.h:6691:36 */
type sqlite3_module1 = struct {
@ -1493,7 +1493,7 @@ type sqlite3_module1 = struct {
xRelease uintptr
xRollbackTo uintptr
xShadowName uintptr
}
} /* sqlite3.h:6689:9 */
type sqlite3_module = sqlite3_module1 /* sqlite3.h:6692:31 */
@ -1602,7 +1602,7 @@ type sqlite3_index_constraint = struct {
op uint8
usable uint8
iTermOffset int32
}
} /* sqlite3.h:6690:9 */
// CAPI3REF: Virtual Table Indexing Information
// KEYWORDS: sqlite3_index_info
@ -1708,7 +1708,7 @@ type sqlite3_index_orderby = struct {
iColumn int32
desc uint8
_ [3]byte
}
} /* sqlite3.h:6690:9 */
// CAPI3REF: Virtual Table Indexing Information
// KEYWORDS: sqlite3_index_info
@ -1814,7 +1814,7 @@ type sqlite3_index_constraint_usage = struct {
argvIndex int32
omit uint8
_ [3]byte
}
} /* sqlite3.h:6690:9 */
// CAPI3REF: Mutex Methods Object
//
@ -1889,7 +1889,7 @@ type sqlite3_mutex_methods1 = struct {
xMutexLeave uintptr
xMutexHeld uintptr
xMutexNotheld uintptr
}
} /* sqlite3.h:7524:9 */
// CAPI3REF: Mutex Methods Object
//
@ -1967,7 +1967,7 @@ type sqlite3_mutex_methods = sqlite3_mutex_methods1 /* sqlite3.h:7524:38 */
type sqlite3_pcache_page1 = struct {
pBuf uintptr
pExtra uintptr
}
} /* sqlite3.h:8277:9 */
// CAPI3REF: Custom Page Cache Object
//
@ -2150,7 +2150,7 @@ type sqlite3_pcache_methods21 = struct {
xTruncate uintptr
xDestroy uintptr
xShrink uintptr
}
} /* sqlite3.h:8442:9 */
// CAPI3REF: Application Defined Page Cache.
// KEYWORDS: {page cache}
@ -2326,7 +2326,7 @@ type sqlite3_pcache_methods1 = struct {
xRekey uintptr
xTruncate uintptr
xDestroy uintptr
}
} /* sqlite3.h:8465:9 */
// This is the obsolete pcache_methods object that has now been replaced
// by sqlite3_pcache_methods2. This object is not used by SQLite. It is
@ -2351,7 +2351,7 @@ type sqlite3_pcache_methods = sqlite3_pcache_methods1 /* sqlite3.h:8465:39 */
// version of the database file so that it is possible to later open a new read
// transaction that sees that historical version of the database rather than
// the most recent version.
type sqlite3_snapshot1 = struct{ hidden [48]uint8 }
type sqlite3_snapshot1 = struct{ hidden [48]uint8 } /* sqlite3.h:9512:9 */
// CAPI3REF: Database Snapshot
// KEYWORDS: {snapshot} {sqlite3_snapshot}
@ -2414,7 +2414,7 @@ type sqlite3_rtree_geometry1 = struct {
aParam uintptr
pUser uintptr
xDelUser uintptr
}
} /* sqlite3.h:9839:9 */
// CAPI3REF: Flags for sqlite3_deserialize()
//
@ -2469,7 +2469,7 @@ type sqlite3_rtree_query_info1 = struct {
eWithin int32
rScore sqlite3_rtree_dbl
apSqlParam uintptr
}
} /* sqlite3.h:9840:9 */
type sqlite3_rtree_query_info = sqlite3_rtree_query_info1 /* sqlite3.h:9840:41 */
@ -2529,7 +2529,7 @@ type Fts5ExtensionApi1 = struct {
xPhraseNext uintptr
xPhraseFirstColumn uintptr
xPhraseNextColumn uintptr
}
} /* sqlite3.h:11634:9 */
// Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.
@ -2566,7 +2566,7 @@ type Fts5ExtensionApi = Fts5ExtensionApi1 /* sqlite3.h:11634:33 */
type Fts5PhraseIter1 = struct {
a uintptr
b uintptr
}
} /* sqlite3.h:11636:9 */
type Fts5PhraseIter = Fts5PhraseIter1 /* sqlite3.h:11636:31 */
@ -2575,7 +2575,7 @@ type fts5_tokenizer1 = struct {
xCreate uintptr
xDelete uintptr
xTokenize uintptr
}
} /* sqlite3.h:12097:9 */
type fts5_tokenizer = fts5_tokenizer1 /* sqlite3.h:12097:31 */
@ -2596,7 +2596,7 @@ type fts5_api1 = struct {
xCreateTokenizer uintptr
xFindTokenizer uintptr
xCreateFunction uintptr
}
} /* sqlite3.h:12133:9 */
// Flags that may be passed as the third argument to xTokenize()
@ -2621,7 +2621,7 @@ type _G_fpos_t = struct {
__count int32
__value struct{ __wch uint32 }
}
}
} /* __fpos_t.h:10:9 */
// bits/types.h -- definitions of __*_t types underlying *_t types.
// Copyright (C) 2002-2018 Free Software Foundation, Inc.
@ -2652,7 +2652,7 @@ type _G_fpos64_t = struct {
__count int32
__value struct{ __wch uint32 }
}
}
} /* __fpos64_t.h:10:9 */
type _IO_FILE = struct {
_flags int32
@ -2684,7 +2684,7 @@ type _IO_FILE = struct {
__pad5 size_t
_mode int32
_unused2 [20]int8
}
} /* __FILE.h:4:1 */
// The opaque type of streams. This is the definition used elsewhere.
type FILE = _IO_FILE /* FILE.h:7:25 */
@ -2718,12 +2718,14 @@ type FILE = _IO_FILE /* FILE.h:7:25 */
// ISO C Standard: 7.15 Variable arguments <stdarg.h>
type off_t = int64 /* stdio.h:63:17 */
type off_t = int64 /* stdio.h:65:19 */
type off64_t = int64 /* stdio.h:70:19 */
type ssize_t = int64 /* stdio.h:77:19 */
// The type of the second argument to `fgetpos' and `fsetpos'.
type fpos_t = _G_fpos_t /* stdio.h:84:18 */
type fpos_t = _G_fpos64_t /* stdio.h:86:20 */
type fpos64_t = _G_fpos64_t /* stdio.h:89:20 */
// In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
// are already defined.
@ -2845,7 +2847,8 @@ type u_quad_t = uint64 /* types.h:38:20 */
type fsid_t = struct{ __val [2]int32 } /* types.h:39:18 */
type loff_t = int64 /* types.h:42:18 */
type ino_t = uint64 /* types.h:47:17 */
type ino_t = uint64 /* types.h:49:19 */
type ino64_t = uint64 /* types.h:54:19 */
type dev_t = uint64 /* types.h:59:17 */
@ -3128,7 +3131,7 @@ type sigset_t = struct{ __val [16]uint64 } /* sigset_t.h:7:20 */
type timeval = struct {
tv_sec int64
tv_usec int64
}
} /* struct_timeval.h:8:1 */
// NB: Include guard matches what <linux/time.h> uses.
@ -3157,7 +3160,7 @@ type timeval = struct {
type timespec = struct {
tv_sec int64
tv_nsec int64
}
} /* struct_timespec.h:9:1 */
type suseconds_t = int64 /* select.h:43:23 */
@ -3177,9 +3180,13 @@ type fd_mask = int64 /* select.h:77:19 */
type blksize_t = int64 /* types.h:202:21 */
// Types from the Large File Support interface.
type blkcnt_t = int64 /* types.h:209:20 */ // Type to count number of disk blocks.
type fsblkcnt_t = uint64 /* types.h:213:22 */ // Type to count file system blocks.
type fsfilcnt_t = uint64 /* types.h:217:22 */ // Type to count file system inodes.
type blkcnt_t = int64 /* types.h:222:22 */ // Type to count number of disk blocks.
type fsblkcnt_t = uint64 /* types.h:226:24 */ // Type to count file system blocks.
type fsfilcnt_t = uint64 /* types.h:230:24 */ // Type to count file system inodes.
type blkcnt64_t = int64 /* types.h:236:22 */ // Type to count number of disk blocks.
type fsblkcnt64_t = uint64 /* types.h:237:24 */ // Type to count file system blocks.
type fsfilcnt64_t = uint64 /* types.h:238:24 */ // Type to count file system inodes.
// Now add the thread types.
// Declaration of common pthread types for all architectures.
@ -3311,14 +3318,14 @@ type __pthread_rwlock_arch_t = struct {
__pad2 uint64
__flags uint32
_ [4]byte
}
} /* pthreadtypes-arch.h:65:1 */
// Common definition of pthread_mutex_t.
type __pthread_internal_list = struct {
__prev uintptr
__next uintptr
}
} /* thread-shared-types.h:82:9 */
// Lock elision support.
@ -3334,7 +3341,7 @@ type __pthread_mutex_s = struct {
__prev uintptr
__next uintptr
}
}
} /* thread-shared-types.h:118:1 */
// Common definition of pthread_cond_t.
@ -3346,7 +3353,7 @@ type __pthread_cond_s = struct {
__g1_orig_size uint32
__wrefs uint32
__g_signals [2]uint32
}
} /* thread-shared-types.h:171:1 */
// Thread identifiers. The structure of the attribute type is not
// exposed on purpose.
@ -3375,7 +3382,7 @@ type pthread_once_t = int32 /* pthreadtypes.h:53:30 */
type pthread_attr_t1 = struct {
_ [0]uint64
__size [56]int8
}
} /* pthreadtypes.h:56:1 */
type pthread_attr_t = pthread_attr_t1 /* pthreadtypes.h:62:30 */
@ -3419,7 +3426,7 @@ type random_data = struct {
rand_deg int32
rand_sep int32
end_ptr uintptr
}
} /* stdlib.h:423:1 */
// Data structure for communication with thread safe versions. This
// type is to be regarded as opaque. It's only exported because users
@ -3430,7 +3437,7 @@ type drand48_data = struct {
__c uint16
__init uint16
__a uint64
}
} /* stdlib.h:490:1 */
// POSIX.1-2008 extended locale interface (see locale.h).
// Definition of locale_t.
@ -3481,7 +3488,7 @@ type __locale_struct = struct {
__ctype_tolower uintptr
__ctype_toupper uintptr
__names [13]uintptr
}
} /* __locale_t.h:28:1 */
type locale_t = uintptr /* locale_t.h:24:20 */
@ -3948,7 +3955,7 @@ type HashContext1 = struct {
j uint8
s [256]uint8
r [32]uint8
}
} /* speedtest1.c:71:9 */
// State structure for a Hash hash in progress
type HashContext = HashContext1 /* speedtest1.c:71:28 */
@ -3980,7 +3987,7 @@ type Global = struct {
hashFile uintptr
hash HashContext
_ [5]byte
}
} /* speedtest1.c:81:8 */
// All global state is held in this structure
var g Global /* speedtest1.c:107:3: */
@ -5671,7 +5678,7 @@ func displayLinuxIoStats(tls *libc.TLS, out uintptr) { /* speedtest1.c:2102:13:
// var z [200]int8 at bp+24, 200
sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+24 /* &z[0] */, ts+22712 /* "/proc/%d/io" */, libc.VaList(bp, libc.Xgetpid(tls)))
in = libc.Xfopen(tls, bp+24 /* &z[0] */, ts+22724 /* "rb" */)
in = libc.Xfopen64(tls, bp+24 /* &z[0] */, ts+22724 /* "rb" */)
if in == uintptr(0) {
return
}
@ -5830,7 +5837,7 @@ func main1(tls *libc.TLS, argc int32, argv uintptr) int32 { /* speedtest1.c:2143
if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), ts+23256 /* "-" */) == 0 {
g.hashFile = libc.Xstdout
} else {
g.hashFile = libc.Xfopen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), ts+23258 /* "wb" */)
g.hashFile = libc.Xfopen64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), ts+23258 /* "wb" */)
if g.hashFile == uintptr(0) {
fatal_error(tls, ts+23261 /* "cannot open \"%s\"..." */, libc.VaList(bp+80, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))))
}

@ -27,6 +27,13 @@ var (
func TestTclTest(t *testing.T) {
blacklist := map[string]struct{}{}
switch runtime.GOARCH {
case "386":
// # This test causes thrashing on machines with smaller amounts of
// # memory. Make sure the host has at least 8GB available before running
// # this test.
blacklist["bigsort.test"] = struct{}{}
}
m, err := filepath.Glob(filepath.FromSlash("testdata/tcl/*"))
if err != nil {
t.Fatal(err)

@ -0,0 +1,12 @@
$ make extraquick
SQLite 2020-08-14 13:23:32 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
0 errors out of 210749 tests on devuan3-386 Linux 32-bit little-endian
WARNING: Multi-threaded tests skipped: Linked against a non-threadsafe Tcl build
All memory allocations freed - no leaks
Maximum memory usage: 9145368 bytes
Current memory usage: 0 bytes
Number of malloc() : -1 calls
--- PASS: TestTclTest (148.02s)
PASS
ok modernc.org/sqlite 148.027s

@ -0,0 +1,11 @@
SQLite 2020-08-14 13:23:32 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
0 errors out of 927881 tests on 3900x Linux 32-bit little-endian
WARNING: Multi-threaded tests skipped: Linked against a non-threadsafe Tcl build
All memory allocations freed - no leaks
Maximum memory usage: 9145368 bytes
Current memory usage: 0 bytes
Number of malloc() : -1 calls
--- PASS: TestTclTest (1610.02s)
PASS
ok modernc.org/sqlite 1641.582s

@ -7,6 +7,6 @@ All memory allocations freed - no leaks
Maximum memory usage: 9156360 bytes
Current memory usage: 0 bytes
Number of malloc() : -1 calls
--- PASS: TestTclTest (141.36s)
--- PASS: TestTclTest (141.05s)
PASS
ok modernc.org/sqlite 141.361s
ok modernc.org/sqlite 141.055s

@ -1,12 +1,10 @@
$ make full
SQLite 2020-08-14 13:23:32 fca8dc8b578f215a969cd899336378966156154710873e68b3d9ac5881b0ff3f
0 errors out of 928250 tests on 3900x Linux 64-bit little-endian
0 errors out of 928256 tests on 3900x Linux 64-bit little-endian
WARNING: Multi-threaded tests skipped: Linked against a non-threadsafe Tcl build
All memory allocations freed - no leaks
Maximum memory usage: 9156360 bytes
Current memory usage: 0 bytes
Number of malloc() : -1 calls
--- PASS: TestTclTest (1753.56s)
--- PASS: TestTclTest (1576.09s)
PASS
ok modernc.org/sqlite 1753.561s
ok modernc.org/sqlite 1602.667s