[all-commits] [llvm/llvm-project] 17b659: [lldb] [unittests] Cover what the memory cache rea...

Yao Qi via All-commits all-commits at lists.llvm.org
Wed Sep 9 02:39:29 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 17b659b8444a957ea2b42cb4e91d65897fee7558
      https://github.com/llvm/llvm-project/commit/17b659b8444a957ea2b42cb4e91d65897fee7558
  Author: Yao Qi <yao_qi at apple.com>
  Date:   2026-09-09 (Wed, 09 Sep 2026)

  Changed paths:
    M lldb/unittests/Target/MemoryTest.cpp

  Log Message:
  -----------
  [lldb] [unittests] Cover what the memory cache reads from the inferior (#221015)

`MemoryCache`'s tests checked how many bytes a read returned, never
which requests the cache made to get them, so a change to the request
shape could not fail a test.  Add four tests over the request log
`DummyProcess` now keeps.

Two assert what the cache sends: `TestReadRequestShape` checks the
address and size of every request, and `TestReadRangesFromCaches` checks
that a range the cache already holds is served without reaching the
inferior.

`TestFlushAtTheTopOfTheAddressSpace` pins `Flush`'s current behavior at
the wrap, not correct behavior.  When a flushed range wraps past
`UINT64_MAX`, `Flush` counts cache lines only from the start of the
range to the top of the address space, never the lines the wrapped
portion covers between address 0 and the range's end.  This bug predates
this change; the following cache-partition change fixes it, and this
test's assertion that address 0 survives the flush will need to flip
once
that lands.

`TesetMemoryCacheRead` gains one assertion, that a line whose reply
falls short leaves the error alone, next to the two requests it already
checks.

Also add a `CacheTestProcess` helper and use it in the seven cache
tests, so each states its setup in two lines rather than thirteen, and
expose the L2 map next to L1 for assertions.

---------

Co-authored-by: Jonas Devlieghere <jonas at devlieghere.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list