图库: 恢复缩略图 LRU 跳过解压页缓存(M11 P2-1 回归),补启动空列表/prune 回归测试(M13 评审 P2)

- ui/library/library.c cache_prune:rebase 时丢失了 M11 c775f85 的必修保护,
  恢复 `if (mr_cache_is_page_name(de->d_name)) continue;`(在 .bmp 过滤之前)。
  解压页缓存与缩略图同目录,mrpage_* 归 page_cache 自己的 64 页/32MiB LRU 管理;
  否则档案页被缩略图 LRU 统计并删除 → 每翻页重解压,且「touch 命中→解码」窗口内
  可能被删导致解码失败。
- 回归测试(MR_LIBRARY_UI_TEST_HOOKS 接缝):test_browse_ui_host 新增 U6——
  预置 1 个最旧 mrpage_*.bmp + 65 个较新缩略图,调用 library_test_cache_prune(),
  断言 mrpage_* 保留且不计入 64 张额度、缩略图被裁到 64;已验证去掉修复时该用例
  会失败(防止再次在 rebase 中丢失)。
- 顺手补齐/校正:
  ① test_browse_ui_host 的启动路径改为 create 前就把根指向不存在的目录,真实覆盖
     「启动根不可读仍建空列表」(断言 has_list/rows==0/横幅/当前目录),不再只是声明;
  ② tuku_internal.h 的 library_at_root 注释改为「书库根(生产=MR_ROOT_DIR,测试可改根)」。
- 复验:run_tests.sh 全 PASS(73/69/90/18/108/19/85 + settings 集成 + browse UI 集成
  + zip 106 + cbz 325);run_webtoon_tests.sh 全 PASS(76/36/71/57 + 集成);
  sdk/build_sdk.sh + build_tuku.sh 零警告 MIPS32r2 静态 ELF;UI host 测试 ASan/UBSan 全绿。
This commit is contained in:
AskaEth committed 2026-11-05 12:31:46 +08:00
1 parent 9f34417c49
commit 66e598cb62
3 files changed
+124 -2

No files matched your search

+25
View File
@@ -186,6 +186,10 @@ static void cache_prune(void)
time_t oldest_t = 0;
struct dirent *de;
while ((de = readdir(d)) != NULL) {
/* 解压页缓存(M11)与缩略图同目录:mrpage_* 归 page_cache 自己的
* 64 页/32MiB LRU 管,这里绝不能把它们当缩略图统计或删除——否则
* 档案页会被缩略图 LRU 清掉(P2-1)。判据与 page_cache 共用。 */
if (mr_cache_is_page_name(de->d_name)) continue;
const char *dot = strrchr(de->d_name, '.');
if (!dot || strcmp(dot, ".bmp") != 0) continue;
char full[MR_PATH_MAX + 96];
@@ -977,6 +981,11 @@ int library_test_rows(void)
return g_lib.count + (g_lib.truncated ? 1 : 0);
}
int library_test_has_list(void)
{
return g_lv != NULL;
}
int library_test_src(int idx, meow_list_item *item)
{
return lib_src(idx, item, NULL);
@@ -1002,4 +1011,20 @@ int library_test_go_up(void)
{
return library_go_up();
}
/* 缩略图 LRU 接缝(M11 P2-1 回归):指向当前缓存目录并同步跑一次 prune。 */
const char *library_test_cache_dir(void)
{
return g_cache_dir;
}
int library_test_cache_on(void)
{
return g_cache_on;
}
void library_test_cache_prune(void)
{
cache_prune();
}
#endif