Patchwork libgo patch committed: Fix crypto/rand test to read all data

login
register
mail settings
Submitter Ian Taylor
Date April 25, 2012, 4:41 a.m.
Message ID <mcrzka0s9sg.fsf@dhcp-172-18-216-180.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/154791/
State New
Headers show

Comments

Ian Taylor - April 25, 2012, 4:41 a.m.
This patch to libgo fixes the crypto/rand test to read all the data that
it needs.  This should fix PR 52341.  Bootstrapped and ran crypto/rand
test on x86_64-unknown-linux-gnu.  Committed to mainline and 4.7 branch.

Ian

Patch

diff -r c4931780d05a libgo/go/crypto/rand/rand_test.go
--- a/libgo/go/crypto/rand/rand_test.go	Tue Apr 24 21:24:41 2012 -0700
+++ b/libgo/go/crypto/rand/rand_test.go	Tue Apr 24 21:38:23 2012 -0700
@@ -7,6 +7,7 @@ 
 import (
 	"bytes"
 	"compress/flate"
+	"io"
 	"testing"
 )
 
@@ -16,9 +17,9 @@ 
 		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