diff --git a/cmd/xgo/runtime_gen/core/version.go b/cmd/xgo/runtime_gen/core/version.go index 20b5c632..26e85d5e 100755 --- a/cmd/xgo/runtime_gen/core/version.go +++ b/cmd/xgo/runtime_gen/core/version.go @@ -7,8 +7,8 @@ import ( ) const VERSION = "1.0.35" -const REVISION = "efe86afb9931162ad0926648c13c4109383beef3+1" -const NUMBER = 223 +const REVISION = "904aef19ec01b2728dd491cbcfbb84667b42dd5e+1" +const NUMBER = 224 // these fields will be filled by compiler const XGO_VERSION = "" diff --git a/cmd/xgo/runtime_gen/trace/trace.go b/cmd/xgo/runtime_gen/trace/trace.go index 128db84a..25ac6cc7 100755 --- a/cmd/xgo/runtime_gen/trace/trace.go +++ b/cmd/xgo/runtime_gen/trace/trace.go @@ -20,8 +20,18 @@ import ( var stackMap sync.Map // uintptr(goroutine) -> *Root var testInfoMapping sync.Map // uintptr(goroutine) -> *testInfo +// stack trace options: +// +// on: automatically collect when test starts and ends var xgoStackTrace = os.Getenv("XGO_STACK_TRACE") +// options: +// +// true: stdlib is by default allowed +// TODO: use compiler inserted flag instead of env +var xgoStdlibTrapDefaulAllow = os.Getenv("XGO_STD_LIB_TRAP_DEFAULT_ALLOW") +var collectStdlibTraceByDefault = xgoStdlibTrapDefaulAllow != "true" + type testInfo struct { name string @@ -194,11 +204,18 @@ func setupInterceptor() func() { } } +// returns a value to besed by post +// if returns err trap.ErrSkip, this interceptor is skipped, handleTracePost is not called, next interceptors will +// be normally executed +// if returns nil error, handleTracePost is called func handleTracePre(ctx context.Context, f *core.FuncInfo, args core.Object, results core.Object) (interface{}, error) { if !__xgo_link_init_finished() { // do not collect trace while init return nil, trap.ErrSkip } + if f.Stdlib && collectStdlibTraceByDefault { + return nil, trap.ErrSkip + } key := uintptr(__xgo_link_getcurg()) localOptStack, ok := collectingMap.Load(key) var localOpts *collectOpts diff --git a/cmd/xgo/version.go b/cmd/xgo/version.go index b94d7721..7a87b96b 100644 --- a/cmd/xgo/version.go +++ b/cmd/xgo/version.go @@ -3,8 +3,8 @@ package main import "fmt" const VERSION = "1.0.35" -const REVISION = "efe86afb9931162ad0926648c13c4109383beef3+1" -const NUMBER = 223 +const REVISION = "904aef19ec01b2728dd491cbcfbb84667b42dd5e+1" +const NUMBER = 224 func getRevision() string { revSuffix := "" diff --git a/patch/ctxt/stdlib.go b/patch/ctxt/stdlib.go index 3e96d756..c23f641f 100644 --- a/patch/ctxt/stdlib.go +++ b/patch/ctxt/stdlib.go @@ -72,9 +72,10 @@ var stdBlocklist = map[string]map[string]bool{ "sync/atomic": map[string]bool{ "*": true, }, - "testing": map[string]bool{ - "*": true, - }, + // testing is not harmful + // "testing": map[string]bool{ + // "*": true, + // }, "unsafe": map[string]bool{ "*": true, }, diff --git a/runtime/core/version.go b/runtime/core/version.go index 20b5c632..26e85d5e 100644 --- a/runtime/core/version.go +++ b/runtime/core/version.go @@ -7,8 +7,8 @@ import ( ) const VERSION = "1.0.35" -const REVISION = "efe86afb9931162ad0926648c13c4109383beef3+1" -const NUMBER = 223 +const REVISION = "904aef19ec01b2728dd491cbcfbb84667b42dd5e+1" +const NUMBER = 224 // these fields will be filled by compiler const XGO_VERSION = "" diff --git a/runtime/trace/trace.go b/runtime/trace/trace.go index 128db84a..25ac6cc7 100644 --- a/runtime/trace/trace.go +++ b/runtime/trace/trace.go @@ -20,8 +20,18 @@ import ( var stackMap sync.Map // uintptr(goroutine) -> *Root var testInfoMapping sync.Map // uintptr(goroutine) -> *testInfo +// stack trace options: +// +// on: automatically collect when test starts and ends var xgoStackTrace = os.Getenv("XGO_STACK_TRACE") +// options: +// +// true: stdlib is by default allowed +// TODO: use compiler inserted flag instead of env +var xgoStdlibTrapDefaulAllow = os.Getenv("XGO_STD_LIB_TRAP_DEFAULT_ALLOW") +var collectStdlibTraceByDefault = xgoStdlibTrapDefaulAllow != "true" + type testInfo struct { name string @@ -194,11 +204,18 @@ func setupInterceptor() func() { } } +// returns a value to besed by post +// if returns err trap.ErrSkip, this interceptor is skipped, handleTracePost is not called, next interceptors will +// be normally executed +// if returns nil error, handleTracePost is called func handleTracePre(ctx context.Context, f *core.FuncInfo, args core.Object, results core.Object) (interface{}, error) { if !__xgo_link_init_finished() { // do not collect trace while init return nil, trap.ErrSkip } + if f.Stdlib && collectStdlibTraceByDefault { + return nil, trap.ErrSkip + } key := uintptr(__xgo_link_getcurg()) localOptStack, ok := collectingMap.Load(key) var localOpts *collectOpts diff --git a/script/github-actions/main.go b/script/github-actions/main.go index a674eb27..2b6ed58e 100644 --- a/script/github-actions/main.go +++ b/script/github-actions/main.go @@ -84,13 +84,13 @@ func checkMerge(args []string) error { } } if !found { - return fmt.Errorf("%s cannot be merged into %s without creating intermediate commit", branch, targetBranch) + return fmt.Errorf("%s is not based on newest %s, please rebase with %s", branch, targetBranch, targetBranch) } if i == 0 { - return fmt.Errorf("%s is the same with %s", branch, targetBranch) + return fmt.Errorf("%s is same with %s, nothing to merge", branch, targetBranch) } if i != 1 { - return fmt.Errorf("expect 1 commit to be merged, actual: %d", i) + return fmt.Errorf("%s has %d commits to be merged into %s, please squash them into 1(using 'git reset --soft origin/%s')", branch, i, targetBranch, targetBranch) } return nil }