Skip to content

Commit ad737c0

Browse files
committed
Modify testcase to support more arch
1 parent 5ee54d9 commit ad737c0

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

runtime_test.go

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package routine
22

33
import (
44
"fmt"
5+
"os"
56
"reflect"
67
"runtime"
78
"sync"
@@ -36,6 +37,12 @@ func TestGetg0(t *testing.T) {
3637
func TestGetgt(t *testing.T) {
3738
fmt.Println("*** GOOS:", runtime.GOOS, "***")
3839
fmt.Println("*** GOARCH:", runtime.GOARCH, "***")
40+
if GOARM := os.Getenv("GOARM"); len(GOARM) > 0 {
41+
fmt.Println("*** GOARM:", GOARM, "***")
42+
}
43+
if GOMIPS := os.Getenv("GOMIPS"); len(GOMIPS) > 0 {
44+
fmt.Println("*** GOMIPS:", GOMIPS, "***")
45+
}
3946
//
4047
gt := getgt()
4148
runtime.GC()
@@ -58,27 +65,11 @@ func TestGetgt(t *testing.T) {
5865
runTest(t, func() {
5966
tt := getgt()
6067
runtime.GC()
61-
switch runtime.GOARCH {
62-
case "386":
63-
fallthrough
64-
case "amd64":
65-
fallthrough
66-
case "arm":
67-
fallthrough
68-
case "arm64":
69-
fallthrough
70-
case "ppc64":
71-
fallthrough
72-
case "s390x":
73-
assert.Equal(t, numField, tt.NumField())
74-
assert.Equal(t, offsetGoid, offset(tt, "goid"))
75-
assert.Equal(t, offsetPaniconfault, offset(tt, "paniconfault"))
76-
assert.Equal(t, offsetGopc, offset(tt, "gopc"))
77-
assert.Equal(t, offsetLabels, offset(tt, "labels"))
78-
79-
default:
80-
panic("Not support GOARCH: " + runtime.GOARCH)
81-
}
68+
assert.Equal(t, numField, tt.NumField())
69+
assert.Equal(t, offsetGoid, offset(tt, "goid"))
70+
assert.Equal(t, offsetPaniconfault, offset(tt, "paniconfault"))
71+
assert.Equal(t, offsetGopc, offset(tt, "gopc"))
72+
assert.Equal(t, offsetLabels, offset(tt, "labels"))
8273
})
8374
}
8475

0 commit comments

Comments
 (0)