mirror of
https://github.com/golang/go.git
synced 2025-05-31 04:02:58 +00:00
runtime: deflake TestNewOSProc0, fix _rt0_amd64_linux_lib stack alignment
This addresses iant's comments from CL 9164. Change-Id: I7b5b282f61b11aab587402c2d302697e76666376 Reviewed-on: https://go-review.googlesource.com/9222 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
ed09e0e2bf
commit
1f65c9c141
@ -21,6 +21,8 @@ func newOSProcCreated() {
|
|||||||
newOSProcDone = true
|
newOSProcDone = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Can't be run with -race because it inserts calls into newOSProcCreated()
|
||||||
|
// that require a valid G/M.
|
||||||
func TestNewOSProc0(t *testing.T) {
|
func TestNewOSProc0(t *testing.T) {
|
||||||
if runtime.GOOS == "android" && runtime.GOARCH == "arm" {
|
if runtime.GOOS == "android" && runtime.GOARCH == "arm" {
|
||||||
// newosproc0 does not work for android/arm.
|
// newosproc0 does not work for android/arm.
|
||||||
@ -28,10 +30,12 @@ func TestNewOSProc0(t *testing.T) {
|
|||||||
t.Skipf("skipping on %v", runtime.GOOS)
|
t.Skipf("skipping on %v", runtime.GOOS)
|
||||||
}
|
}
|
||||||
runtime.NewOSProc0(0x800000, unsafe.Pointer(runtime.FuncPC(newOSProcCreated)))
|
runtime.NewOSProc0(0x800000, unsafe.Pointer(runtime.FuncPC(newOSProcCreated)))
|
||||||
check, end := time.Tick(1*time.Second), time.Tick(5*time.Second)
|
check := time.NewTicker(1 * time.Second)
|
||||||
|
defer check.Stop()
|
||||||
|
end := time.After(5 * time.Second)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-check:
|
case <-check.C:
|
||||||
if newOSProcDone {
|
if newOSProcDone {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ TEXT _rt0_amd64_linux(SB),NOSPLIT,$-8
|
|||||||
|
|
||||||
// When building with -buildmode=c-shared, this symbol is called when the shared
|
// When building with -buildmode=c-shared, this symbol is called when the shared
|
||||||
// library is loaded.
|
// library is loaded.
|
||||||
TEXT _rt0_amd64_linux_lib(SB),NOSPLIT,$0x40
|
TEXT _rt0_amd64_linux_lib(SB),NOSPLIT,$0x48
|
||||||
MOVQ BX, 0x10(SP)
|
MOVQ BX, 0x10(SP)
|
||||||
MOVQ BP, 0x18(SP)
|
MOVQ BP, 0x18(SP)
|
||||||
MOVQ R12, 0x20(SP)
|
MOVQ R12, 0x20(SP)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user