mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo/internal/testsanitizers: for "leak", use -fsanitize=address
We currently test the leak detector by running "go build -asan", which will pass -fsanitize=address to the C compiler. So use that when testing whether the option works. Fixes #72128 Change-Id: I4efc0b689bfda04c80dbac30a5c757215f297d2f Reviewed-on: https://go-review.googlesource.com/c/go/+/655535 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
24d22352d3
commit
f55bb135d2
1 changed files with 10 additions and 2 deletions
|
|
@ -361,10 +361,18 @@ func configure(sanitizer string) *config {
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sanitizerOpt := sanitizer
|
||||||
|
// For the leak detector, we use "go build -asan",
|
||||||
|
// which implies the address sanitizer.
|
||||||
|
// We may want to adjust this someday.
|
||||||
|
if sanitizer == "leak" {
|
||||||
|
sanitizerOpt = "address"
|
||||||
|
}
|
||||||
|
|
||||||
c := &config{
|
c := &config{
|
||||||
sanitizer: sanitizer,
|
sanitizer: sanitizer,
|
||||||
cFlags: []string{"-fsanitize=" + sanitizer},
|
cFlags: []string{"-fsanitize=" + sanitizerOpt},
|
||||||
ldFlags: []string{"-fsanitize=" + sanitizer},
|
ldFlags: []string{"-fsanitize=" + sanitizerOpt},
|
||||||
}
|
}
|
||||||
|
|
||||||
if testing.Verbose() {
|
if testing.Verbose() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue