Hello, I’ve been struggling with the testing framework on my ESP32-S3 board. I’m connected to it over the JTAG/Serial USB port and normally serial and debugging work fine. I added a test folder to my project, and added the following to it:
#include "unity.h"
#include "CAN.h"
#include <unity.h>
#include <stdio.h>
void setUp(void)
{
// set stuff up here
}
void tearDown(void)
{
// clean stuff up here
}
void test_testing(void)
{
TEST_ASSERT_EQUAL(0, give_zero());
}
extern "C" void app_main()
{
printf("this is kinda getting absurd\n");
UNITY_BEGIN();
RUN_TEST(test_testing);
UNITY_END();
}
when i hit the test button it builds and uploads, but all i get in the terminal is:
Building & Uploading... Testing... If you don't see any output for the first 10 secs, please reset board (press reset button)
Clicking my reset button (cycling the EN pin) just disconnects the device from my computer and the test fails.
It never seems to actually run the test code as my print statement doesn’t print. Strangely though, If I click on “pio debug (without uploading)” to attach to the JTAG while keeping the testing terminal open, it will break on the app_main() function in the test file above, and bam, the test will run and pass:
------------------------------------------------------------------------------------------------------------------------------------------Building & Uploading...
Testing...
If you don't see any output for the first 10 secs, please reset board (press reset button)
test/test_CAN.cpp:28: test_testing [PASSED]
------------------------------------------- esp32-s3-devkitm-1:* [PASSED] Took 414.34 seconds -------------------------------------------
================================================================ SUMMARY ================================================================
Environment Test Status Duration
------------------ ------ -------- ------------
esp32-s3-devkitm-1 * PASSED 00:06:54.338
=============================================== 1 test cases: 1 succeeded in 00:06:54.338
which makes absolutely no sense to me other than that perhaps connecting the debugger triggers some kinda soft-reset that wasn’t being triggered otherwise and without that reset the test never runs properly. I’m wondering how I can fix this problem?