Skip to content

TestRawInput() failed frequently. #36

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

Open
alanjds opened this issue Aug 21, 2018 · 2 comments
Open

TestRawInput() failed frequently. #36

alanjds opened this issue Aug 21, 2018 · 2 comments
Labels
imported Imported from google/grumpy

Comments

@alanjds
Copy link

alanjds commented Aug 21, 2018

google#282 opened by @corona10 on 5 Apr 2017

TestRawInput looks like have a significant issue.
Sometimes I can reproduce on my local environment.

--- FAIL: TestRawInput (0.00s)
	builtin_types_test.go:522: func1('HelloGrumpy\n', '') raised EOFError('EOF when reading a line',), want <nil>
Exception: foo
@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by trotterdylan
Thursday Apr 06, 2017 at 14:40 GMT


I worked on this for a little while but haven't yet figured out the problem. I was able to reproduce it more reliably if my machine was under load, e.g. by running tests in parallel.

There's two issues. The first is that these lines need to handle EOF explicitly:

	line, err := Stdin.reader.ReadString('\n')
	if err != nil {
		return nil, f.RaiseType(EOFErrorType, "EOF when reading a line")
	}

Should be something like:

	line, err := Stdin.reader.ReadString('\n')
	if err != nil && err != io.EOF {
		return nil, f.RaiseType(IOErrorType, err.Error())
	}
        if line == "" {
                return nil, f.RaiseType(EOFErrorType, "EOF when reading a line")
        }

When you do this you find that the error is actually "bad file". So Stdin is getting closed or something in the mean time. But I couldn't figure out why.

@alanjds
Copy link
Author

alanjds commented Aug 21, 2018

Comment by trotterdylan
Friday Apr 07, 2017 at 14:15 GMT


The test seems to be failing a lot more frequently on Travis lately, so I commented out the test in google@a76caef until it's fixed.

@alanjds alanjds added the imported Imported from google/grumpy label Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported Imported from google/grumpy
Projects
None yet
Development

No branches or pull requests

1 participant