]> Cypherpunks repositories - gostls13.git/commitdiff
runtime, misc/cgo/test: fix build for Linux/ARM
authorShenghou Ma <minux.ma@gmail.com>
Fri, 4 May 2012 17:35:13 +0000 (01:35 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Fri, 4 May 2012 17:35:13 +0000 (01:35 +0800)
1. In CL 5989057, I made a mistake in the last minute change.
"MOVW.W R4, -4(SP)" should really be "MOVW.W R4, -4(R13)",
as 5l will rewrite offset for SP.
2. misc/cgo/test/issue1560.go tests for parallel sleep of 1s,
but on ARM, the deadline is frequently missed, so change sleep
time to 2s on ARM.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6202043

misc/cgo/test/issue1560.go
src/pkg/runtime/asm_arm.s

index 3faa966e708c314eec2b26ba3d1eff454571824a..7bc1dd6df490af26145f44de13975d541eee93e1 100644 (file)
@@ -15,6 +15,7 @@ void twoSleep(int);
 import "C"
 
 import (
+       "runtime"
        "testing"
        "time"
 )
@@ -35,11 +36,17 @@ func BackgroundSleep(n int) {
 }
 
 func testParallelSleep(t *testing.T) {
+       sleepSec := 1
+       if runtime.GOARCH == "arm" {
+               // on ARM, the 1.3s deadline is frequently missed,
+               // so increase sleep time to 2s
+               sleepSec = 2
+       }
        start := time.Now()
-       parallelSleep(1)
+       parallelSleep(sleepSec)
        dt := time.Now().Sub(start)
-       // bug used to run sleeps in serial, producing a 2-second delay.
-       if dt >= 1300*time.Millisecond {
-               t.Fatalf("parallel 1-second sleeps slept for %f seconds", dt.Seconds())
+       // bug used to run sleeps in serial, producing a 2*sleepSec-second delay.
+       if dt >= time.Duration(sleepSec)*1300*time.Millisecond {
+               t.Fatalf("parallel %d-second sleeps slept for %f seconds", sleepSec, dt.Seconds())
        }
 }
index c940f5f073272fc23edfa6b994b42bef2dd57ff0..1ba3500496580eb9f213dc109fe92db0a70646bc 100644 (file)
@@ -289,7 +289,7 @@ TEXT        runtime·cgocallback(SB),7,$16
        // Save current m->g0->sched.sp on stack and then set it to SP.
        MOVW    m_g0(m), R3
        MOVW    (g_sched+gobuf_sp)(R3), R4
-       MOVW.W  R4, -4(SP)
+       MOVW.W  R4, -4(R13)
        MOVW    R13, (g_sched+gobuf_sp)(R3)
 
        // Switch to m->curg stack and call runtime.cgocallbackg