| 1 | // Copyright 2021 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package generatorscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/ |
| 6 | |
| 7 | import ( |
| 8 | "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/" |
| 9 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 10 | "os/execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/" |
| 11 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 12 | "runtimescip-go gomod github.com/golang/go/src go1.25.0 runtime/" |
| 13 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 14 | |
| 15 | "golang.org/x/tools/internal/testenvscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/testenv`/" |
| 16 | ) |
| 17 | |
| 18 | func mkGenStatescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/mkGenState().() *genstatescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate# { |
| 19 | |
| 20 | return &genstatescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#{ |
| 21 | GenConfigscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#GenConfig.: GenConfigscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#{ |
| 22 | Tagscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#Tag.: "gen", |
| 23 | OutDirscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#OutDir.: "/tmp", |
| 24 | NumTestPackagesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#NumTestPackages.: 1, |
| 25 | NumTestFunctionsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#NumTestFunctions.: 10, |
| 26 | }, |
| 27 | iprefscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#ipref.: "foo/", |
| 28 | derefFuncsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#derefFuncs.: make(map[string]string), |
| 29 | assignFuncsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#assignFuncs.: make(map[string]string), |
| 30 | allocFuncsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#allocFuncs.: make(map[string]string), |
| 31 | globVarsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#globVars.: make(map[string]string), |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func TestBasicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TestBasic().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 36 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 37 | s := mkGenStatescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/mkGenState().() |
| 38 | for i := range 1000 { |
| 39 | s.wrscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#wr. = NewWrapRandscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/NewWrapRand().(int64(i), RandCtlChecksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlChecks.|RandCtlPanicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlPanic.) |
| 40 | fp := s.GenFuncscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#GenFunc().(i, i) |
| 41 | var buf bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# |
| 42 | var b *bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# = &buf |
| 43 | wr := NewWrapRandscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/NewWrapRand().(int64(i), RandCtlChecksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlChecks.|RandCtlPanicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlPanic.) |
| 44 | s.wrscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#wr. = wr |
| 45 | s.emitCallerscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#emitCaller().(fp, b, i) |
| 46 | s.wrscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#wr. = NewWrapRandscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/NewWrapRand().(int64(i), RandCtlChecksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlChecks.|RandCtlPanicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlPanic.) |
| 47 | s.emitCheckerscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#emitChecker().(fp, b, i, true) |
| 48 | wr.Checkscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/wraprand#Check().(s.wrscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#wr.) |
| 49 | } |
| 50 | if s.errsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#errs. != 0 { |
| 51 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("%d errors during Generate", s.errsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#errs.) |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | func TestMoreComplicatedscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TestMoreComplicated().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 56 | saveit := tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables. |
| 57 | defer func() { tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables. = saveit }() |
| 58 | |
| 59 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 60 | s := mkGenStatescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/mkGenState().() |
| 61 | for i := range 10000 { |
| 62 | s.wrscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#wr. = NewWrapRandscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/NewWrapRand().(int64(i), RandCtlChecksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlChecks.|RandCtlPanicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlPanic.) |
| 63 | fp := s.GenFuncscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#GenFunc().(i, i) |
| 64 | var buf bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# |
| 65 | var b *bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.25.0 bytes/Buffer# = &buf |
| 66 | wr := NewWrapRandscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/NewWrapRand().(int64(i), RandCtlChecksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlChecks.|RandCtlPanicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlPanic.) |
| 67 | s.wrscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#wr. = wr |
| 68 | s.emitCallerscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#emitCaller().(fp, b, i) |
| 69 | verbscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/verb().(1, "finished iter %d caller", i) |
| 70 | s.wrscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#wr. = NewWrapRandscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/NewWrapRand().(int64(i), RandCtlChecksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlChecks.|RandCtlPanicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlPanic.) |
| 71 | s.emitCheckerscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#emitChecker().(fp, b, i, true) |
| 72 | verbscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/verb().(1, "finished iter %d checker", i) |
| 73 | wr.Checkscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/wraprand#Check().(s.wrscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#wr.) |
| 74 | if s.errsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#errs. != 0 { |
| 75 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("%d errors during Generate iter %d", s.errsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/genstate#errs., i) |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | func TestIsBuildablescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TestIsBuildable().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 81 | testenvscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/testenv`/.NeedsToolscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/testenv`/NeedsTool().(t, "go") |
| 82 | if runtimescip-go gomod github.com/golang/go/src go1.25.0 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.25.0 runtime/GOOS. == "android" { |
| 83 | t.Skipfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Skipf().("the dependencies are not available on android") |
| 84 | } |
| 85 | |
| 86 | td := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 87 | verbscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/verb().(1, "generating into temp dir %s", td) |
| 88 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 89 | pack := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(td) |
| 90 | s := GenConfigscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#{ |
| 91 | Tagscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#Tag.: "x", |
| 92 | OutDirscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#OutDir.: td, |
| 93 | PkgPathscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#PkgPath.: pack, |
| 94 | NumTestFunctionsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#NumTestFunctions.: 10, |
| 95 | NumTestPackagesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#NumTestPackages.: 10, |
| 96 | MaxFailscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#MaxFail.: 10, |
| 97 | RandCtlscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#RandCtl.: RandCtlChecksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlChecks. | RandCtlPanicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlPanic., |
| 98 | } |
| 99 | errs := Generatescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/Generate().(s) |
| 100 | if errs != 0 { |
| 101 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("%d errors during Generate", errs) |
| 102 | } |
| 103 | |
| 104 | verbscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/verb().(1, "building %s\n", td) |
| 105 | |
| 106 | cmd := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().("go", "run", ".") |
| 107 | cmd.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = td |
| 108 | coutput, cerr := cmd.CombinedOutputscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#CombinedOutput().() |
| 109 | if cerr != nil { |
| 110 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("go build command failed: %s\n", string(coutput)) |
| 111 | } |
| 112 | verbscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/verb().(1, "output is: %s\n", string(coutput)) |
| 113 | } |
| 114 | |
| 115 | // TestExhaustive does a series of code generation runs, starting with |
| 116 | // (relatively) simple code and then getting progressively more |
| 117 | // complex (more params, deeper structs, turning on additional |
| 118 | // features such as address-taken vars and reflect testing). The |
| 119 | // intent here is mainly to insure that the tester still works if you |
| 120 | // turn things on and off, e.g. that each feature is separately |
| 121 | // controllable and not linked to other things. |
| 122 | func TestExhaustivescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TestExhaustive().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 123 | testenvscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/testenv`/.NeedsToolscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/testenv`/NeedsTool().(t, "go") |
| 124 | if runtimescip-go gomod github.com/golang/go/src go1.25.0 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.25.0 runtime/GOOS. == "android" { |
| 125 | t.Skipfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Skipf().("the dependencies are not available on android") |
| 126 | } |
| 127 | |
| 128 | if testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Shortscip-go gomod github.com/golang/go/src go1.25.0 testing/Short().() { |
| 129 | t.Skipscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Skip().("skipping test in short mode.") |
| 130 | } |
| 131 | |
| 132 | td := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 133 | verbscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/verb().(1, "generating into temp dir %s", td) |
| 134 | |
| 135 | scenarios := []struct { |
| 136 | name string |
| 137 | adjuster func() |
| 138 | }{ |
| 139 | { |
| 140 | "minimal", |
| 141 | func() { |
| 142 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..nParmRangescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#nParmRange. = 3 |
| 143 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..nReturnRangescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#nReturnRange. = 3 |
| 144 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..structDepthscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#structDepth. = 1 |
| 145 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..recurPercscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#recurPerc. = 0 |
| 146 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..methodPercscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#methodPerc. = 0 |
| 147 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..doReflectCallscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#doReflectCall. = false |
| 148 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..doDeferscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#doDefer. = false |
| 149 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..takeAddressscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#takeAddress. = false |
| 150 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..doFuncCallValuesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#doFuncCallValues. = false |
| 151 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..doSkipComparescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#doSkipCompare. = false |
| 152 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 153 | }, |
| 154 | }, |
| 155 | { |
| 156 | "moreparms", |
| 157 | func() { |
| 158 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..nParmRangescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#nParmRange. = 15 |
| 159 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..nReturnRangescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#nReturnRange. = 7 |
| 160 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..structDepthscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#structDepth. = 3 |
| 161 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 162 | }, |
| 163 | }, |
| 164 | { |
| 165 | "addrecur", |
| 166 | func() { |
| 167 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..recurPercscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#recurPerc. = 20 |
| 168 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 169 | }, |
| 170 | }, |
| 171 | { |
| 172 | "addmethod", |
| 173 | func() { |
| 174 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..methodPercscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#methodPerc. = 25 |
| 175 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..pointerMethodCallPercscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#pointerMethodCallPerc. = 30 |
| 176 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 177 | }, |
| 178 | }, |
| 179 | { |
| 180 | "addtakeaddr", |
| 181 | func() { |
| 182 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..takeAddressscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#takeAddress. = true |
| 183 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..takenFractionscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#takenFraction. = 20 |
| 184 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 185 | }, |
| 186 | }, |
| 187 | { |
| 188 | "addreflect", |
| 189 | func() { |
| 190 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..doReflectCallscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#doReflectCall. = true |
| 191 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 192 | }, |
| 193 | }, |
| 194 | { |
| 195 | "adddefer", |
| 196 | func() { |
| 197 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..doDeferscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#doDefer. = true |
| 198 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 199 | }, |
| 200 | }, |
| 201 | { |
| 202 | "addfuncval", |
| 203 | func() { |
| 204 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..doFuncCallValuesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#doFuncCallValues. = true |
| 205 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 206 | }, |
| 207 | }, |
| 208 | { |
| 209 | "addfuncval", |
| 210 | func() { |
| 211 | tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables..doSkipComparescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TunableParams#doSkipCompare. = true |
| 212 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 213 | }, |
| 214 | }, |
| 215 | } |
| 216 | |
| 217 | // Loop over scenarios and make sure each one works properly. |
| 218 | for i, s := range scenarios { |
| 219 | t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("running %s\n", s.name) |
| 220 | s.adjuster() |
| 221 | osscip-go gomod github.com/golang/go/src go1.25.0 os/.RemoveAllscip-go gomod github.com/golang/go/src go1.25.0 os/RemoveAll().(td) |
| 222 | pack := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(td) |
| 223 | c := GenConfigscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#{ |
| 224 | Tagscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#Tag.: "x", |
| 225 | OutDirscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#OutDir.: td, |
| 226 | PkgPathscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#PkgPath.: pack, |
| 227 | NumTestFunctionsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#NumTestFunctions.: 10, |
| 228 | NumTestPackagesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#NumTestPackages.: 10, |
| 229 | Seedscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#Seed.: int64(i + 9), |
| 230 | MaxFailscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#MaxFail.: 10, |
| 231 | RandCtlscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#RandCtl.: RandCtlChecksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlChecks. | RandCtlPanicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlPanic., |
| 232 | } |
| 233 | errs := Generatescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/Generate().(c) |
| 234 | if errs != 0 { |
| 235 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("%d errors during scenarios %q Generate", errs, s.name) |
| 236 | } |
| 237 | cmd := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().("go", "run", ".") |
| 238 | cmd.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = td |
| 239 | coutput, cerr := cmd.CombinedOutputscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#CombinedOutput().() |
| 240 | if cerr != nil { |
| 241 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("run failed for scenario %q: %s\n", s.name, string(coutput)) |
| 242 | } |
| 243 | verbscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/verb().(1, "output is: %s\n", string(coutput)) |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | func TestEmitBadBuildFailurescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TestEmitBadBuildFailure().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 248 | testenvscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/testenv`/.NeedsToolscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/testenv`/NeedsTool().(t, "go") |
| 249 | if runtimescip-go gomod github.com/golang/go/src go1.25.0 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.25.0 runtime/GOOS. == "android" { |
| 250 | t.Skipfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Skipf().("the dependencies are not available on android") |
| 251 | } |
| 252 | |
| 253 | td := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 254 | verbscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/verb().(1, "generating into temp dir %s", td) |
| 255 | |
| 256 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 257 | pack := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(td) |
| 258 | s := GenConfigscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#{ |
| 259 | Tagscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#Tag.: "x", |
| 260 | OutDirscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#OutDir.: td, |
| 261 | PkgPathscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#PkgPath.: pack, |
| 262 | NumTestFunctionsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#NumTestFunctions.: 10, |
| 263 | NumTestPackagesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#NumTestPackages.: 10, |
| 264 | MaxFailscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#MaxFail.: 10, |
| 265 | RandCtlscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#RandCtl.: RandCtlChecksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlChecks. | RandCtlPanicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlPanic., |
| 266 | EmitBadscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#EmitBad.: 1, |
| 267 | } |
| 268 | errs := Generatescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/Generate().(s) |
| 269 | if errs != 0 { |
| 270 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("%d errors during Generate", errs) |
| 271 | } |
| 272 | |
| 273 | cmd := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().("go", "build", ".") |
| 274 | cmd.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = td |
| 275 | coutput, cerr := cmd.CombinedOutputscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#CombinedOutput().() |
| 276 | if cerr == nil { |
| 277 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("go build command passed, expected failure. output: %s\n", string(coutput)) |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | func TestEmitBadRunFailurescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/TestEmitBadRunFailure().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 282 | testenvscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/testenv`/.NeedsToolscip-go gomod golang.org/x/tools . `golang.org/x/tools/internal/testenv`/NeedsTool().(t, "go") |
| 283 | if runtimescip-go gomod github.com/golang/go/src go1.25.0 runtime/.GOOSscip-go gomod github.com/golang/go/src go1.25.0 runtime/GOOS. == "android" { |
| 284 | t.Skipfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Skipf().("the dependencies are not available on android") |
| 285 | } |
| 286 | |
| 287 | td := t.TempDirscip-go gomod github.com/golang/go/src go1.25.0 testing/common#TempDir().() |
| 288 | verbscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/verb().(1, "generating into temp dir %s", td) |
| 289 | |
| 290 | checkTunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/checkTunables().(tunablesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/tunables.) |
| 291 | pack := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Base().(td) |
| 292 | s := GenConfigscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#{ |
| 293 | Tagscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#Tag.: "x", |
| 294 | OutDirscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#OutDir.: td, |
| 295 | PkgPathscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#PkgPath.: pack, |
| 296 | NumTestFunctionsscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#NumTestFunctions.: 10, |
| 297 | NumTestPackagesscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#NumTestPackages.: 10, |
| 298 | MaxFailscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#MaxFail.: 10, |
| 299 | RandCtlscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#RandCtl.: RandCtlChecksscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlChecks. | RandCtlPanicscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/RandCtlPanic., |
| 300 | EmitBadscip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/GenConfig#EmitBad.: 2, |
| 301 | } |
| 302 | errs := Generatescip-go gomod golang.org/x/tools . `golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator`/Generate().(s) |
| 303 | if errs != 0 { |
| 304 | t.Errorfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Errorf().("%d errors during Generate", errs) |
| 305 | } |
| 306 | |
| 307 | // build |
| 308 | cmd := execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().("go", "build", ".") |
| 309 | cmd.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = td |
| 310 | coutput, cerr := cmd.CombinedOutputscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#CombinedOutput().() |
| 311 | if cerr != nil { |
| 312 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("build failed: %s\n", string(coutput)) |
| 313 | } |
| 314 | |
| 315 | // run |
| 316 | cmd = execscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/.Commandscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Command().("./" + pack) |
| 317 | cmd.Dirscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#Dir. = td |
| 318 | coutput, cerr = cmd.CombinedOutputscip-go gomod github.com/golang/go/src go1.25.0 `os/exec`/Cmd#CombinedOutput().() |
| 319 | if cerr == nil { |
| 320 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("run passed, expected failure -- run output: %s", string(coutput)) |
| 321 | } |
| 322 | } |