Skip to content

go test fails with go1.5 #232

Closed
Closed
@rovaughn

Description

@rovaughn

I'm curious if this is happening to anyone else.

I built go1.5 from source, bootstrapping with go1.4. When I run go test -short using go1.5, I get the following output.

--- FAIL: TestPreparedStmt (0.00s)
    sqltest.go:287: Query: no such table: t
    sqltest.go:287: Query: no such table: t
    sqltest.go:287: Query: no such table: t
    sqltest.go:287: Query: no such table: t
    sqltest.go:287: Query: no such table: t
    sqltest.go:291: Insert: no such table: t
    sqltest.go:287: Query: no such table: t
    sqltest.go:287: Query: no such table: t
    sqltest.go:287: Query: no such table: t
    sqltest.go:287: Query: no such table: t
PASS
ok      github.com/mattn/go-sqlite3 16.116s

It works fine when I use go1.4 though.

The failing test is in sqlite3_test/sqltest.go. If I remove the concurrency by changing it like so:

278d277
<   ch := make(chan bool)
280,293c279,283
<       go func() {
<           defer func() {
<               ch <- true
<           }()
<           for j := 0; j < 10; j++ {
<               count := 0
<               if err := sel.QueryRow().Scan(&count); err != nil && err != sql.ErrNoRows {
<                   t.Errorf("Query: %v", err)
<                   return
<               }
<               if _, err := ins.Exec(rand.Intn(100)); err != nil {
<                   t.Errorf("Insert: %v", err)
<                   return
<               }

---
>       for j := 0; j < 10; j++ {
>           count := 0
>           if err := sel.QueryRow().Scan(&count); err != nil && err != sql.ErrNoRows {
>               t.Errorf("Query: %v", err)
>               return
295,298c285,289
<       }()
<   }
<   for i := 0; i < nRuns; i++ {
<       <-ch

---
>           if _, err := ins.Exec(rand.Intn(100)); err != nil {
>               t.Errorf("Insert: %v", err)
>               return
>           }
>       }

It works just fine, which implies it's thread safety related. Perhaps https://golang.org/doc/go1.5#runtime could've affected it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions