summaryrefslogtreecommitdiff
path: root/misc/cgo
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-01-21 19:44:51 -0500
committerRuss Cox <rsc@golang.org>2014-01-21 19:44:51 -0500
commitbbf7fc94dcf683fc118d81615bb395743bc3d696 (patch)
tree249b66014579b3343011a2ad0618aca44eef094e /misc/cgo
parentf628736f37d46ab63730157d06a737d4bddf8269 (diff)
downloadgo-bbf7fc94dcf683fc118d81615bb395743bc3d696.tar.gz
misc/cgo/testtls: make test less flaky
Now it should always fail on ARM. (The fix is on its way too.) R=iant, r, dave CC=golang-codereviews https://codereview.appspot.com/55140043
Diffstat (limited to 'misc/cgo')
-rw-r--r--misc/cgo/testtls/tls.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/misc/cgo/testtls/tls.go b/misc/cgo/testtls/tls.go
index a9546a61c..8e9ee7003 100644
--- a/misc/cgo/testtls/tls.go
+++ b/misc/cgo/testtls/tls.go
@@ -15,14 +15,16 @@ import (
)
func testTLS(t *testing.T) {
- var keyVal C.int = 1234
-
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- C.setTLS(C.int(keyVal))
- storedVal := C.getTLS()
- if storedVal != keyVal {
- t.Fatalf("stored %d want %d", storedVal, keyVal)
+ if val := C.getTLS(); val != 0 {
+ t.Fatalf("at start, C.getTLS() = %#x, want 0", val)
+ }
+
+ const keyVal = 0x1234
+ C.setTLS(keyVal)
+ if val := C.getTLS(); val != keyVal {
+ t.Fatalf("at end, C.getTLS() = %#x, want %#x", val, keyVal)
}
}