-
Notifications
You must be signed in to change notification settings - Fork 1
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
Test fixes #9
Test fixes #9
Conversation
willfaught
commented
May 27, 2016
- Fix various tests
- Minor (accidental) clean up
- Change import paths from antlr/antlr4 to pboyer/antlr4 to ease testing
Also minor formatting.
Also: - Change "antlr4" imports to "github.com/antlr/antlr4/runtime/Go/antlr" - Remove parser prefix from Property and pred calls - Change TParser.X tokens to TParserX
@@ -391,7 +391,7 @@ public String execModule(String fileName) { | |||
ProcessBuilder builder = new ProcessBuilder(goPath, "run", modulePath, | |||
inputPath); | |||
builder.environment().put("GOPATH", | |||
runtimePath + File.pathSeparator + tmpdir); | |||
builder.environment().get("GOPATH") + ":" + runtimePath + File.pathSeparator + tmpdir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if this environment variable is not defined? Is it possible we could throw a more verbose message or try something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I'm not familiar with the API, I actually guessed there's a get
method based on the use of the put
method. Open to suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And also things stopped breaking after the change. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also just occurred to me that :
isn't cross-platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$GOPATH
ends up as :<runtimePath>:<tmpdir>
(I guess), i.e. the first element is the empty string. Go freaks out with an error message along the lines of "GOPATH needs to be absolute, but this is relative" (or something).
Edit: exec stderrVacuum: go: GOPATH entry is relative; must be absolute path: "null".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an empty path element defaults to the current directory. Working on a fix to avoid that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I was wrong with empty path, instead it becomes literal string null
.
Thanks @willfaught! Just one comment and lgtm. |
This still seems to not work for some reason, just wanted to put up what I was thinking. This produces a GOPATH of (Updated) |
It doesn't work because of our go import path. Peter's old system used Now we use a complete import path, such that we have to put the whole repository under our As of now I am happy with that, but we need a better idea. :) |
Whoops, misread the Javadoc. Using File.pathSeparator worked. |
Can you give more detail? When/where are these builds happening with GOPATH unset? |
One example, when a build w/o GOPATH happens is travis (see also #12), or whenever a non-go-developer tries this at home. This is an example error:
|
Not sure what |
The tests use readers ( The spot where you did the My take is, this is a problem that needs to be addressed, but it is not related to this PR. It just became apparent at this point. |
Ah, I think I see the issue. Basically, for all users, we can't ensure the repo appears in a structure like .../src/github.com/antlr/antlr4 such that we can just set GOPATH=... I think it's reasonable that if you want to compile/test the Go target, you need Go installed and configured correctly. I wouldn't expect the C# target to work if I didn't have it installed. |
Yes, that's right. Having go installed is not enough. It's also mandatory that the the git checkout is already inside a go-eligible directory. I think that is a hurdle that we should remove somehow. At least I have no idea how this could work with travis otherwise. |
In the case of Travis, we can set GOPATH to a temporary directory then go get the antlr4 repo. Or symlink the existing runtime lib into it.
|
Update DefaultErrorStrategy.cpp