-
Notifications
You must be signed in to change notification settings - Fork 0
Add proof of concept for T.Output() #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
Conversation
src/testing/testing.go
Outdated
return OutputWriter{c} | ||
} | ||
|
||
type OutputWriter struct { |
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.
unexport
src/testing/testing.go
Outdated
parent.mu.Lock() | ||
defer parent.mu.Unlock() | ||
if !parent.done { | ||
parent.output = append(parent.output, parent.decorate(str, depth+1)...) |
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.
This Write
method is at a lower level than logDepth. It isn't responsible for adding line info or a final newline, so it shouldn't call decorate
. It does need to handle indentation, though. I'm not sure where that happens.
f8a90ab
to
61379e3
Compare
Co-authored-by: Aleks Fazlieva <[email protected]>
Co-authored-by: Aleks Fazlieva <[email protected]>
Co-authored-by: Aleks Fazlieva <[email protected]>
Co-authored-by: Aleks Fazlieva <[email protected]>
3fc09b7
to
c949982
Compare
I took another careful look at this. I do think you're on the right track: outputWriter.Write should buffer lines, direct the output to the right place (this test, parent test, etc.) and prepend four spaces. Here is what I think needs to be done:
|
Co-authored-by: Aleks Fazlieva <[email protected]>
Co-authored-by: Aleks Fazlieva <[email protected]>
Co-authored-by: Aleks Fazlieva <[email protected]>
This reverts commit 7b0d211.
Co-authored-by: Aleks Fazlieva <[email protected]>
@jba thank you so much for the guidance. Doing this in two CLs, with the first one being a rewrite of the log/logDepth is a good idea. Since your message, we did the refactor and got tests working. Next steps are going to be cleaning up the code and moving to gerrit. We're aiming to get them done in the next couple of days. |
Sounds good. I'll hold off reviewing until it's on gerrit. |
Co-authored-by: Aleks Fazlieva <[email protected]>
b98c1b4
to
7648014
Compare
d865109
to
820826a
Compare
Co-authored-by: Aleks Fazlieva <[email protected]>
820826a
to
00014da
Compare
…of variable-sized makeslice CL 653856 enabled stack allocation of variable-sized makeslice results. This CL adds debug hashing of that change, plus a debug flag to control the byte threshold used. The debug hashing machinery means we also now have a way to disable just the CL 653856 optimization by doing -gcflags='all=-d=variablemakehash=n' or similar, though the stderr output will then typically have many lines of debug hash output. Using this CL plus the bisect command, I was able to retroactively find one of the lines of code responsible for golang#73199: $ bisect -compile=variablemake go test -skip TestListWireGuardDrivers [...] bisect: FOUND failing change set --- change set #1 (enabling changes causes failure) ./security_windows.go:1321:38 (variablemake) ./security_windows.go:1321:38 (variablemake) --- Previously, I had tracked down those lines by diffing '-gcflags=-m=1' output and brief code inspection, but seeing the bisect was very nice. This CL also adds a compiler debug flag to control the threshold for stack allocation of variably sized make results. This can help us identify more code that is relying on certain stack allocations. This might be a temporary flag that we delete prior to Go 1.25 (given we would not want people to rely on it), or maybe it might make sense to keep it for some period of time beyond the release of Go 1.25 to help the ecosystem shake out other bugs. Using these two flags together (and picking a threshold of 64 rather than the default of 32), it looks for example like this x/sys/windows code might be relying on stack allocation of a byte slice: $ bisect -compile=variablemake go test -gcflags=-d=variablemakethreshold=64 -skip TestListWireGuardDrivers [...] bisect: FOUND failing change set --- change set #1 (enabling changes causes failure) ./syscall_windows_test.go:1178:16 (variablemake) Updates golang#73199 Fixes golang#73253 Change-Id: I160179a0e3c148c3ea86be5c9b6cea8a52c3e5b7 Reviewed-on: https://go-review.googlesource.com/c/go/+/663795 Auto-Submit: Keith Randall <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
golang#73703 and golang#71575 are merged. |
Addresses https://go.dev/issue/59928