diff options
author | Giovanni Bajo <rasky@develer.com> | 2018-03-01 01:55:33 +0100 |
---|---|---|
committer | Giovanni Bajo <rasky@develer.com> | 2018-03-01 18:14:54 +0000 |
commit | 0bcf8bcd998a79f2479c2bb7096eb57a38ffee85 (patch) | |
tree | c99c7ffe7c82975acc3e86f8a8da48d5565cabe8 /test/run.go | |
parent | 879a1ff1e494188a7aec8f094fac9bd71850d392 (diff) | |
download | go-0bcf8bcd998a79f2479c2bb7096eb57a38ffee85.tar.gz go-0bcf8bcd998a79f2479c2bb7096eb57a38ffee85.zip |
test: in asmcheck, regexp must match from beginning of line
This avoid simple bugs like "ADD" matching "FADD". Obviously
"ADD" will still match "ADDQ" so some care is still required
in this regard, but at least a first class of possible errors
is taken care of.
Change-Id: I7deb04c31de30bedac9c026d9889ace4a1d2adcb
Reviewed-on: https://go-review.googlesource.com/97817
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/run.go')
-rw-r--r-- | test/run.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/run.go b/test/run.go index 271a6f8014..8f2ec7e2f9 100644 --- a/test/run.go +++ b/test/run.go @@ -1307,7 +1307,16 @@ func (t *test) wantedAsmOpcodes(fn string) (map[string]map[string][]wantedAsmOpc if err != nil { log.Fatalf("%s:%d: error unquoting string: %v", t.goFileName(), i+1, err) } - oprx, err := regexp.Compile(rxsrc) + + // Compile the checks as regular expressions. Notice that we + // consider checks as matching from the beginning of the actual + // assembler source (that is, what is left on each line of the + // compile -S output after we strip file/line info) to avoid + // trivial bugs such as "ADD" matching "FADD". This + // doesn't remove genericity: it's still possible to write + // something like "F?ADD", but we make common cases simpler + // to get right. + oprx, err := regexp.Compile("^" + rxsrc) if err != nil { log.Fatalf("%s:%d: %v", t.goFileName(), i+1, err) } |