Commit 14b65436 authored by Dave Cheney's avatar Dave Cheney

go/types: add more logging to gc import test

* Extended deadline to 30 seconds
* Added logging of the duration of each package import
* Fail the test immediately if directories cannot be read

R=gri, minux.ma
CC=golang-dev
https://golang.org/cl/7030055
parent 699b99fa
...@@ -54,21 +54,23 @@ func compile(t *testing.T, dirname, filename string) string { ...@@ -54,21 +54,23 @@ func compile(t *testing.T, dirname, filename string) string {
var imports = make(map[string]*ast.Object) var imports = make(map[string]*ast.Object)
func testPath(t *testing.T, path string) bool { func testPath(t *testing.T, path string) bool {
t0 := time.Now()
_, err := GcImport(imports, path) _, err := GcImport(imports, path)
if err != nil { if err != nil {
t.Errorf("testPath(%s): %s", path, err) t.Errorf("testPath(%s): %s", path, err)
return false return false
} }
t.Logf("testPath(%s): %v", path, time.Since(t0))
return true return true
} }
const maxTime = 3 * time.Second const maxTime = 30 * time.Second
func testDir(t *testing.T, dir string, endTime time.Time) (nimports int) { func testDir(t *testing.T, dir string, endTime time.Time) (nimports int) {
dirname := filepath.Join(runtime.GOROOT(), "pkg", runtime.GOOS+"_"+runtime.GOARCH, dir) dirname := filepath.Join(runtime.GOROOT(), "pkg", runtime.GOOS+"_"+runtime.GOARCH, dir)
list, err := ioutil.ReadDir(dirname) list, err := ioutil.ReadDir(dirname)
if err != nil { if err != nil {
t.Errorf("testDir(%s): %s", dirname, err) t.Fatalf("testDir(%s): %s", dirname, err)
} }
for _, f := range list { for _, f := range list {
if time.Now().After(endTime) { if time.Now().After(endTime) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment