From 583a6fb6d035f0bca6922c969cf44a81b4d17302 Mon Sep 17 00:00:00 2001 From: pi-prs Date: Sun, 15 Nov 2026 03:08:40 -0400 Subject: [PATCH] tests: http_guard takes the route_ports lock its new loopback server needs engine#2482's fix gave tests/http_guard_test.cpp an httplib::Server on a loopback port, and the test took no route_ports lock. tests/route_port_lock_test.py exists for exactly this -- "a new route test that forgets the lock fails here by name, instead of flaking a later PR" -- but it reads tests/*.sh only (line 58: `if isinstance(arg, str) and arg.endswith(".sh")`), so a ctest whose COMMAND is an executable is None to it and is never examined. The one C++ route test in the tree is therefore the one shape the checker cannot see, and two tests racing for a freed loopback port is how pm_route failed with EADDRINUSE (engine#1070). set_tests_properties(http_guard PROPERTIES RESOURCE_LOCK route_ports), placed AFTER add_test(NAME http_guard ...): a property set before the test exists is a configure error, which is what my first attempt did. Verified locally on a clean configure: configure rc=0, build rc=0, ctest -R '^(http_guard|route_port_lock)$' -> 2/2 passed, 100%. The checker still does not read .cpp commands; that is the follow-up (scan a .cpp COMMAND for httplib::Server / bind_to_any_port / listen_after_bind) and it is recorded on engine#2496. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f04d79ea5..575d18403 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -696,6 +696,12 @@ target_include_directories(http_guard_test PRIVATE app) # engine#2482: the test starts a real httplib server on loopback, the entry point the 413 came through. target_link_libraries(http_guard_test PRIVATE httplib::httplib Threads::Threads) add_test(NAME http_guard COMMAND http_guard_test) + +# engine#2482 follow-up: this test now drives a loopback httplib::Server, so it takes the route_ports lock +# like every other test that binds a port (tests/route_port_lock_test.py: "a new route test that forgets +# the lock fails here by name, instead of flaking a later PR"). That check reads tests/*.sh only, so a +# C++ route test is invisible to it -- this property is the lock it would have required had it seen it. +set_tests_properties(http_guard PROPERTIES RESOURCE_LOCK route_ports) # The "the device is gone" classifiers of app/serve_watchdog.h: a backend's device-lost stderr line, and the # NPU runtime's failed-runlist message that makes `1bit unified` answer the request and exit non-zero. Header # only, no device, no model.