Skip to content

Commit 8eac686

Browse files
author
Mario L Gutierrez
committed
ensure test sets GOMAXPROCS
1 parent 1a548c7 commit 8eac686

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Gododir/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ package main
22

33
import (
44
"fmt"
5+
"runtime"
56

67
_ "github.com/lib/pq"
78
do "gopkg.in/godo.v2"
89
)
910

1011
func tasks(p *do.Project) {
12+
numCPU := runtime.NumCPU()
13+
1114
do.Env = `
1215
DAT_DRIVER=postgres
1316
DAT_DSN="dbname=dbr_test user=dbr password=!test host=localhost sslmode=disable"
@@ -18,8 +21,8 @@ func tasks(p *do.Project) {
1821
p.Task("createdb", nil, createdb).Description("Creates test database")
1922

2023
p.Task("test", nil, func(c *do.Context) {
21-
c.Run(`go test -race`)
22-
c.Run(`go test -race`, do.M{"$in": "sqlx-runner"})
24+
c.Run(`GOMAXPROCS={{.numCPU}} go test -race`, do.M{"numCPU": numCPU})
25+
c.Run(`GOMAXPROCS={{.numCPU}} go test -race`, do.M{"$in": "sqlx-runner", "numCPU": numCPU})
2326
}).Src("**/*.go").
2427
Desc("test with -race flag")
2528

0 commit comments

Comments
 (0)