mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
image/jpeg: increase TestLargeImageWithShortData timeout by an order of magnitude
Also dump goroutines on failure. The original bug report in #10413 reported a hang of “several minutes”. An apparently-spurious failure was observed in https://build.golang.org/log/e5ac3ce3fb7d04ec13e5bbfadea8bb5869a4dd1e, with a delay of only 3.64s. Moreover, if the test does fail due to a regression, we will want a goroutine dump to diagnose where it got stuck. The current call to t.Fatalf does not produce such a dump, so is not nearly as useful if the failure only occasionally reproduces. Updates #10413. Change-Id: I6ab9d112f14f438a0c54e02ec95934627acdc64b Reviewed-on: https://go-review.googlesource.com/c/go/+/408355 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
27794c4d4a
commit
85486bcccb
1 changed files with 11 additions and 12 deletions
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -247,18 +248,16 @@ func TestLargeImageWithShortData(t *testing.T) {
|
||||||
"\x20\x36\x9f\x78\x64\x75\xe6\xab\x7d\xb2\xde\x29\x70\xd3\x20\x27" +
|
"\x20\x36\x9f\x78\x64\x75\xe6\xab\x7d\xb2\xde\x29\x70\xd3\x20\x27" +
|
||||||
"\xde\xaf\xa4\xf0\xca\x9f\x24\xa8\xdf\x46\xa8\x24\x84\x96\xe3\x77" +
|
"\xde\xaf\xa4\xf0\xca\x9f\x24\xa8\xdf\x46\xa8\x24\x84\x96\xe3\x77" +
|
||||||
"\xf9\x2e\xe0\x0a\x62\x7f\xdf\xd9"
|
"\xf9\x2e\xe0\x0a\x62\x7f\xdf\xd9"
|
||||||
c := make(chan error, 1)
|
|
||||||
go func() {
|
timer := time.AfterFunc(30*time.Second, func() {
|
||||||
_, err := Decode(strings.NewReader(input))
|
debug.SetTraceback("all")
|
||||||
c <- err
|
panic("TestLargeImageWithShortData stuck in Decode")
|
||||||
}()
|
})
|
||||||
select {
|
defer timer.Stop()
|
||||||
case err := <-c:
|
|
||||||
if err == nil {
|
_, err := Decode(strings.NewReader(input))
|
||||||
t.Fatalf("got nil error, want non-nil")
|
if err == nil {
|
||||||
}
|
t.Fatalf("got nil error, want non-nil")
|
||||||
case <-time.After(3 * time.Second):
|
|
||||||
t.Fatalf("timed out")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue