From f953ab5a8f6f0dfe379e929f61f1afbc74fc65b6 Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 13 Oct 2026 12:12:30 +0200 Subject: [PATCH] Test all debug categories and record Android settings fixes --- doc/tasks.md | 7 +++++++ tests/test_config_debug.c | 40 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/doc/tasks.md b/doc/tasks.md index 1ee63220..f3b183af 100644 --- a/doc/tasks.md +++ b/doc/tasks.md @@ -4,6 +4,13 @@ ## Текущие задачи +[+] **Android: категории диагностики и обрезанный текст уровня** — 13.10.2026: + список берётся из native-ядра, включая stream/video/reality/dm/call/aec. + Поля уровня используют минимальную высоту вместо фиксированных 48 dp; + изменения диагностики применяются сразу без перезапуска при выходе из настроек. + Общий уровень сохраняется в [global] debug_level; оба парсера принимают все категории, + а превышение лимита логируется. Регрессия: test_config_debug, файл и INI-текст. + [ ] **Стриминг SM → colo2 → desktop: восстановление частично остановившихся субпотоков** — 13.10.2026: помощь подключилась за ~8 с, все 8 субпотоков через colo2 приняты с общего индекса 5844. Позже шесть субпотоков перестали продвигаться около seq=111625; четыре restart не восстановили diff --git a/tests/test_config_debug.c b/tests/test_config_debug.c index f00ab822..621c31aa 100644 --- a/tests/test_config_debug.c +++ b/tests/test_config_debug.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "../lib/platform_compat.h" #include "test_utils.h" #ifdef _WIN32 @@ -69,6 +70,42 @@ static void cleanup_temp_config(void) { if (temp_dir[0]) test_rmdir(temp_dir); } +// Все категории, включая последние в списке, сохраняются при чтении файла и текста. +static void test_all_debug_categories(void) { + char text[4096]; + int length = snprintf(text, sizeof(text), "%s\n[debug]\n", config_content); + int count = 0; + for (int category = 1; category < DEBUG_CATEGORY_COUNT; category++) { + const char* name = debug_get_category_name(category); + if (strcmp(name, "UNKNOWN") == 0) continue; + int written = snprintf(text + length, sizeof(text) - length, "%s=%s\n", name, category == DEBUG_CATEGORY_SYS ? "disabled" : "debug"); + assert(written > 0 && written < (int)sizeof(text) - length); + length += written; count++; + } + assert(count > 16); + FILE* file = fopen(config_path, "w"); + assert(file); + assert(fwrite(text, 1, length, file) == (size_t)length); + assert(fclose(file) == 0); + struct utun_config* configs[2] = {parse_config(config_path), parse_config_from_buf(text, length, "debug-categories")}; + for (int parser = 0; parser < 2; parser++) { + struct utun_config* config = configs[parser]; + assert(config && config->global.debug_levels.count == count); + assert(strcmp(config->global.debug_level, "debug") == 0); + int index = 0; + for (int category = 1; category < DEBUG_CATEGORY_COUNT; category++) { + const char* name = debug_get_category_name(category); + if (strcmp(name, "UNKNOWN") == 0) continue; + assert(strcmp(config->global.debug_levels.category[index], name) == 0); + debug_config_init(); + assert(debug_apply_category_config(name, config->global.debug_levels.level[index++]) == 0); + assert(debug_should_output(DEBUG_LEVEL_DEBUG, category) == (category != DEBUG_CATEGORY_SYS)); + } + free_config(config); + } + printf("All %d debug categories preserved by file and buffer parsers\n", count); +} + int main() { // Initialize socket platform (required for getaddrinfo on Windows) if (socket_platform_init() != 0) { @@ -126,6 +163,7 @@ int main() { // Освобождение ресурсов free_config(config); + test_all_debug_categories(); // Cleanup temp config file cleanup_temp_config(); @@ -135,4 +173,4 @@ int main() { socket_platform_cleanup(); return 0; -} \ No newline at end of file +}