* [LTP] [PATCH v1] nm01: Fix BSD vs POSIX format comparison failure on Power
@ 2026-05-13 2:10 Wei Gao via ltp
2026-05-13 7:59 ` Andrea Cervesato via ltp
2026-05-13 8:51 ` [LTP] [PATCH v2] " Wei Gao via ltp
0 siblings, 2 replies; 4+ messages in thread
From: Wei Gao via ltp @ 2026-05-13 2:10 UTC (permalink / raw)
To: ltp
On Power architecture, symbol names can contain hex-like prefixes such
as "0000003e.plt_call.__gmon_start__".
In our openqa specific power system, the gensub seems has some
compatible issue which you can see following trace, the BSD format's
symbol name was incorrectly trimmed to ".plt_call.__gmon_start__"
(losing the "3e"), while the POSIX format kept it as
"3e.plt_call.__gmon_start__".
Example failure from a Power machine:
--- DEBUG nm01_sh ---
--- RAW BSD ---
00000000000005e0 t 0000003e.plt_call.__gmon_start__
--- RAW POSIX ---
0000003e.plt_call.__gmon_start__ t 5e0
--- REPRO LTP LOGIC ---
--- TRIMMED BSD ---
5e0 t .plt_call.__gmon_start__
--- TRIMMED POSIX ---
3e.plt_call.__gmon_start__ t 5e0
--- REORDERED BSD (nm1) ---
.plt_call.__gmon_start__t5e0
--- REORDERED POSIX (nm2) ---
3e.plt_call.__gmon_start__t5e0
--- DIFF RESULT ---
--- /tmp/dbg_nm1 2026-05-11 22:33:54.754648941 -0400
+++ /tmp/dbg_nm2 2026-05-11 22:33:54.761924742 -0400
@@ -1,7 +1,7 @@
-.plt_call.__gmon_start__t5e0
+3e.plt_call.__gmon_start__t5e0
--- END DEBUG ---
Replace the global gensub to simple sub approach with targeted field processing in awk
can fix the issue.
Signed-off-by: Wei Gao <wegao@suse.com>
---
testcases/commands/nm/nm01.sh | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/testcases/commands/nm/nm01.sh b/testcases/commands/nm/nm01.sh
index c795d47ff..2ca73c4ea 100755
--- a/testcases/commands/nm/nm01.sh
+++ b/testcases/commands/nm/nm01.sh
@@ -83,17 +83,28 @@ 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 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
+ ROD awk '{
+ if (NF == 2) { val = "0"; type = $1; name = $2; }
+ else { val = $1; type = $2; name = $3; }
+ sub(/^0+/, "", val); if (val == "") val = "0";
+ sub(/^0+/, "", name);
+ print name type val
+ }' nm_bsd.out \> nm1.out
+
+ ROD awk '{
+ val = $3; type = $2; name = $1;
+ sub(/^0+/, "", val); if (val == "") val = "0";
+ sub(/^0+/, "", name);
+ print name type val
+ }' nm_posix.out \> nm2.out
if diff nm1.out nm2.out > /dev/null; then
tst_res TPASS "Got BSD format with -f bsd"
else
tst_res TFAIL "Got wrong format with -f bsd"
cat nm_bsd.out
+ cat nm_posix.out
+ diff -u nm1.out nm2.out
fi
}
--
2.52.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH v1] nm01: Fix BSD vs POSIX format comparison failure on Power
2026-05-13 2:10 [LTP] [PATCH v1] nm01: Fix BSD vs POSIX format comparison failure on Power Wei Gao via ltp
@ 2026-05-13 7:59 ` Andrea Cervesato via ltp
2026-05-13 8:51 ` [LTP] [PATCH v2] " Wei Gao via ltp
1 sibling, 0 replies; 4+ messages in thread
From: Andrea Cervesato via ltp @ 2026-05-13 7:59 UTC (permalink / raw)
To: Wei Gao via ltp; +Cc: ltp
Hi Wei,
patch is not applying
https://patchwork.ozlabs.org/project/ltp/patch/20260513021036.12127-1-wegao@suse.com/
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH v2] nm01: Fix BSD vs POSIX format comparison failure on Power
2026-05-13 2:10 [LTP] [PATCH v1] nm01: Fix BSD vs POSIX format comparison failure on Power Wei Gao via ltp
2026-05-13 7:59 ` Andrea Cervesato via ltp
@ 2026-05-13 8:51 ` Wei Gao via ltp
2026-05-13 10:37 ` [LTP] " linuxtestproject.agent
1 sibling, 1 reply; 4+ messages in thread
From: Wei Gao via ltp @ 2026-05-13 8:51 UTC (permalink / raw)
To: ltp
On Power architecture, symbol names can contain hex-like prefixes such
as "0000003e.plt_call.__gmon_start__".
In our openqa specific power system, the gensub seems has some
compatible issue which you can see following trace, the BSD format's
symbol name was incorrectly trimmed to ".plt_call.__gmon_start__"
(losing the "3e"), while the POSIX format kept it as
"3e.plt_call.__gmon_start__".
Example failure from a Power machine:
--- DEBUG nm01_sh ---
--- RAW BSD ---
00000000000005e0 t 0000003e.plt_call.__gmon_start__
--- RAW POSIX ---
0000003e.plt_call.__gmon_start__ t 5e0
--- REPRO LTP LOGIC ---
--- TRIMMED BSD ---
5e0 t .plt_call.__gmon_start__
--- TRIMMED POSIX ---
3e.plt_call.__gmon_start__ t 5e0
--- REORDERED BSD (nm1) ---
.plt_call.__gmon_start__t5e0
--- REORDERED POSIX (nm2) ---
3e.plt_call.__gmon_start__t5e0
--- DIFF RESULT ---
--- /tmp/dbg_nm1 2026-05-11 22:33:54.754648941 -0400
+++ /tmp/dbg_nm2 2026-05-11 22:33:54.761924742 -0400
@@ -1,7 +1,7 @@
-.plt_call.__gmon_start__t5e0
+3e.plt_call.__gmon_start__t5e0
--- END DEBUG ---
Replace the global gensub to simple sub approach with targeted field processing in awk
can fix the issue.
Signed-off-by: Wei Gao <wegao@suse.com>
---
v1->v2:
Update commit message to fix patch apply error
testcases/commands/nm/nm01.sh | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/testcases/commands/nm/nm01.sh b/testcases/commands/nm/nm01.sh
index c795d47ff..2ca73c4ea 100755
--- a/testcases/commands/nm/nm01.sh
+++ b/testcases/commands/nm/nm01.sh
@@ -83,17 +83,28 @@ 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 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
+ ROD awk '{
+ if (NF == 2) { val = "0"; type = $1; name = $2; }
+ else { val = $1; type = $2; name = $3; }
+ sub(/^0+/, "", val); if (val == "") val = "0";
+ sub(/^0+/, "", name);
+ print name type val
+ }' nm_bsd.out \> nm1.out
+
+ ROD awk '{
+ val = $3; type = $2; name = $1;
+ sub(/^0+/, "", val); if (val == "") val = "0";
+ sub(/^0+/, "", name);
+ print name type val
+ }' nm_posix.out \> nm2.out
if diff nm1.out nm2.out > /dev/null; then
tst_res TPASS "Got BSD format with -f bsd"
else
tst_res TFAIL "Got wrong format with -f bsd"
cat nm_bsd.out
+ cat nm_posix.out
+ diff -u nm1.out nm2.out
fi
}
--
2.52.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [LTP] nm01: Fix BSD vs POSIX format comparison failure on Power
2026-05-13 8:51 ` [LTP] [PATCH v2] " Wei Gao via ltp
@ 2026-05-13 10:37 ` linuxtestproject.agent
0 siblings, 0 replies; 4+ messages in thread
From: linuxtestproject.agent @ 2026-05-13 10:37 UTC (permalink / raw)
To: Wei Gao; +Cc: ltp, LTP AI Reviewer
Hi Wei,
On 2026-05-13, Wei Gao wrote:
> nm01: Fix BSD vs POSIX format comparison failure on Power
> - ROD awk '{print gensub(/\y(0+)([0-9a-fA-F]+)\y/, "\\2", "g")}' nm_bsd.out \> trimmed_nm_bsd.out
> + ROD awk '{
> + if (NF == 2) { val = "0"; type = $1; name = $2; }
> + else { val = $1; type = $2; name = $3; }
> + sub(/^0+/, "", val); if (val == "") val = "0";
> + sub(/^0+/, "", name);
> + print name type val
> + }' nm_bsd.out \> nm1.out
Good fix. Replacing gensub() (gawk extension) with sub() is the right
approach here and correctly handles the hex-prefix symbol names on Power.
Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com>
Pre-existing issues noticed in the surrounding code (not introduced
by this patch):
- testcases/commands/nm/nm01.sh — Uses intermediate API (. tst_test.sh /
tst_run) rather than the current style with tst_loader.sh and doc/env
blocks. Not a blocker for this fix.
---
Note:
Our agent completed the review of the patch.
The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-13 10:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 2:10 [LTP] [PATCH v1] nm01: Fix BSD vs POSIX format comparison failure on Power Wei Gao via ltp
2026-05-13 7:59 ` Andrea Cervesato via ltp
2026-05-13 8:51 ` [LTP] [PATCH v2] " Wei Gao via ltp
2026-05-13 10:37 ` [LTP] " linuxtestproject.agent
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox