PlatformIO Community

Unit test & source libs located outside project root

Out of necessity I have over the years used symlinks to fool platformio and other tools to believe source code was in a root project folder when it in fact was elsewhere.

I actually prefer to not do this and real relative pathing within config files, when possible.

In this particular instance, I have a folder structure:

  • test/arduino/unity which contains all the PIO usual suspects (platformio.ini, etc)
  • test/arduino/unity/test which contains the unity core main() entry file and a symlink unity to…
  • test/unity which contains the actual unity test files, shared across many different build systems

For pio 6.0+ with the new unit test structure, neither symlinking or relative pathing seem to work in this instance. What happens instead is the main() gets compiled, but the unity symlink is ignored.

What does seem to work is using test_build_src = true and moving test/arduino/unity/test to test/arduino/unity/src. That doesn’t feel like the right way forward though.

I’ve tried fiddling with the build_ parameters to motivate LDF to find test/unity without success.

Please advise. Thank you!

I am now at a standstill and am generally unable to use pio. I’d prefer not to give up on the tool.

Should be fixed in the latest PIO Core 6.1-dev. Could you re-test with pio upgrade --dev?

Sadly the same results. I apologize for being so dramatic before, just frustrated. This is a somewhat complicated scenario, would it make sense to schedule a 20 minute session together to diagnose it? Let me know how I can help.

EDIT: The non-unit-test (regular project) does show improvement, symlinks work better. Though I am still 100% onboard for a technique which doesn’t use symlinks at all

Could you provide a simple project to reproduce this issue? Please pack at as tar.gz to keep symlinks and share somewhere( Googledrive, etc)

Sure I can do that. Alternatively, would a test project on bitbucket/github be OK?

Yes, any public location. Thanks.