Skip to contentSkip to conversation

nm01: Remove prefix zeros of the addresses output by nm before comparing

PATCH New [email protected] 3 participants 3 messages Dec 31, 2019 – Jan 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nm01: Remove prefix zeros of the addresses output by nm before comparing

From: He Zhe <[email protected]>

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.

---
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(-)
testcases/commands/nm/nm01.sh +5 -2
index 30c41bd..fd9d3d9 100755
@@ -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"
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 nm01: Remove prefix zeros of the addresses output by nm before comparing

Quoted 11 lines · On Tue, Dec 31, 2019 at 3:03 PM <[email protected]> wrote:

From: He Zhe <[email protected]>

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.

Quoted 32 lines

---
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(-)
testcases/commands/nm/nm01.sh +1 -2
index 30c41bd..fd9d3d9 100755
@@ -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

testcases/commands/nm/nm01.sh +3 -1
+
+       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

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