mirror of
https://github.com/golang/go
synced 2024-11-20 04:04:41 -07:00
crypto/rand: use io.ReadFull in test
On Solaris versions before Solaris 11, the kernel will not return more than 1040 on a single read from /dev/urandom. R=golang-dev, agl, bradfitz, rsc, iant, dchest CC=golang-dev https://golang.org/cl/6113046
This commit is contained in:
parent
52f122d72e
commit
990f3af72b
@ -7,6 +7,7 @@ package rand
|
||||
import (
|
||||
"bytes"
|
||||
"compress/flate"
|
||||
"io"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@ -16,9 +17,9 @@ func TestRead(t *testing.T) {
|
||||
n = 1e5
|
||||
}
|
||||
b := make([]byte, n)
|
||||
n, err := Read(b)
|
||||
n, err := io.ReadFull(Reader, b)
|
||||
if n != len(b) || err != nil {
|
||||
t.Fatalf("Read(buf) = %d, %s", n, err)
|
||||
t.Fatalf("ReadFull(buf) = %d, %s", n, err)
|
||||
}
|
||||
|
||||
var z bytes.Buffer
|
||||
|
Loading…
Reference in New Issue
Block a user