From f02cc88f46e01c21e550dbf212aefcdad138a91d Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Sat, 19 May 2018 09:42:52 +0200 Subject: [PATCH] test: relax whitespaces matching in codegen tests 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 TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- test/codegen/memcombine.go | 4 ++-- test/run.go | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go index 0db366250f..9c4b36818e 100644 --- a/test/codegen/memcombine.go +++ b/test/codegen/memcombine.go @@ -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 diff --git a/test/run.go b/test/run.go index 82508d1c1f..24a4d4f425 100644 --- a/test/run.go +++ b/test/run.go @@ -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) -- 2.48.1