Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(948)

Delta Between Two Patch Sets: src/pkg/runtime/race/testdata/mop_test.go

Issue 7942045: code review 7942045: cmd/gc: more race instrumentation. (Closed)
Left Patch Set: diff -r d6a4fe5af6aa https://go.googlecode.com/hg/ Created 12 years ago
Right Patch Set: diff -r 924fbbd725d4 https://go.googlecode.com/hg/ Created 12 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/gc/racewalk.c ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package race_test 5 package race_test
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "fmt" 9 "fmt"
10 "runtime" 10 "runtime"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 go func() { 569 go func() {
570 a = DummyWriter{1} 570 a = DummyWriter{1}
571 ch <- true 571 ch <- true
572 }() 572 }()
573 a = DummyWriter{2} 573 a = DummyWriter{2}
574 <-ch 574 <-ch
575 b = a 575 b = a
576 a = b 576 a = b
577 } 577 }
578 578
579 func TestRaceIfaceCmp(t *testing.T) { 579 func TestRaceIfaceCmp(t *testing.T) {
remyoudompheng 2013/03/26 00:26:01 This test fails without the patch.
580 var a, b Writer 580 var a, b Writer
581 a = DummyWriter{1} 581 a = DummyWriter{1}
582 ch := make(chan bool, 1) 582 ch := make(chan bool, 1)
583 go func() { 583 go func() {
584 a = DummyWriter{1} 584 a = DummyWriter{1}
585 ch <- true 585 ch <- true
586 }() 586 }()
587 _ = a == b 587 _ = a == b
588 <-ch 588 <-ch
589 } 589 }
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 c := make(chan bool, 1) 1238 c := make(chan bool, 1)
1239 i := &InterImpl{} 1239 i := &InterImpl{}
1240 go func() { 1240 go func() {
1241 i = &InterImpl{} 1241 i = &InterImpl{}
1242 c <- true 1242 c <- true
1243 }() 1243 }()
1244 i.Foo(0) 1244 i.Foo(0)
1245 <-c 1245 <-c
1246 } 1246 }
1247 1247
1248 // Method value with concrete value receiver.
1248 func TestRaceMethodValue(t *testing.T) { 1249 func TestRaceMethodValue(t *testing.T) {
1249 c := make(chan bool, 1) 1250 c := make(chan bool, 1)
1250 i := InterImpl{} 1251 i := InterImpl{}
1251 go func() { 1252 go func() {
1252 i = InterImpl{} 1253 i = InterImpl{}
1253 c <- true 1254 c <- true
1254 }() 1255 }()
1255 _ = i.Foo 1256 _ = i.Foo
1256 <-c 1257 <-c
1257 } 1258 }
1258 1259
1260 // Method value with interface receiver.
1259 func TestRaceMethodValue2(t *testing.T) { 1261 func TestRaceMethodValue2(t *testing.T) {
1260 c := make(chan bool, 1) 1262 c := make(chan bool, 1)
1261 var i Inter = InterImpl{} 1263 var i Inter = InterImpl{}
dvyukov 2013/03/26 06:31:47 It is different from the previous test only by i d
remyoudompheng 2013/03/26 07:27:36 Done.
1262 go func() { 1264 go func() {
1263 i = InterImpl{} 1265 i = InterImpl{}
1264 c <- true 1266 c <- true
1265 }() 1267 }()
1266 _ = i.Foo 1268 _ = i.Foo
1267 <-c 1269 <-c
1268 } 1270 }
1269 1271
1272 // Method value with implicit dereference.
1270 func TestRaceMethodValue3(t *testing.T) { 1273 func TestRaceMethodValue3(t *testing.T) {
1271 c := make(chan bool, 1) 1274 c := make(chan bool, 1)
1272 i := &InterImpl{} 1275 i := &InterImpl{}
1273 go func() { 1276 go func() {
1274 *i = InterImpl{} 1277 *i = InterImpl{}
1275 c <- true 1278 c <- true
1276 }() 1279 }()
1277 _ = i.Foo // dereferences i. 1280 _ = i.Foo // dereferences i.
1278 <-c 1281 <-c
1279 } 1282 }
1280 1283
1284 // Method value implicitly taking receiver address.
1281 func TestNoRaceMethodValue(t *testing.T) { 1285 func TestNoRaceMethodValue(t *testing.T) {
1282 c := make(chan bool, 1) 1286 c := make(chan bool, 1)
1283 i := InterImpl2{} 1287 i := InterImpl2{}
1284 go func() { 1288 go func() {
1285 i = InterImpl2{} 1289 i = InterImpl2{}
1286 c <- true 1290 c <- true
1287 }() 1291 }()
1288 _ = i.Foo // takes the address of i only. 1292 _ = i.Foo // takes the address of i only.
1289 <-c 1293 <-c
1290 } 1294 }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 x X 1561 x X
1558 } 1562 }
1559 c := make(chan Y) 1563 c := make(chan Y)
1560 var y Y 1564 var y Y
1561 go func() { 1565 go func() {
1562 c <- y 1566 c <- y
1563 }() 1567 }()
1564 y.x.y = 42 1568 y.x.y = 42
1565 <-c 1569 <-c
1566 } 1570 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b