Skip to content

Commit 42c3ea5

Browse files
test(symresolver): drop the direct resolver_load_bias unit test
Testing a static by #include-ing the .c and calling it directly couples the test to the implementation and bypasses the public contract. The load-bias fix is already exercised through the PUBLIC API by test_symres_static_symbol_resolves (SymbolResolverResolve -> the bias computation); on a native 64 KiB-page arm64 image that public test drives exactly the straddle path the fix addresses. Remove the redundant direct-internal test.
1 parent 1a3bfa4 commit 42c3ea5

1 file changed

Lines changed: 0 additions & 29 deletions

File tree

Tests/Std/SymbolResolver.Internal.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -575,39 +575,10 @@ bool test_sr3_deinit_frees_everything(void) {
575575
return ok;
576576
}
577577

578-
// resolver_load_bias must pick the PT_LOAD by the resolved address's own
579-
// file offset, not the page-aligned mapping start. On aarch64's 64 KiB
580-
// max-page-size, the data segment's maps file offset rounds down below the
581-
// segment's p_offset, so one page straddles two PT_LOADs; selecting by the
582-
// mapping offset lands on the wrong segment and biases the result by a page.
583-
static bool test_sr_load_bias_64k_page_straddle(void) {
584-
DefaultAllocator alloc = DefaultAllocatorInit();
585-
Allocator *a = ALLOCATOR_OF(&alloc);
586-
587-
Elf elf = {0};
588-
elf.segments = VecInitT(elf.segments, a);
589-
ElfSegment s0 = {.type = ELF_PT_LOAD, .offset = 0, .vaddr = 0, .filesz = 0x8fdb0};
590-
ElfSegment s1 = {.type = ELF_PT_LOAD, .offset = 0x8fdb0, .vaddr = 0x9fdb0, .filesz = 0x1000};
591-
VecPushBackR(&elf.segments, s0);
592-
VecPushBackR(&elf.segments, s1);
593-
594-
u64 bias = 0x550000000000ull;
595-
u64 runtime_addr = bias + 0x9fe00; // a point inside s1's p_vaddr range
596-
u64 map_start = bias + 0x90000; // 64 KiB-page-aligned mapping start
597-
u64 map_file_off = 0x80000; // 64 KiB-page-aligned file offset (< s1.offset)
598-
599-
u64 got = resolver_load_bias(&elf, map_start, map_file_off, runtime_addr);
600-
601-
VecDeinit(&elf.segments);
602-
DefaultAllocatorDeinit(&alloc);
603-
return got == bias;
604-
}
605-
606578
int main(void) {
607579
WriteFmt("[INFO] Starting SymbolResolver.Internal tests\n\n");
608580

609581
TestFunction tests[] = {
610-
test_sr_load_bias_64k_page_straddle,
611582
// --- test_sr2_*: append_build_id_path ---
612583
test_sr2_bid_canonical,
613584
test_sr2_bid_full_path,

0 commit comments

Comments
 (0)