Testing libraries on the desktop

Hello everyone,

I am reaching out to you with this question because I haven’t been able to find an answer. I have created various C++ libraries (which do not depend on any electronic hardware), and I would like to run tests locally on my computer (Mac). I have written my tests using Unity, following the various conventions imposed by Unity. However, when I run my tests, I receive a signal (see the first picture) and my tests fail . So, I don’t quite understand what’s happening, and I suspect it might be related to the test environment. I am attaching my .ini file for your reference.

If you have an idea, I will be interesting to know !

Thank you for your help.

.ini

[env:esp32doit-devkit-v1]
platform = espressif32
test_ignore = 
    *
board = esp32doit-devkit-v1
framework = arduino
lib_ldf_mode=deep
upload_port = COM20
lib_deps = 
    me-no-dev/AsyncTCP@^1.1.1
    milesburton/DallasTemperature @ ~3.11.0
    paulstoffregen/OneWire @ ~2.3.7
    me-no-dev/ESP Async WebServer @ ~1.2.3

[env:test]
platform = native
test_framework = unity
lib_deps = 
    throwtheswitch/Unity@^2.5.2

Wel if you get SIGABRT then something called into abort() due to some error condition, which made the program exit immediately.

You should use the unit test debugging feature so that the debugger halts at the moment the test executable wants to throw that signal, and by looking at the call stack you should be able to see what the original cause is.

See documentation and topic.

Okay, so I’ve looked at the topic you provided, I’ve tried everything, but I’m still encountering my error. I do have GDB and GCC installed, but I’m getting this error:

Failed to launch GDB: .pioinit:11: Error in sourced command file: Remote connection closed (from interpreter-exec console "source .pioinit")

And in the terminal, I see the following:

Error: unable to find a matching CMSIS-DAP device

So, I’m wondering if my ESP32 needs to be connected to my computer even if I’m running tests that don’t require the Arduino language. Since I’m testing libraries without the Arduino framework, my tests are written without the Arduino framework… But from what I’ve seen in the documentation, what I’ve done should be correct, which is why I don’t understand it.

To conclude, I’ve also looked at the documentation from the beginning, and it hasn’t changed anything.

Wait I thought it was the native unit tests that were crasshing, not the one that were running on the ESP32? Did you switch use the project enviornment switcher to switch to your native enviornment and then use debug_test = test_donnees in the platformio.ini, then used the “Play” button in the PIO sidebar?

I’m not doing my tests in the ESP 32 environment but in the native environment. (In my .ini file, I ignore the tests for the ESP32 environment). Then I click on the Platformio test button in the top right-hand corner.

Can you temporarily comment out the ESP32 environment in your platformio.ini follow this exact procedure

I have the following error : Failed to load symbols from executable file: Error: Could not find “objdump” program

In the terminal I have :

--------------------------------------------------------------------------------
Building...
Reading symbols from /Users/paul/Desktop/Spiruline/Spiruline/Technique/Controlleur/src/main/Controlleur_Spiruline/.pio/build/test/program...
done.
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = None
PlatformIO: Initializing remote target...
Temporary breakpoint 1 at 0x100006812
PlatformIO: Initialization completed

I’m so sorry I feel dumb…

Which native toolchain do you have installed?

When you open a terminal and type objdump --version, you also get a “command not found” error?

If yes, install https://brew.sh/, then on the terminal, do brew install binutils, as instructed in here.

I don’t get an error, I get the following response :

Apple LLVM version 14.0.0 (clang-1400.0.29.202)
  Optimized build.
  Default target: arm64-apple-darwin22.3.0
  Host CPU: apple-a12

  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_32 - AArch64 (little endian ILP32)
    aarch64_be - AArch64 (big endian)
    arm        - ARM
    arm64      - ARM64 (little endian)
    arm64_32   - ARM64 (little endian ILP32)
    armeb      - ARM (big endian)
    thumb      - Thumb
    thumbeb    - Thumb (big endian)
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64

Hi,

There is someone else that could help me ?

Thanks for you time

If you’re stuck, upload your complete minimal project that fails, along with the error message, and file an issue at Issues · platformio/platform-native · GitHub.