Patchwork libgo patch committed: Fix race condition in test

login
register
mail settings
Submitter Ian Taylor
Date Jan. 21, 2011, 10:01 p.m.
Message ID <mcrmxmtdihp.fsf@google.com>
Download mbox | patch
Permalink /patch/79948/
State New
Headers show

Comments

Ian Taylor - Jan. 21, 2011, 10:01 p.m.
This patch to libgo fixes a race condition in a test.  This is copied
from the master sources.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch

diff -r 893744d8974a libgo/go/net/dnsname_test.go
--- a/libgo/go/net/dnsname_test.go	Fri Jan 21 08:33:04 2011 -0800
+++ b/libgo/go/net/dnsname_test.go	Fri Jan 21 13:58:40 2011 -0800
@@ -27,7 +27,7 @@ 
 	{"a.b..com", false},
 }
 
-func getTestCases(ch chan<- *testCase) {
+func getTestCases(ch chan<- testCase) {
 	defer close(ch)
 	var char59 = ""
 	var char63 = ""
@@ -39,17 +39,17 @@ 
 	char64 = char63 + "a"
 
 	for _, tc := range tests {
-		ch <- &tc
+		ch <- tc
 	}
 
-	ch <- &testCase{char63 + ".com", true}
-	ch <- &testCase{char64 + ".com", false}
+	ch <- testCase{char63 + ".com", true}
+	ch <- testCase{char64 + ".com", false}
 	// 255 char name is fine:
-	ch <- &testCase{char59 + "." + char63 + "." + char63 + "." +
+	ch <- testCase{char59 + "." + char63 + "." + char63 + "." +
 		char63 + ".com",
 		true}
 	// 256 char name is bad:
-	ch <- &testCase{char59 + "a." + char63 + "." + char63 + "." +
+	ch <- testCase{char59 + "a." + char63 + "." + char63 + "." +
 		char63 + ".com",
 		false}
 }
@@ -58,7 +58,7 @@ 
 	if runtime.GOOS == "windows" {
 		return
 	}
-	ch := make(chan *testCase)
+	ch := make(chan testCase)
 	go getTestCases(ch)
 	for tc := range ch {
 		if isDomainName(tc.name) != tc.result {