From e7b919f001c5894ee66aeae49567e6cf8dfc429a Mon Sep 17 00:00:00 2001 From: Khairul Azhar Kasmiran Date: Mon, 16 Dec 2024 21:37:41 +0800 Subject: [PATCH] rz-test: Fix no XX if expected output truncated when REGEXP_FILTER_OUT is set (#4770) * rz-test: Fix no XX if expected output truncated when REGEXP_FILTER_OUT is set * Fix archos/darwin-x64/dbg tests --- binrz/rz-test/run.c | 13 +++++++++++-- test/db/archos/darwin-x64/dbg | 4 ---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/binrz/rz-test/run.c b/binrz/rz-test/run.c index 4c39b2c313..da71892bd9 100644 --- a/binrz/rz-test/run.c +++ b/binrz/rz-test/run.c @@ -204,8 +204,17 @@ RZ_API bool rz_test_cmp_cmd_output(const char *output, const char *expect, const bool equal = false; ut32 expect_len = strlen(expect); if (expect_len > 0 && expect[expect_len - 1] == '\n') { - // Ignore newline - equal = (rz_str_cmp(expect, rz_strbuf_get(match_str), expect_len - 1) == 0); + // Ignore newline in expect + expect_len--; + int match_str_len = rz_strbuf_length(match_str); + if (match_str_len && rz_strbuf_get(match_str)[match_str_len - 1] == '\n') { + // Ignore newline in match_str + match_str_len--; + } + if (expect_len != match_str_len) { + return false; + } + equal = (rz_str_cmp(expect, rz_strbuf_get(match_str), expect_len) == 0); } else { equal = RZ_STR_EQ(expect, rz_strbuf_get(match_str)); } diff --git a/test/db/archos/darwin-x64/dbg b/test/db/archos/darwin-x64/dbg index 04e2480f93..94882bbab1 100644 --- a/test/db/archos/darwin-x64/dbg +++ b/test/db/archos/darwin-x64/dbg @@ -153,7 +153,6 @@ f38 rax 064 - EOF REGEXP_FILTER_ERR=((hit\sbreakpoint\sat:)|([0-9a-f][0-9a-f][0-9a-f]\n)) EXPECT_ERR=<