From ec8f82e918e5d0eea01f7334ef9ab3ff5bcdfc30 Mon Sep 17 00:00:00 2001 From: mikecarper Date: Sun, 4 Oct 2026 13:06:55 -0700 Subject: [PATCH] Fix USB regression extraction across nested SDK guards Inspect the complete exclusive TX kick and wrapper functions instead of stopping at the first nested endif. Retain the existing transport guards and verify the pinned SDK pending/kick hooks. Validation: all 82 tests across the 19-script USB workflow step passed; independent review passed. Production firmware is unchanged. --- test/test_esp32_usb_serial_hygiene.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/test_esp32_usb_serial_hygiene.py b/test/test_esp32_usb_serial_hygiene.py index 1b8327e52..a2a12f529 100644 --- a/test/test_esp32_usb_serial_hygiene.py +++ b/test/test_esp32_usb_serial_hygiene.py @@ -356,18 +356,21 @@ int main() { ) self.assertIn("return Serial.write(data, size);", guarded_write) - kick_start = logging.index( - "static void serviceEsp32HwcdcTxKickExclusive" - ) - kick_end = logging.index("#endif", kick_start) - kick = logging[kick_start:kick_end] + # Extract complete functions: their pinned-SDK/fallback branches now + # contain nested #endif directives inside the outer platform guard. + kick = "\n".join(extract_braced(logging, signature) for signature in ( + "static void serviceEsp32HwcdcTxKickExclusive(void*)", + "static void serviceEsp32HwcdcTxKick()", + )) self.assertIn("Serial.availableForWrite()", kick) self.assertIn("esp32_hwcdc_tx_buffer_capacity.load(", kick) + self.assertIn("meshEsp32HwcdcTxPending()", kick) self.assertIn("canAccessEsp32Hwcdc(nullptr)", kick) self.assertIn("Serial.isPlugged()", kick) self.assertIn("usb_serial_jtag_ll_txfifo_flush();", kick) self.assertIn("USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY", kick) self.assertIn("portENTER_CRITICAL(&esp32_hwcdc_session_mux)", kick) + self.assertIn("meshEsp32HwcdcKickTx();", kick) self.assertIn("tryRunExclusive(", kick) event_start = logging.index("static void handleEsp32HwcdcEvent")