chap icon indicating copy to clipboard operation
chap copied to clipboard

Testcase SpinningThreads_longHeapHeader failed on aarch64

Open fish2bird opened this issue 5 months ago • 0 comments

Describe the bug

LastTest.log:

27/29 Testing: expectedOutput/ELF64/LibcMalloc/SpinningThreads_longHeapHeader
27/29 Test: expectedOutput/ELF64/LibcMalloc/SpinningThreads_longHeapHeader
Command: "/usr1/code/chap/test/expectedOutput/driver" "/usr1/code/chap/build/chap" "/usr1/code/chap/test/expectedOutput/ELF64/LibcMalloc/SpinningThreads_longHeapHeader"
Directory: /usr1/code/chap/build/test/expectedOutput/ELF64/LibcMalloc/SpinningThreads_longHeapHeader
"expectedOutput/ELF64/LibcMalloc/SpinningThreads_longHeapHeader" start time: Aug 27 09:02 CST
Output:
----------------------------------------------------------
Wrote results to core.SpinningThreads.describe_arenas
Wrote results to core.SpinningThreads.describe_stacks
Wrote results to core.SpinningThreads.list_used
Wrote results to core.SpinningThreads.list_free
Wrote results to core.SpinningThreads.describe_writable
Wrote results to core.SpinningThreads.summarize_writable

diff --recursive '--unified=0' /usr1/code/chap/test/expectedOutput/ELF64/LibcMalloc/SpinningThreads_longHeapHeader/core.SpinningThreads.summarize_writable ./core.SpinningThreads.summarize_writable
--- /usr1/code/chap/test/expectedOutput/ELF64/LibcMalloc/SpinningThreads_longHeapHeader/core.SpinningThreads.summarize_writable 2025-08-26 11:57:55.751670364 +0800
+++ ./core.SpinningThreads.summarize_writable   2025-08-27 09:02:31.211494478 +0800
@@ -4 +3,0 @@
-1 ranges take 0x21000 bytes for use: main stack
@@ -5,0 +5 @@
+1 ranges take 0x21000 bytes for use: main stack
<end of output>
Test time =   1.90 sec
----------------------------------------------------------
Test Failed.
"expectedOutput/ELF64/LibcMalloc/SpinningThreads_longHeapHeader" end time: Aug 27 09:02 CST
"expectedOutput/ELF64/LibcMalloc/SpinningThreads_longHeapHeader" time elapsed: 00:00:01
----------------------------------------------------------

actual output

2 ranges take 0x1000000 bytes for use: used pthread stack
2 ranges take 0x1000000 bytes for use: cached pthread stack
4 ranges take 0x84000 bytes for use: libc malloc heap
1 ranges take 0x21000 bytes for use: libc malloc main arena pages
1 ranges take 0x21000 bytes for use: main stack
6 ranges take 0x1a000 bytes for use: used by module
2 ranges take 0x6000 bytes for use: unknown
18 writable ranges use 0x20e6000 (34,496,512) bytes.

expected

2 ranges take 0x1000000 bytes for use: used pthread stack
2 ranges take 0x1000000 bytes for use: cached pthread stack
4 ranges take 0x84000 bytes for use: libc malloc heap
1 ranges take 0x21000 bytes for use: main stack
1 ranges take 0x21000 bytes for use: libc malloc main arena pages
6 ranges take 0x1a000 bytes for use: used by module
2 ranges take 0x6000 bytes for use: unknown
18 writable ranges use 0x20e6000 (34,496,512) bytes.

Reproduction steps

build on aarch64 machine

  • CPU: aarch64
  • OS:eulerosv2r8
  • kernel version: 4.19.36
git clone --recursive https://github.com/vmware/chap.git
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
ctest --test-dir build

Expected behavior

All testcase pass

Additional context

root cause

https://github.com/vmware/chap/blob/452e7be4f6e28d990e5ba58a1fa5f9bc734d63c3/src/VirtualAddressMapCommands/SummarizeRanges.h#L36-L58

The comparison is to order by bytes desc, ranges desc, category ascend but Statement return left.first < right.first; mistake compare on pointer instead of string content.

by the way: current test/expectedOutput/ELF64/LibcMalloc/SpinningThreads_longHeapHeader/core.SpinningThreads.summarize_writable content is not sorted increasing lexical order of usage category while same bytes and ranges

fish2bird avatar Aug 27 '25 10:08 fish2bird