Skip to content

Commit f8fbcef

Browse files
committed
math/rand: shorten Float32 test for GOARM=5
Fixes #10749 Change-Id: I9d5f6f179fd117b0c358d7c8042daf5985b645c0 Reviewed-on: https://go-review.googlesource.com/10022 Reviewed-by: Dave Cheney <[email protected]>
1 parent f6d1009 commit f8fbcef

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/math/rand/rand_test.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import (
88
"errors"
99
"fmt"
1010
"math"
11+
"os"
12+
"runtime"
1113
"testing"
1214
)
1315

@@ -322,10 +324,17 @@ func TestExpTables(t *testing.T) {
322324
}
323325
}
324326

325-
// For issue 6721, the problem came after 7533753 calls, so check 10e6.
326327
func TestFloat32(t *testing.T) {
328+
// For issue 6721, the problem came after 7533753 calls, so check 10e6.
329+
num := int(10e6)
330+
// But ARM5 floating point emulation is slow (Issue 10749), so
331+
// do less for that builder:
332+
if testing.Short() && runtime.GOARCH == "arm" && os.Getenv("GOARM") == "5" {
333+
num /= 100 // 1.72 seconds instead of 172 seconds
334+
}
335+
327336
r := New(NewSource(1))
328-
for ct := 0; ct < 10e6; ct++ {
337+
for ct := 0; ct < num; ct++ {
329338
f := r.Float32()
330339
if f >= 1 {
331340
t.Fatal("Float32() should be in range [0,1). ct:", ct, "f:", f)

0 commit comments

Comments
 (0)