Skip to content

Testcase SpinningThreads_longHeapHeader failed on aarch64 #19

@fish2bird

Description

@fish2bird

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

struct Compare {
bool operator()(const UseTalliesValue& left,
const UseTalliesValue& right) const {
// Sort in decreasing order of total bytes.
if (left.second.second > right.second.second) {
return true;
}
if (left.second.second < right.second.second) {
return false;
}
// In case of matching total bytes, sort by decreasing
// total number of ranges.
if (left.second.first > right.second.first) {
return true;
}
if (left.second.first < right.second.first) {
return false;
}
// in case of matching # bytes and #ranges, sort by increasing lexical
// order of usage category.
return left.first < right.first;
}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions