]> Cypherpunks repositories - gostls13.git/commitdiff
math/rand: shorten Float32 test for GOARM=5
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 13 May 2015 22:12:59 +0000 (15:12 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 13 May 2015 22:31:44 +0000 (22:31 +0000)
Fixes #10749

Change-Id: I9d5f6f179fd117b0c358d7c8042daf5985b645c0
Reviewed-on: https://go-review.googlesource.com/10022
Reviewed-by: Dave Cheney <dave@cheney.net>
src/math/rand/rand_test.go

index ab0dc49b41128a46b8976b77bc4be1c10ec97dc7..c61494f8eb8586cd9e517b4191cead5e704db7ba 100644 (file)
@@ -8,6 +8,8 @@ import (
        "errors"
        "fmt"
        "math"
+       "os"
+       "runtime"
        "testing"
 )
 
@@ -322,10 +324,17 @@ func TestExpTables(t *testing.T) {
        }
 }
 
-// For issue 6721, the problem came after 7533753 calls, so check 10e6.
 func TestFloat32(t *testing.T) {
+       // For issue 6721, the problem came after 7533753 calls, so check 10e6.
+       num := int(10e6)
+       // But ARM5 floating point emulation is slow (Issue 10749), so
+       // do less for that builder:
+       if testing.Short() && runtime.GOARCH == "arm" && os.Getenv("GOARM") == "5" {
+               num /= 100 // 1.72 seconds instead of 172 seconds
+       }
+
        r := New(NewSource(1))
-       for ct := 0; ct < 10e6; ct++ {
+       for ct := 0; ct < num; ct++ {
                f := r.Float32()
                if f >= 1 {
                        t.Fatal("Float32() should be in range [0,1). ct:", ct, "f:", f)