]> Cypherpunks repositories - gostls13.git/commitdiff
test: relax whitespaces matching in codegen tests
authorGiovanni Bajo <rasky@develer.com>
Sat, 19 May 2018 07:42:52 +0000 (09:42 +0200)
committerGiovanni Bajo <rasky@develer.com>
Sun, 2 Sep 2018 10:31:37 +0000 (10:31 +0000)
The codegen testsuite uses regexp to parse the syntax, but it doesn't
have a way to tell line comments containing checks from line comments
containing English sentences. This means that any syntax error (that
is, non-matching regexp) is currently ignored and not reported.

There were some tests in memcombine.go that had an extraneous space
and were thus effectively disabled. It would be great if we could
report it as a syntax error, but for now we just punt and swallow the
spaces as a workaround, to avoid the same mistake again.

Fixes #25452

Change-Id: Ic7747a2278bc00adffd0c199ce40937acbbc9cf0
Reviewed-on: https://go-review.googlesource.com/113835
Run-TryBot: Giovanni Bajo <rasky@develer.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
test/codegen/memcombine.go
test/run.go

index 0db366250f25bbcb187193409c071a35178b1988..9c4b36818e270d7a3a39576d4dd6ff2f3ee1f081 100644 (file)
@@ -503,7 +503,7 @@ func zero_byte_16(b []byte) {
 
 /* TODO: enable them when corresponding optimization are implemented
 func zero_byte_4_idx(b []byte, idx int) {
-       // arm64: `MOVW\sZR,\s\(R[0-9]+\)\(R[0-9]+<<2\)`,-`MOV[BH]`
+       // arm64(DISABLED): `MOVW\sZR,\s\(R[0-9]+\)\(R[0-9]+<<2\)`,-`MOV[BH]`
        b[(idx<<2)+0] = 0
        b[(idx<<2)+1] = 0
        b[(idx<<2)+2] = 0
@@ -511,7 +511,7 @@ func zero_byte_4_idx(b []byte, idx int) {
 }
 
 func zero_byte_8_idx(b []byte, idx int) {
-       // arm64: `MOVD\sZR,\s\(R[0-9]+\)\(R[0-9]+<<3\)`,-`MOV[BHW]`
+       // arm64(DISABLED): `MOVD\sZR,\s\(R[0-9]+\)\(R[0-9]+<<3\)`,-`MOV[BHW]`
        b[(idx<<3)+0] = 0
        b[(idx<<3)+1] = 0
        b[(idx<<3)+2] = 0
index 82508d1c1fa536271b90de98eefda455b5f7a3df..24a4d4f425fe171c304e8933e041e9de60cafcbb 100644 (file)
@@ -1329,11 +1329,12 @@ const (
 
 var (
        // Regexp to split a line in code and comment, trimming spaces
-       rxAsmComment = regexp.MustCompile(`^\s*(.*?)\s*(?:\/\/\s*(.+)\s*)?$`)
+       rxAsmComment = regexp.MustCompile(`^\s*(.*?)\s*(?://\s*(.+)\s*)?$`)
 
-       // Regexp to extract an architecture check: architecture name, followed by semi-colon,
-       // followed by a comma-separated list of opcode checks.
-       rxAsmPlatform = regexp.MustCompile(`(\w+)(/\w+)?(/\w*)?:(` + reMatchCheck + `(?:,` + reMatchCheck + `)*)`)
+       // Regexp to extract an architecture check: architecture name (or triplet),
+       // followed by semi-colon, followed by a comma-separated list of opcode checks.
+       // Extraneous spaces are ignored.
+       rxAsmPlatform = regexp.MustCompile(`(\w+)(/\w+)?(/\w*)?\s*:\s*(` + reMatchCheck + `(?:\s*,\s*` + reMatchCheck + `)*)`)
 
        // Regexp to extract a single opcoded check
        rxAsmCheck = regexp.MustCompile(reMatchCheck)