Merge remote-tracking branch 'origin/syslog_no_heap' into integration

This commit is contained in:
J. Nick Koston
2025-12-20 11:26:06 -10:00
3 changed files with 52 additions and 15 deletions
+5
View File
@@ -16,6 +16,11 @@ api:
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"
"EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
- service: log_short_message
then:
- lambda: |-
// Log a short message that should arrive complete (not truncated)
ESP_LOGI("shorttest", "BEGIN|SHORT_MESSAGE_CONTENT|FINISH");
logger:
level: DEBUG
+25 -1
View File
@@ -33,7 +33,7 @@ class ParsedSyslogMessage(TypedDict):
# Example: <134>Dec 20 14:30:45 syslog-test app: [D][app:029]: Running...
SYSLOG_PATTERN = re.compile(
r"<(\d+)>" # PRI (priority = facility * 8 + severity)
r"(\S+ +\d+ \d+:\d+:\d+|-)" # TIMESTAMP (BSD format or NILVALUE "-")
r"(\S+ +\d+ \d+:\d+:\d+|-)" # TIMESTAMP (BSD-style "%b %e %H:%M:%S", e.g. "Dec 20 14:30:45", or NILVALUE "-")
r" (\S+)" # HOSTNAME
r" (\S+):" # TAG
r" (.*)" # MESSAGE
@@ -258,3 +258,27 @@ async def test_syslog(
assert "|END" not in trunc_msg, (
"Message should be truncated before END marker"
)
# Test short message - should arrive complete (not truncated)
short_service = next(
(s for s in services if s.name == "log_short_message"), None
)
assert short_service is not None, "log_short_message service not found"
await client.execute_service(short_service, {})
try:
short_msg = await receiver.wait_for_pattern(r"shorttest.*BEGIN\|")
except TimeoutError:
pytest.fail(
f"Short test message not received. Got: {receiver.messages[-10:]}"
)
# Verify short message arrived complete with both markers
assert "BEGIN|" in short_msg, "Short message missing BEGIN marker"
assert "|FINISH" in short_msg, (
f"Short message truncated unexpectedly: {short_msg}"
)
assert "SHORT_MESSAGE_CONTENT" in short_msg, (
f"Short message content missing: {short_msg}"
)