Unit testing using CMOCK and UNITY of the BLE module gives Error: Bluetooth device missing

Hi, 

I am integrating unit tests on our on an NRF Connect SDK project using Unity and CMock. I followed the example on documentation here

The project uses the BLE modules and I am developing unit tests for the application files related to Bluetooth. The test compiles and produces the following error: 


[141/142] cd /workdir/connectivity_project_lte/test/build && /workdir/connectivity_project_lte/test/build/zephyr/zephyr.exe
Error: Bluetooth device missing. Specify one using --bt-dev=hciN
FAILED: zephyr/CMakeFiles/run_native /workdir/connectivity_project_lte/test/build/zephyr/CMakeFiles/run_native
cd /workdir/connectivity_project_lte/test/build && /workdir/connectivity_project_lte/test/build/zephyr/zephyr.exe
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake --build /workdir/connectivity_project_lte/test/build --target run

After it fails, I ran `build/zephyr/zephyr.exe --bt-dev=hci0` and it built and succeeded. 

Is there a way to pass '--bt-dev=hci0' as an argument option to west build -b native_posix -t run command? 

Parents Reply
  • Thanks for your quick response! 

    Thanks for pointing me to the documentation, it is helpful.

    The git PR for the issue resolves it using twister. I am using west instead with unity. I will explore it further to see if there is a similar work around with the west build script. At the moment, my temporary solution is running using two commands: 

    west build -b native_posix

    build/zephyr/zephyr.exe --bt-dev=hci0

Children
No Data
Related