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
This commit is contained in:
Khairul Azhar Kasmiran 2024-12-16 21:37:41 +08:00 committed by GitHub
parent 325dfdad7d
commit e7b919f001
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View file

@ -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));
}

View file

@ -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=<<EOF
@ -165,7 +164,6 @@ f34
hit breakpoint at:
f38
EOF
RUN
@ -203,7 +201,6 @@ ee3
rax
0a0
EOF
REGEXP_FILTER_ERR=((hit\sbreakpoint\sat:)|([0-9a-f][0-9a-f][0-9a-f]\n))
EXPECT_ERR=<<EOF
@ -215,6 +212,5 @@ edd
hit breakpoint at:
ee3
EOF
RUN