All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] nm01: Remove prefix zeros of the addresses output by nm before comparing
@ 2019-12-31  7:02 zhe.he
  2019-12-31  9:05 ` Li Wang
  2020-01-03 14:14 ` Petr Vorel
  0 siblings, 2 replies; 3+ messages in thread
From: zhe.he @ 2019-12-31  7:02 UTC (permalink / raw)
  To: ltp

From: He Zhe <zhe.he@windriver.com>

The latest nm v2.33.1.20191208 outputs symbols addresses without prefix zeros
for "nm -f posix", which causes the following error.
nm01 5 TFAIL: Got wrong format with -f bsd

Let's remove the prefix zeros before comparing.

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
v2:
Add boundary mark to RE pattern to exactly cover the prefix zeros
Add one more temp file to contain trimmed output

 testcases/commands/nm/nm01.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/testcases/commands/nm/nm01.sh b/testcases/commands/nm/nm01.sh
index 30c41bd..fd9d3d9 100755
--- a/testcases/commands/nm/nm01.sh
+++ b/testcases/commands/nm/nm01.sh
@@ -84,8 +84,11 @@ test5()
 	EXPECT_PASS $NM -f bsd $TST_DATAROOT/f1 \> nm_bsd.out
 	EXPECT_PASS $NM -f posix $TST_DATAROOT/f1 \> nm_posix.out
 
-	ROD awk '{print $3 $2 $1}' nm_bsd.out \> nm1.out
-	ROD awk '{print $1 $2 $3}' nm_posix.out \> nm2.out
+	ROD awk '{print gensub(/\y(0+)([0-9a-fA-F]+)\y/, "\\2", "g")}' nm_bsd.out \> trimmed_nm_bsd.out
+	ROD awk '{print gensub(/\y(0+)([0-9a-fA-F]+)\y/, "\\2", "g")}' nm_posix.out \> trimmed_nm_posix.out
+
+	ROD awk '{print $3 $2 $1}' trimmed_nm_bsd.out \> nm1.out
+	ROD awk '{print $1 $2 $3}' trimmed_nm_posix.out \> nm2.out
 
 	if diff nm1.out nm2.out > /dev/null; then
 		tst_res TPASS "Got BSD format with -f bsd"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH v2] nm01: Remove prefix zeros of the addresses output by nm before comparing
  2019-12-31  7:02 [LTP] [PATCH v2] nm01: Remove prefix zeros of the addresses output by nm before comparing zhe.he
@ 2019-12-31  9:05 ` Li Wang
  2020-01-03 14:14 ` Petr Vorel
  1 sibling, 0 replies; 3+ messages in thread
From: Li Wang @ 2019-12-31  9:05 UTC (permalink / raw)
  To: ltp

On Tue, Dec 31, 2019 at 3:03 PM <zhe.he@windriver.com> wrote:

> From: He Zhe <zhe.he@windriver.com>
>
> The latest nm v2.33.1.20191208 outputs symbols addresses without prefix
> zeros
> for "nm -f posix", which causes the following error.
> nm01 5 TFAIL: Got wrong format with -f bsd
>
> Let's remove the prefix zeros before comparing.
>
> Signed-off-by: He Zhe <zhe.he@windriver.com>
>
Reviewed-by: Li Wang <liwang@redhat.com>


> ---
> v2:
> Add boundary mark to RE pattern to exactly cover the prefix zeros
> Add one more temp file to contain trimmed output
>
>  testcases/commands/nm/nm01.sh | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/commands/nm/nm01.sh b/testcases/commands/nm/nm01.sh
> index 30c41bd..fd9d3d9 100755
> --- a/testcases/commands/nm/nm01.sh
> +++ b/testcases/commands/nm/nm01.sh
> @@ -84,8 +84,11 @@ test5()
>         EXPECT_PASS $NM -f bsd $TST_DATAROOT/f1 \> nm_bsd.out
>         EXPECT_PASS $NM -f posix $TST_DATAROOT/f1 \> nm_posix.out
>
> -       ROD awk '{print $3 $2 $1}' nm_bsd.out \> nm1.out
> -       ROD awk '{print $1 $2 $3}' nm_posix.out \> nm2.out
> +       ROD awk '{print gensub(/\y(0+)([0-9a-fA-F]+)\y/, "\\2", "g")}'
> nm_bsd.out \> trimmed_nm_bsd.out
> +       ROD awk '{print gensub(/\y(0+)([0-9a-fA-F]+)\y/, "\\2", "g")}'
> nm_posix.out \> trimmed_nm_posix.out
> +
> +       ROD awk '{print $3 $2 $1}' trimmed_nm_bsd.out \> nm1.out
> +       ROD awk '{print $1 $2 $3}' trimmed_nm_posix.out \> nm2.out
>
>         if diff nm1.out nm2.out > /dev/null; then
>                 tst_res TPASS "Got BSD format with -f bsd"
> --
> 2.7.4
>
>

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20191231/01d7c5e8/attachment.htm>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] [PATCH v2] nm01: Remove prefix zeros of the addresses output by nm before comparing
  2019-12-31  7:02 [LTP] [PATCH v2] nm01: Remove prefix zeros of the addresses output by nm before comparing zhe.he
  2019-12-31  9:05 ` Li Wang
@ 2020-01-03 14:14 ` Petr Vorel
  1 sibling, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2020-01-03 14:14 UTC (permalink / raw)
  To: ltp

Hi He,

thanks for your patch, merged.

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-03 14:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-31  7:02 [LTP] [PATCH v2] nm01: Remove prefix zeros of the addresses output by nm before comparing zhe.he
2019-12-31  9:05 ` Li Wang
2020-01-03 14:14 ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.