[PATCH] tests/tcg/aarch64: Use raw strings for regexes in test-mte.py

Gustavo Romero posted 1 patch 1 week ago
tests/tcg/aarch64/gdbstub/test-mte.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] tests/tcg/aarch64: Use raw strings for regexes in test-mte.py
Posted by Gustavo Romero 1 week ago
Use Python's raw string notation instead of string literals for regex so
it's not necessary to double backslashes when regex special forms are
used. Raw notation is preferred for regex and easier to read.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
---
 tests/tcg/aarch64/gdbstub/test-mte.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/tcg/aarch64/gdbstub/test-mte.py b/tests/tcg/aarch64/gdbstub/test-mte.py
index a4cae6caa0..9ad98e7a54 100644
--- a/tests/tcg/aarch64/gdbstub/test-mte.py
+++ b/tests/tcg/aarch64/gdbstub/test-mte.py
@@ -23,8 +23,8 @@
 from test_gdbstub import arg_parser, main, report
 
 
-PATTERN_0 = "Memory tags for address 0x[0-9a-f]+ match \\(0x[0-9a-f]+\\)."
-PATTERN_1 = ".*(0x[0-9a-f]+)"
+PATTERN_0 = r"Memory tags for address 0x[0-9a-f]+ match \(0x[0-9a-f]+\)."
+PATTERN_1 = r".*(0x[0-9a-f]+)"
 
 
 def run_test():
-- 
2.34.1
Re: [PATCH] tests/tcg/aarch64: Use raw strings for regexes in test-mte.py
Posted by Alex Bennée 1 day, 12 hours ago
Gustavo Romero <gustavo.romero@linaro.org> writes:

> Use Python's raw string notation instead of string literals for regex so
> it's not necessary to double backslashes when regex special forms are
> used. Raw notation is preferred for regex and easier to read.
>
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>

Queued to gdbstub/next, thanks.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH] tests/tcg/aarch64: Use raw strings for regexes in test-mte.py
Posted by Philippe Mathieu-Daudé 1 week ago
On 15/10/24 11:08, Gustavo Romero wrote:
> Use Python's raw string notation instead of string literals for regex so
> it's not necessary to double backslashes when regex special forms are
> used. Raw notation is preferred for regex and easier to read.
> 
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> ---
>   tests/tcg/aarch64/gdbstub/test-mte.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>