]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: enable msan/asan
authorMeng Zhuo <mzh@golangcn.org>
Thu, 30 Dec 2021 08:46:21 +0000 (16:46 +0800)
committermzh <mzh@golangcn.org>
Fri, 1 Apr 2022 01:18:52 +0000 (01:18 +0000)
Supporting memory sanitizer and address sanitizer in toolchains

Change-Id: Ie292657b78954d65bd72e64e063b1c4f18d4f0d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/374974
Trust: mzh <mzh@golangcn.org>
Run-TryBot: mzh <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/cmd/dist/test.go

index a540a2abda669e70e02b6dbc899224a2bcea0f6e..9118c133e5e72615c447dbd3bb3cc00e47f40b1d 100644 (file)
@@ -38,6 +38,9 @@ func cmdtest() {
        flag.StringVar(&t.runRxStr, "run", os.Getenv("GOTESTONLY"),
                "run only those tests matching the regular expression; empty means to run all. "+
                        "Special exception: if the string begins with '!', the match is inverted.")
+       flag.BoolVar(&t.msan, "msan", false, "run in memory sanitizer builder mode")
+       flag.BoolVar(&t.asan, "asan", false, "run in address sanitizer builder mode")
+
        xflagparse(-1) // any number of args
        if noRebuild {
                t.rebuild = false
@@ -49,6 +52,8 @@ func cmdtest() {
 // tester executes cmdtest.
 type tester struct {
        race        bool
+       msan        bool
+       asan        bool
        listMode    bool
        rebuild     bool
        failed      bool
@@ -404,6 +409,12 @@ func (t *tester) registerStdTest(pkg string) {
                        if t.race {
                                args = append(args, "-race")
                        }
+                       if t.msan {
+                               args = append(args, "-msan")
+                       }
+                       if t.asan {
+                               args = append(args, "-asan")
+                       }
                        if t.compileOnly {
                                args = append(args, "-run=^$")
                        }