question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unit Testing not working on ESP32 (test port not automatically recognized)

See original GitHub issue

What kind of issue is this?

  • PlatformIO Core. If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Win10 x64

PlatformIO Version (platformio --version): version 5.2.1b4

Description of problem

Unit testing for an ESP32 hangs at the “Testing…” phase.

Steps to Reproduce

  1. Create new blank ESP32 project
  2. Add test/simple_test.cpp from below
  3. Use the project task “Advanced -> Test”

Actual Results

Writing at 0x0003fafb... (100 %)
Wrote 210992 bytes (108452 compressed) at 0x00010000 in 3.1 seconds (effective 536.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Testing...
If you don't see any output for the first 10 secs, please reset board (press reset button)

(hangs forever)

Expected Results

Successfull unit test result.

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

Source file to reproduce issue:

test\simple_test.cpp

#include <Arduino.h>
#include <unity.h>

void test_led_builtin_pin_number(void) {
    TEST_ASSERT_EQUAL(13, 13);
}

void setup() {
    delay(3000);
    UNITY_BEGIN();
    RUN_TEST(test_led_builtin_pin_number);
    UNITY_END(); // stop unit testing
}

void loop() { }

Additional info

  1. The board is a standard https://www.amazon.de/ESP-32S-ESP32-Development-Bluetooth-Antennenmodul/dp/B071JR9WS9
  2. pio test locks up so that it can’t even killed by Ctrl+C, must be killed in the taskmanager
  3. Increasing the delay() does not help
  4. Explicitly setting test_speed = 115200 does not help
  5. Modifying setup() to Serial.begin(115200); Serial.print("\n\n"); does not help (separates bootloader output from test output)
  6. Setting DTR / RTS states with pio test --monitor-dtr <0/1> --monitor-rts <0/1> does not help
  7. Pressing the reset button on the board does not help
  8. Looking at the serial output after the testing has been aborted at the waiting phase gives

grafik

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
HareshPrajapaticommented, May 16, 2022

@ivankravets

Works perfectly 💯 🥇

image2

1reaction
HareshPrajapaticommented, May 14, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto Detect of COM Port with ESP32-S3 not working
It means that PlatformIO found the port. Autodetection works as expected. Could you try to erase flash and upload again?
Read more >
ESP32 not recognized by PC. No COM port problem!
I just purchased a new ESp32 yesterday and have exactly the same problem..I can see the USB connection and the correct port. The...
Read more >
ESP32 Troubleshooting Guide | Random Nerd Tutorials
The ESP32 has a few problems when you are trying to upload new sketches or ... If you don't see your ESP's COM...
Read more >
Unit Testing in ESP32 - Technical Documents
These tests use the Unity unit test framework. They can be integrated into an ESP-IDF component by placing them in the component's test...
Read more >
(SOLVED!) Esp32 devkit v1 not loading sketch - Arduino Forum
I am having a problem loading a sketch with arduino IDE Having tried ... Did you do the tests with nothing connected to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found