mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 23:00:58 +00:00
Merge pull request #1282 from syncthing/integ
Improvements to integration tests
This commit is contained in:
commit
d18c4ece0c
3
build.sh
3
build.sh
@ -3,6 +3,7 @@ set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
DOCKERIMGV=1.4.1-1
|
||||
STTRACE=${STTRACE:-}
|
||||
|
||||
case "${1:-default}" in
|
||||
default)
|
||||
@ -110,6 +111,7 @@ case "${1:-default}" in
|
||||
docker run --rm -h syncthing-builder -u $(id -u) -t \
|
||||
-v $(pwd):/go/src/github.com/syncthing/syncthing \
|
||||
-w /go/src/github.com/syncthing/syncthing \
|
||||
-e "STTRACE=$STTRACE" \
|
||||
syncthing/build:$DOCKERIMGV \
|
||||
sh -c './build.sh clean \
|
||||
&& go vet ./cmd/... ./internal/... \
|
||||
@ -122,6 +124,7 @@ case "${1:-default}" in
|
||||
docker run --rm -h syncthing-builder -u $(id -u) -t \
|
||||
-v $(pwd):/go/src/github.com/syncthing/syncthing \
|
||||
-w /go/src/github.com/syncthing/syncthing \
|
||||
-e "STTRACE=$STTRACE" \
|
||||
syncthing/build:$DOCKERIMGV \
|
||||
sh -euxc './build.sh clean \
|
||||
&& go run build.go -race \
|
||||
|
1
test/logs/.gitignore
vendored
Normal file
1
test/logs/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.out
|
@ -50,7 +50,7 @@ type syncthingProcess struct {
|
||||
|
||||
func (p *syncthingProcess) start() error {
|
||||
if p.logfd == nil {
|
||||
logfd, err := os.Create(p.instance + ".out")
|
||||
logfd, err := os.Create("logs/" + getTestName() + "-" + p.instance + ".out")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
19
test/util.go
19
test/util.go
@ -27,6 +27,7 @@ import (
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@ -441,3 +442,21 @@ func isTimeout(err error) bool {
|
||||
return strings.Contains(err.Error(), "use of closed network connection") ||
|
||||
strings.Contains(err.Error(), "request cancelled while waiting")
|
||||
}
|
||||
|
||||
func getTestName() string {
|
||||
callers := make([]uintptr, 100)
|
||||
runtime.Callers(1, callers)
|
||||
for i, caller := range callers {
|
||||
f := runtime.FuncForPC(caller)
|
||||
if f != nil {
|
||||
if f.Name() == "testing.tRunner" {
|
||||
testf := runtime.FuncForPC(callers[i-1])
|
||||
if testf != nil {
|
||||
path := strings.Split(testf.Name(), ".")
|
||||
return path[len(path)-1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return time.Now().String()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user