From 26d9f004c97f4c130efdfe8081e1a945951383c2 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Mon, 4 Oct 2021 05:19:58 -0700 Subject: [PATCH] check for overflow in HW CI (#3313) --- firmware/console/eficonsole.cpp | 4 ++++ .../java/com/rusefi/f4discovery/CommonFunctionalTest.java | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/firmware/console/eficonsole.cpp b/firmware/console/eficonsole.cpp index c604a81c5e..6928d79217 100644 --- a/firmware/console/eficonsole.cpp +++ b/firmware/console/eficonsole.cpp @@ -166,6 +166,10 @@ static void cmd_threads(void) { int freeBytes = CountFreeStackSpace(tp->wabase); efiPrintf("%s\t%08x\t%lu\t%d", tp->name, tp->wabase, tp->time, freeBytes); + if (freeBytes < 100) { + firmwareError(OBD_PCM_Processor_Fault, "Ran out of stack on thread %s, %d bytes remain", tp->name, freeBytes); + } + tp = chRegNextThread(tp); } diff --git a/java_console/autotest/src/main/java/com/rusefi/f4discovery/CommonFunctionalTest.java b/java_console/autotest/src/main/java/com/rusefi/f4discovery/CommonFunctionalTest.java index 440834d6a1..92c58f6558 100644 --- a/java_console/autotest/src/main/java/com/rusefi/f4discovery/CommonFunctionalTest.java +++ b/java_console/autotest/src/main/java/com/rusefi/f4discovery/CommonFunctionalTest.java @@ -458,6 +458,12 @@ public class CommonFunctionalTest extends RusefiTestBase { assertWaveNull("hard limit check", chart, EngineChart.INJECTOR_1); } + @Test + public void testStackOverflow() { + // This ECU command has a built in check to make sure no threads are near overflow + ecu.sendCommand("threadsinfo"); + } + /** * This method waits for longer then usual. * todo: inline this method? complex and less complex seem to have same timeout these days?