mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: make GOSSAHASH package-sensitive, also append to log files
Turns out if your failure is in a function with a name like "Reset()" there will be a lot of hits on the same hashcode. Adding package sensitivity solves this problem. In additionm, it turned out that in the case that a logfile was specified for the GOSSAHASH logging, that it was opened in create mode, which meant that multiple compiler invocations would reset the file to zero length. Opening in append mode works better; the automated harness (github.com/dr2chase/gossahash) takes care of truncating the file before use. Change-Id: I5601bc280faa94cbd507d302448831849db6c842 Reviewed-on: https://go-review.googlesource.com/c/go/+/246937 Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
c0602603b2
commit
4220d67084
4 changed files with 15 additions and 3 deletions
|
|
@ -678,7 +678,8 @@ func (f *Func) invalidateCFG() {
|
|||
// GSHS_LOGFILE
|
||||
// or standard out if that is empty or there is an error
|
||||
// opening the file.
|
||||
func (f *Func) DebugHashMatch(evname, name string) bool {
|
||||
func (f *Func) DebugHashMatch(evname string) bool {
|
||||
name := f.fe.MyImportPath() + "." + f.Name
|
||||
evhash := os.Getenv(evname)
|
||||
switch evhash {
|
||||
case "":
|
||||
|
|
@ -727,7 +728,7 @@ func (f *Func) logDebugHashMatch(evname, name string) {
|
|||
file = os.Stdout
|
||||
if tmpfile := os.Getenv("GSHS_LOGFILE"); tmpfile != "" {
|
||||
var err error
|
||||
file, err = os.Create(tmpfile)
|
||||
file, err = os.OpenFile(tmpfile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
if err != nil {
|
||||
f.Fatalf("could not open hash-testing logfile %s", tmpfile)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue