diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2024-05-06 13:10:47 +0200 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2024-05-06 11:24:51 +0000 |
commit | ea57a160e8531b94586a48294d3b1831c45bd2c9 (patch) | |
tree | 28b67ad3c5fd198cac03c73b982221bddea98d61 | |
parent | 441f4fcc08ae33f36e5a15a9dd5abde3f0797921 (diff) | |
download | syzkaller-ea57a160e8531b94586a48294d3b1831c45bd2c9.tar.gz |
prog: enable debug checking in all tests
-rw-r--r-- | prog/test/fuzz.go | 1 | ||||
-rw-r--r-- | prog/validation.go | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/prog/test/fuzz.go b/prog/test/fuzz.go index 2ed32c737..ab2582cbe 100644 --- a/prog/test/fuzz.go +++ b/prog/test/fuzz.go @@ -65,7 +65,6 @@ func FuzzParseLog(data []byte) int { } var fuzzTarget, fuzzChoiceTable = func() (*prog.Target, *prog.ChoiceTable) { - prog.Debug() target, err := prog.GetTarget(targets.TestOS, targets.TestArch64) if err != nil { panic(err) diff --git a/prog/validation.go b/prog/validation.go index 38cc3873e..ccaa4b990 100644 --- a/prog/validation.go +++ b/prog/validation.go @@ -5,12 +5,17 @@ package prog import ( "fmt" + "os" + "strings" ) var debug = false // enabled in tests and fuzzers -func Debug() { - debug = true +func init() { + // Enable debug checking in all tests. + if strings.HasSuffix(os.Args[0], ".test") { + debug = true + } } func (p *Prog) debugValidate() { |