Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile/internal/syntax: test failure without -short #17697

Closed
josharian opened this issue Oct 31, 2016 · 16 comments
Closed

cmd/compile/internal/syntax: test failure without -short #17697

josharian opened this issue Oct 31, 2016 · 16 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@josharian
Copy link
Contributor

Broken out from #17472.

go test -timeout=1h cmd/compile/internal/syntax

Results in a giant parser dump followed by:

panic: 28: syntax error: unexpected literal 0, expecting name


goroutine 9 [running]:
panic(0x110f7c0, 0xc42062d6f0)
	/Users/josh/go/tip/src/runtime/panic.go:531 +0x1cf
cmd/compile/internal/syntax.(*parser).init.func1(0x224, 0x1c, 0xc420637b80, 0x32)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:38 +0x1b9
cmd/compile/internal/syntax.(*source).error_at(0xc42063f900, 0x224, 0x1c, 0xc420637b80, 0x32)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/source.go:54 +0x78
cmd/compile/internal/syntax.(*parser).syntax_error_at(0xc42063f900, 0x224, 0x1c, 0xc4200f78b8, 0x10)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:113 +0x11d
cmd/compile/internal/syntax.(*parser).syntax_error(0xc42063f900, 0x113db98, 0xe)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:68 +0x59
cmd/compile/internal/syntax.(*parser).name(0xc42063f900, 0xc420637b40)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:2084 +0xf9
cmd/compile/internal/syntax.(*parser).aliasDecl(0xc42063f900, 0x1a, 0xc4206428c0, 0x0, 0xc42062d6c7, 0x1)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:329 +0x84
cmd/compile/internal/syntax.(*parser).constDecl(0xc42063f900, 0x0, 0x0, 0x0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:343 +0x255
cmd/compile/internal/syntax.(*parser).(cmd/compile/internal/syntax.constDecl)-fm(0x0, 0xc, 0xc4200f7a00)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:223 +0x34
cmd/compile/internal/syntax.(*parser).appendGroup(0xc42063f900, 0xc42063a400, 0x8, 0x8, 0xc4200f7b80, 0xc42063a400, 0x8, 0x8)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:286 +0x2a9
cmd/compile/internal/syntax.(*parser).file(0xc42063f900, 0x0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser.go:223 +0x617
cmd/compile/internal/syntax.Read(0x11dc440, 0xc4203ee588, 0x0, 0x0, 0x0, 0xc4200f7cd0, 0x1, 0x10f5066)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/syntax.go:60 +0x88
cmd/compile/internal/syntax.ReadFile(0xc4205f1380, 0x21, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/syntax.go:35 +0xd3
cmd/compile/internal/syntax.TestStdLib.func1.1(0xc4205f1380, 0x21)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser_test.go:55 +0x7a
cmd/compile/internal/syntax.walkDirs(0xc4200883c0, 0xc42025a6a0, 0x17, 0xc42024bf00)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser_test.go:120 +0x63e
cmd/compile/internal/syntax.walkDirs(0xc4200883c0, 0x113e6f2, 0x12, 0xc42024bf00)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser_test.go:125 +0x6b9
cmd/compile/internal/syntax.TestStdLib.func1(0xc4200883c0, 0xc420237740)
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser_test.go:63 +0xf1
created by cmd/compile/internal/syntax.TestStdLib
	/Users/josh/go/tip/src/cmd/compile/internal/syntax/parser_test.go:66 +0x105
FAIL	cmd/compile/internal/syntax	23.847s

cc @mdempsky @griesemer

@josharian josharian added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 31, 2016
@josharian josharian added this to the Go1.8 milestone Oct 31, 2016
@griesemer griesemer self-assigned this Oct 31, 2016
@griesemer
Copy link
Contributor

Cannot reproduce with the command-line above. However, in syntax directory:

$ go test -run Parse -src=/Users/gri/go/test/alias2.go 
--- FAIL: TestParse (0.00s)
panic: 28: syntax error: unexpected literal 0, expecting name
 [recovered]
    panic: 28: syntax error: unexpected literal 0, expecting name


goroutine 5 [running]:
panic(0x110f9c0, 0xc420010560)
    /Users/gri/go/src/runtime/panic.go:531 +0x1cf
testing.tRunner.func1(0xc4200980c0)
    /Users/gri/go/src/testing/testing.go:605 +0x287
panic(0x110f9c0, 0xc420010560)
    /Users/gri/go/src/runtime/panic.go:489 +0x2d3
cmd/compile/internal/syntax.(*parser).init.func1(0x224, 0x1c, 0xc420012940, 0x32)
    /Users/gri/go/src/cmd/compile/internal/syntax/parser.go:38 +0x1b9
cmd/compile/internal/syntax.(*source).error_at(0xc420021900, 0x224, 0x1c, 0xc420012940, 0x32)
    /Users/gri/go/src/cmd/compile/internal/syntax/source.go:54 +0x78
cmd/compile/internal/syntax.(*parser).syntax_error_at(0xc420021900, 0x224, 0x1c, 0xc420044b98, 0x10)
    /Users/gri/go/src/cmd/compile/internal/syntax/parser.go:113 +0x11d
cmd/compile/internal/syntax.(*parser).syntax_error(0xc420021900, 0x113dda0, 0xe)
    /Users/gri/go/src/cmd/compile/internal/syntax/parser.go:68 +0x59
cmd/compile/internal/syntax.(*parser).name(0xc420021900, 0xc420012900)
    /Users/gri/go/src/cmd/compile/internal/syntax/parser.go:2084 +0xf9
cmd/compile/internal/syntax.(*parser).aliasDecl(0xc420021900, 0x1a, 0xc42000e320, 0x0, 0xc420010537, 0x1)
    /Users/gri/go/src/cmd/compile/internal/syntax/parser.go:329 +0x84
cmd/compile/internal/syntax.(*parser).constDecl(0xc420021900, 0x0, 0x0, 0x0)
    /Users/gri/go/src/cmd/compile/internal/syntax/parser.go:343 +0x255
cmd/compile/internal/syntax.(*parser).(cmd/compile/internal/syntax.constDecl)-fm(0x0, 0xc, 0xc420044d00)
    /Users/gri/go/src/cmd/compile/internal/syntax/parser.go:223 +0x34
cmd/compile/internal/syntax.(*parser).appendGroup(0xc420021900, 0xc42009a000, 0x8, 0x8, 0xc420044e60, 0xc42009a000, 0x8, 0x8)
    /Users/gri/go/src/cmd/compile/internal/syntax/parser.go:286 +0x2a9
cmd/compile/internal/syntax.(*parser).file(0xc420021900, 0x0)
    /Users/gri/go/src/cmd/compile/internal/syntax/parser.go:223 +0x617
cmd/compile/internal/syntax.Read(0x11dc440, 0xc42002c030, 0x0, 0x0, 0x0, 0xc420018000, 0x0, 0x0)
    /Users/gri/go/src/cmd/compile/internal/syntax/syntax.go:60 +0x88
cmd/compile/internal/syntax.ReadFile(0x7fff5fbffc86, 0x1c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/gri/go/src/cmd/compile/internal/syntax/syntax.go:35 +0xd3
cmd/compile/internal/syntax.TestParse(0xc4200980c0)
    /Users/gri/go/src/cmd/compile/internal/syntax/parser_test.go:25 +0x58
testing.tRunner(0xc4200980c0, 0x1145088)
    /Users/gri/go/src/testing/testing.go:639 +0x85
created by testing.(*T).Run
    /Users/gri/go/src/testing/testing.go:676 +0x2c4
FAIL    cmd/compile/internal/syntax 0.021s

which is the same error. The panic happens because there's no error handler installed and we do expect an error. CL forthcoming (probably tomorrow).

@gopherbot
Copy link

CL https://golang.org/cl/32456 mentions this issue.

@josharian
Copy link
Contributor Author

I now see this:

$ cd cmd/compile/internal/syntax
$ go test
... giant syntax tree dump elided ...
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
testing.(*T).Run(0xc420096000, 0x113e20f, 0xa, 0x1146160, 0x1052d01)
    /Users/josh/go/tip/src/testing/testing.go:684 +0x2ee
testing.runTests.func1(0xc420096000)
    /Users/josh/go/tip/src/testing/testing.go:839 +0x67
testing.tRunner(0xc420096000, 0xc420041e30)
    /Users/josh/go/tip/src/testing/testing.go:646 +0x85
testing.runTests(0x11461e8, 0x11f0560, 0x8, 0x8, 0x113d1fb)
    /Users/josh/go/tip/src/testing/testing.go:845 +0x29d
testing.(*M).Run(0xc420266f28, 0x0)
    /Users/josh/go/tip/src/testing/testing.go:780 +0x90
main.main()
    cmd/compile/internal/syntax/_test/_testmain.go:68 +0xc6

goroutine 21 [chan receive]:
cmd/compile/internal/syntax.TestStdLib(0xc4200963c0)
    /Users/josh/go/tip/src/cmd/compile/internal/syntax/parser_test.go:69 +0x162
testing.tRunner(0xc4200963c0, 0x1146160)
    /Users/josh/go/tip/src/testing/testing.go:646 +0x85
created by testing.(*T).Run
    /Users/josh/go/tip/src/testing/testing.go:683 +0x2c4
FAIL    cmd/compile/internal/syntax 1.866s

@josharian josharian reopened this Nov 1, 2016
@griesemer
Copy link
Contributor

@josharian I cannot reproduce this on tip. Anything unusual about your system?

@josharian
Copy link
Contributor Author

I can still reproduce. Nothing unusual that I know of.

$ git rev-parse HEAD
d89ab1398eef9a3f08db2a49ff3cbe158001474d
$ ./make.bash
... ok ...
$ cd cmd/compile/internal/syntax
$ go test
... same result ...
$ go version
go version devel darwin/amd64
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/josh"
GORACE=""
GOROOT="/Users/josh/go/tip"
GOTOOLDIR="/Users/josh/go/tip/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/pp/0010hzld5b12h_92j5th082r0000gn/T/go-build036093094=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

@josharian
Copy link
Contributor Author

Hold on, will send a CL.

@josharian
Copy link
Contributor Author

CL 32486 fixes the deadlock. After that CL, I see test failures. Please let me know whether you can reproduce.

@gopherbot
Copy link

CL https://golang.org/cl/32486 mentions this issue.

gopherbot pushed a commit that referenced this issue Nov 1, 2016
When the err from ReadFile is non-nil, we call t.Fatal(err).
Switch t.Fatal to t.Error + return.
ensure that close(results) happens on that code path as well.

Updates #17697.

Change-Id: Ifaacf27a76c175446d642086ff32f4386428080d
Reviewed-on: https://go-review.googlesource.com/32486
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@josharian
Copy link
Contributor Author

Ok, Robert, hopefully you can now reproduce a regular test failure in cmd/compile/internal/syntax.

@griesemer
Copy link
Contributor

@josharian Just sync'ed and rebuilt. Don't see any test failures. Do you have files in your tree that I might not have? TestStdLib runs through any .go files it finds.

@josharian
Copy link
Contributor Author

Nope.

$ git clean -n
$

Adding some logging shows the test failure coming from test/alias2.go.

@griesemer
Copy link
Contributor

Ah, ok. Not sure why I don't see it f not run explicitly. Will investigate.

$ go test -run Parse -src $GOROOT/test/alias2.go 
--- FAIL: TestParse (0.03s)
    parser_test.go:27: 28: syntax error: unexpected literal 0, expecting name

@griesemer
Copy link
Contributor

PS: The syntax failure is correctly reported. I should either exclude that file or not have a syntax error in that file.

@griesemer
Copy link
Contributor

@josharian Is your $GOROOT directory where you run the tests called something else than "go"? (which is perfectly fine, I'm just trying to verify my hypothesis).

@gopherbot
Copy link

CL https://golang.org/cl/32539 mentions this issue.

@josharian
Copy link
Contributor Author

Is your $GOROOT directory where you run the tests called something else than "go"?

Yes: ~/go/tip. I also have ~/go/17, etc. for all the releases. And the tests now pass. Hypothesis confirmed. Sorry for the delayed response.

@golang golang locked and limited conversation to collaborators Nov 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants