From 3b5c817786cd28599fd995d3d765fd86fc9cec56 Mon Sep 17 00:00:00 2001 From: Khairul Azhar Kasmiran Date: Thu, 3 Apr 2025 20:59:14 +0800 Subject: [PATCH] Add search-consistency-test macro to reduce repetition (#5063) --- test/db/cmd/cmd_search | 7 +++---- test/db/cmd/regexp | 8 +++----- test/scripts/search-consistency-test.rz | 6 +++++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/test/db/cmd/cmd_search b/test/db/cmd/cmd_search index cd22f429e4..aca29f7632 100644 --- a/test/db/cmd/cmd_search +++ b/test/db/cmd/cmd_search @@ -955,10 +955,9 @@ CMDS=< /dev/null ps ascii @ hit.string.ascii.0 diff --git a/test/scripts/search-consistency-test.rz b/test/scripts/search-consistency-test.rz index 4937bc03ff..9003476f22 100644 --- a/test/scripts/search-consistency-test.rz +++ b/test/scripts/search-consistency-test.rz @@ -1,5 +1,9 @@ -# $setup and $bin need to be defined before calling this script's macros +# $setup and $bin need to be defined before calling these macros: (show_intervals cmd; !!rizin -qc "e search.show_progress=intervals; `$setup`; `echo ${cmd}`" -1 `$bin` | grep "^.*[[:punct:]]0x.*" | sed "s/^.*[[:cntrl:]]//"~$0) (show_hits cmd; !!rizin -qc "`$setup`; `echo ${cmd}`" `$bin`) (search.show_progress cmd; .(show_intervals ${cmd}); .(show_hits ${cmd})) + +# Additionally, $cmd_z, $cmd_x and $str need to be defined before calling the macro below: + +(search-consistency-test; .(search.show_progress "(cmd_z str; `$cmd_z`); .(cmd_z `$str`)"); echo "----"; .(search.show_progress "(cmd_x bytes; `$cmd_x`); .(cmd_x \`%x `$str`\`)"))