Skip to content
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

Allow for pyserial serial URL's when unit testing (test_port) #4229

Closed
1 task done
timkoers opened this issue Apr 15, 2022 · 11 comments
Closed
1 task done

Allow for pyserial serial URL's when unit testing (test_port) #4229

timkoers opened this issue Apr 15, 2022 · 11 comments

Comments

@timkoers
Copy link

What kind of issue is this?

  • Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

Configuration

Operating system: Windows 11

PlatformIO Version (platformio --version): PlatformIO Core, version 5.2.5

Description of problem

I'd like to request that the test_port behaves the same as the upload_port and monitor_port. You can put in an custom URL, with a socket connection in all but the test_port. I'd like to have the test_port behave the same.

@ivankravets
Copy link
Member

You can put in an custom URL, with a socket connection in all but the test_port.

What is your use case for the socket connection? We are working on the new unit testing engine and new documentation. It would be great to describe this case as an example of the custom runner that is a part of PlatformIO Core 6.0.

@ivankravets
Copy link
Member

Thanks for the feature request. Please re-test with pio upgrade --dev. See updated docs https://docs.platformio.org/en/latest/projectconf/section_env_test.html#test-port

Does it work for you?

@timkoers
Copy link
Author

timkoers commented May 6, 2022

Thanks! Well In my case it would allow me to be able to run unit tests from within an qemu emulator, of which it's serial output is connected via sockets.

I'll test it on my machine shortly!

@ivankravets
Copy link
Member

No need to use sockets here. Please use the custom testing command. See docs https://docs.platformio.org/en/latest/advanced/unit-testing/simulators/qemu.html

@timkoers
Copy link
Author

I can't get the test command to be executed.
It states no such file or directory whilst executing
[Errno 2] No such file or directory: '/usr/local/bin/qemu-system-xtensa -nographic -M esp32 -m 4 -kernel /builds/timkoers/xx/Sources/ESP32/.pio/build/firmware.elf -s -serial stdio -global driver=timer.esp32.timg,property=wdt_disable,value=true'

@ivankravets
Copy link
Member

Each argument in the new line?

@ivankravets ivankravets reopened this May 21, 2022
@timkoers
Copy link
Author

That seems to have at least started the test. I'm getting a hang up error right now, how do I enable the test output?

@ivankravets
Copy link
Member

Does it work without PlatformIO if you run in a separate command shell?

@timkoers
Copy link
Author

It doesn't, thanks.

I suppose I can combine commands by adding the & in between the command and the next line?

I need to run a command that prepares the binary before I can start the emulator

@ivankravets
Copy link
Member

You can create a Python script that does multiple operations and prints output to the stdout. Later, use this script as a broker.

@ivankravets
Copy link
Member

I forgot. If these commands are part of upload process, you take a look at the advanced scripting (see docs), and leverage AddPost method for upload target.

In other words, you have multiple options. PlatformIO Unit Testing just needs the raw output from the testing program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants