-
Notifications
You must be signed in to change notification settings - Fork 642
Make TestHttpsInsecure test reliably passing on Darwin. #171
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
TestHttpsInsecure test runs a profiling session and checks that the results contain expected function name. On OSX prior to 10.11 El Capitan the SIGPROF signal is delivered to the process rather than to the thread which skews the results enough for the test to fail. Relax the check when running on OSX and other operating systems known to have issues with the profiling signal (the list is taken from src/runtime/pprof/pprof_test.go in Go source). Also add the multiple variants of OSX to the continuous testing. Fixes google#146 and google#156.
Codecov Report
@@ Coverage Diff @@
## master #171 +/- ##
=======================================
Coverage 53.45% 53.45%
=======================================
Files 32 32
Lines 6181 6181
=======================================
Hits 3304 3304
Misses 2521 2521
Partials 356 356Continue to review full report at Codecov.
|
| deadline := time.Now().Add(5 * time.Second) | ||
| for time.Now().Before(deadline) { | ||
| // Simulate a hotspot function. | ||
| for i := 0; i < 1e8; i++ { |
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.
Why the empty loop? Doesn't the Go compiler remove it?
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 have added a comment. The purpose is to ensure the samples mostly land onto the loop. As far as I can tell Go compiler doesn't elide empty loops now.
@aalexand0:tmp$ cat test.go
package main
func main() {
for i := 0; i < 16; i++ {
}
}
@aalexand0:tmp$ go build test.go
@aalexand0:tmp$ objdump -d test | grep -A10 "<main.main>:"
00000000004511c0 <main.main>:
4511c0: 31 c0 xor %eax,%eax
4511c2: eb 03 jmp 4511c7 <main.main+0x7>
4511c4: 48 ff c0 inc %rax
4511c7: 48 83 f8 10 cmp $0x10,%rax
4511cb: 7c f7 jl 4511c4 <main.main+0x4>
4511cd: c3 retq
4511ce: cc int3
4511cf: cc int3
00000000004511d0 <main.init>:
* Make TestHttpsInsecure test reliably passing on Darwin. TestHttpsInsecure test runs a profiling session and checks that the results contain expected function name. On OSX prior to 10.11 El Capitan the SIGPROF signal is delivered to the process rather than to the thread which skews the results enough for the test to fail. Relax the check when running on OSX and other operating systems known to have issues with the profiling signal (the list is taken from src/runtime/pprof/pprof_test.go in Go source). Also add the multiple variants of OSX to the continuous testing. Fixes google#146 and google#156. * Document the motivation for the empty loop.
TestHttpsInsecure test runs a profiling session and checks that the
results contain expected function name. On OSX prior to 10.11 El Capitan
the SIGPROF signal is delivered to the process rather than to the thread
which skews the results enough for the test to fail.
Relax the check when running on OSX and other operating systems known to
have issues with the profiling signal (the list is taken from
src/runtime/pprof/pprof_test.go in Go source).
Also add the multiple variants of OSX to the continuous testing.
Fixes #146 and fixes #156.