project.yml and utils:gcov

55 views
Skip to first unread message

Christian Cortes

unread,
Sep 5, 2024, 5:06:25 PM9/5/24
to ThrowTheSwitch Forums
Hello, 
I am currently developing a lot of unit tests for some drivers that have been created 
the way  chose to tackle this, was to create a subrepo strictly for unit testing. so it looks like this

driver/
|
|--- test/
|     |
|     |--- config.yml
|     |--- test_driver.c
|
|--- unit_testing
|     |
|     |---build/
|     |---support/
|     |---project.yml
|
|--- src/
|     |
|     |---CMakelists.txt
|     |---Kconfig
|     |---driver.c
|     |---driver.h

notice that project.yml is not at the Highest level it can be. this is where the problem begins. 

1. env on WSL2 running ubuntu and zsh 
      Ceedling:: 0.31.1
      Unity:: 2.5.4
      CMock:: 2.5.4
      CException:: 1.3.3

2. if i make a local copy at the highest level (ex. driver/project.yml) and just modify the path to the test/ and support/ and other directories. the command 

ceedling options:config gcov:all utils:gcov

works just fine and generates the html output as expected. 

3. here is the portion of the yml for gcov when moved to the highest level
# Add -gcov to the plugins list to make sure of the gcov plugin
# You will need to have gcov and gcovr both installed to make it work.
# For more information on these options, see docs in plugins/gcov
:gcov:
  :reports:
    - HtmlDetailed
  :gcovr:
    :html_medium_threshold: 75
    :html_high_threshold: 90


4. now if i leave the project.yml file the same ceedling command does not work and this is what my :gcovr: section looks like now 
# Add -gcov to the plugins list to make sure of the gcov plugin
# You will need to have gcov and gcovr both installed to make it work.
# For more information on these options, see docs in plugins/gcov
:gcov:
  :reports:
    - HtmlDetailed
  :gcovr:
    :html_medium_threshold: 75
    :html_high_threshold: 90
    :object_directory: "build/gcov/out"
    :report_root: "../src"

5. one thing to note is that if my command is just 

ceedling options:config gcov:all

then it build and tests the code just fine. it only breaks when i introduce utils:gcov and only when I have the project.yml in the subrepo

6. the errors i am getting are all similar to 

RuntimeError: GCOV produced the following errors processing /home/chcortes/FirmwareModules/driver/unit_testing/build/gcov/out/mock_gpio.gcda:
        Cannot open source file build/test/mocks/mock_gpio.c

        Cannot open source file build/test/mocks/mock_gpio.c

        (gcovr could not infer a working directory that resolved it.)

7. these files do exist and i can see them if i go there manually. and i do not get these errors when i move my project.yml file to the highest location. 

has anyone tried this before and figured out how to make it work? i really do not want to have so many project.yml files on the driver/ since the file is not specific to each driver. 

thanks, 
let me know if you need more information 
Reply all
Reply to author
Forward
0 new messages