Skip to content

Commit affa223

Browse files
authored
Merge pull request #872 from DeusData/fix/dryrun-strict-allgreen
harden dry run to strict all-green: windows-11-arm mem_rss + no optional legs
2 parents 60e1769 + 0789c63 commit affa223

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

.github/workflows/_test.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ jobs:
3838
{"os":"macos-14","cc":"cc","cxx":"c++"},
3939
{"os":"macos-15-intel","cc":"cc","cxx":"c++"}
4040
]'
41+
# Broad matrix legs are REQUIRED gates (no optional/continue-on-error
42+
# escape hatches): the release dry run must be all-green, every platform.
4143
BROAD_UNIX='[
42-
{"os":"ubuntu-22.04","cc":"gcc","cxx":"g++","optional":true},
43-
{"os":"ubuntu-22.04-arm","cc":"gcc","cxx":"g++","optional":true},
44-
{"os":"macos-15","cc":"cc","cxx":"c++","optional":true}
44+
{"os":"ubuntu-22.04","cc":"gcc","cxx":"g++"},
45+
{"os":"ubuntu-22.04-arm","cc":"gcc","cxx":"g++"},
46+
{"os":"macos-15","cc":"cc","cxx":"c++"}
4547
]'
4648
# Each Windows leg pins the msys2 environment + package arch to the
4749
# RUNNER architecture so the build is native, never emulated:
@@ -53,7 +55,7 @@ jobs:
5355
# the native ARM64 toolchain ASan instruments native ARM64 code, so it
5456
# is a real (non-optional) gate, not a tolerated emulated-flake.
5557
CORE_WIN='[{"os":"windows-latest","msystem":"CLANG64","pkg":"x86_64"}]'
56-
BROAD_WIN='[{"os":"windows-2025","optional":true,"msystem":"CLANG64","pkg":"x86_64"},{"os":"windows-11-arm","msystem":"CLANGARM64","pkg":"aarch64"}]'
58+
BROAD_WIN='[{"os":"windows-2025","msystem":"CLANG64","pkg":"x86_64"},{"os":"windows-11-arm","msystem":"CLANGARM64","pkg":"aarch64"}]'
5759
if [ "$BROAD" = "true" ]; then
5860
UNIX=$(jq -cn --argjson a "$CORE_UNIX" --argjson b "$BROAD_UNIX" '$a + $b')
5961
WIN=$(jq -cn --argjson a "$CORE_WIN" --argjson b "$BROAD_WIN" '$a + $b')

tests/test_mem.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,21 +261,30 @@ TEST(mem_rss_reflects_external_resident_memory) {
261261
ASSERT_NOT_NULL(mi_buf);
262262
memset(mi_buf, 0x11, warm);
263263

264-
const size_t region = (size_t)256 * 1024 * 1024; /* 256 MB true RSS */
265-
const size_t threshold = (size_t)128 * 1024 * 1024; /* generous half */
264+
const size_t region = (size_t)256 * 1024 * 1024; /* 256 MB true RSS */
266265

267266
#ifdef _WIN32
268-
/* Windows current_rss (WorkingSetSize) is accurate; a plain resident
269-
* allocation is reflected regardless of allocator. No Linux undercount. */
267+
/* On Windows cbm_mem_rss() reads WorkingSetSize (GetProcessMemoryInfo),
268+
* which the OS trims under memory pressure — so a touched region can drop
269+
* out of the resident set (a stressed windows-11-arm runner kept only
270+
* ~97 MB resident of a 256 MB touch). Re-touch the region immediately before
271+
* measuring so its pages are freshly resident, and assert a threshold that
272+
* survives aggressive trimming while staying far above the ~1 MB mimalloc
273+
* warm buffer. This still guards the real regression — cbm_mem_rss()
274+
* reporting a broken small counter instead of true resident memory — which
275+
* the Linux #else branch exercises directly against the undercount. */
276+
const size_t threshold = (size_t)32 * 1024 * 1024;
270277
void *big = malloc(region);
271278
ASSERT_NOT_NULL(big);
272279
memset(big, 0x5A, region);
280+
memset(big, 0x5B, region); /* re-touch right before the measurement */
273281
size_t rss = cbm_mem_rss();
274282
ASSERT_GTE(rss, threshold);
275283
free(big);
276284
#else
277285
/* (2) Raw mmap bypasses mimalloc entirely: its committed counter does NOT
278286
* grow, but the true RSS does — this is what exposes the Linux undercount. */
287+
const size_t threshold = (size_t)128 * 1024 * 1024; /* generous half of region */
279288
void *big = mmap(NULL, region, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
280289
ASSERT_TRUE(big != MAP_FAILED);
281290
memset(big, 0x5A, region); /* fault every page in → resident */

0 commit comments

Comments
 (0)