-
-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit Testing not working on ESP32 (test port not automatically recognized) #4076
Comments
Hi @maxgerhardt ! I guess it works fine, except that the Although, during some attempts to reproduce the issue I indeed bumped into situations when the |
That was indeed the problem.
That was quite baffling because I thought the detection of the test_port would be the same as the automatic detection of the upload_port, which worked flawlessly for me. I only have my motherboard's COM port and the ESP32 dev board as serial ports. |
@maxgerhardtI would edit the title to reflect the content of this report, as a courtesy to future bug-reporters. |
I'm not sure what title would be better? The problem of unit testing not working was resolved by setting |
Maybe "test_port automatic detection fails"? |
People who will experience the problem will first think of "Unit testing not working" instead of knowing the solution that test port detection fails though :/ |
The message i'm conveying is that if all kinds of issues have generic titles "foo don't work", "bar crashes", it's difficult to orient when scanning through them. Eg when looking at search results, the results are matched by GitHub based on the contents of the issues (not just the titles), but it's only the titles that's present in the result-list, and these better help humans to remember which one is which, and avoid revisiting the same issue again and again. Certainly it's not that important all this discussion, still you could extend the current title with some identifying info, if you agree with the above perspective. Thank you for your time. |
Updated |
Hi @maxgerhardt , I m using This is my configuration for both env (See below image ): This is the problem (See below image): |
Does it work for you? |
I tried it ! |
Have you completed 4) from the list above? Please read again the Get Started section. There is an example of how to implement the main or setup/loop entry points. Does it work now? |
It Works !!!! @ivankravets I just changed my test file names to I suggest to try this example for getting started. above steps are needed after latest platformIO update (6.0.0) One more thing .. Don't forget to put below functions in unity test codes otherwise you will get error.
|
|
|
I think we can improve 1). Could file an enhancement request at https://github.com/platformio/platformio-core/issues ? |
@ivankravets |
Hi guys, Could I ask you to re-test the latest |
Works perfectly 💯 🥇 |
@ivankravets may I also ask for your kind help for similar issue I'm building a project on ESP32-S3 and lately we decided to add tests into the codes and ran into the exact same problem as @maxgerhardt Then after reading this thread I added What would be the problem and how may I get it solved if anyone can help? Below is my platformio.ini lines;
and here is my test_main.cpp codes:
finally here is my terminal output:
|
//conflicts with "setup" and "loop" in main, therefore I modified below 2 as
void setup_test();
void loop_test(); so how are the Unit tests supposed to be executed when it doesn't reach execution of that function? Who occupies the real In any case, your issue is with your code, not PlatformIO itself. |
Thanks for very fast response @maxgerhardt Because it's my first time trying to implement a test environment, I may get confused easily. From examples and tutorials I read, all of them has |
Don't set |
[UPDATE: I've added However, if I just compile and upload the code as it is, there's no problem with this dependency because |
If a subdependency can't be found, you might need to increase the |
Yes, thank you very much for your kind and very quick answers @maxgerhardt |
What kind of issue is this?
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
test/simple_test.cpp
from belowActual Results
(hangs forever)
Expected Results
Successfull unit test result.
If problems with PlatformIO Build System:
The content of
platformio.ini
:Source file to reproduce issue:
test\simple_test.cpp
Additional info
pio test
locks up so that it can't even killed by Ctrl+C, must be killed in the taskmanagerdelay()
does not helptest_speed = 115200
does not helpsetup()
toSerial.begin(115200); Serial.print("\n\n");
does not help (separates bootloader output from test output)pio test --monitor-dtr <0/1> --monitor-rts <0/1>
does not helpThe text was updated successfully, but these errors were encountered: