ThrowTheSwitch / Ceedling

Ruby-based unit testing and build system for C projects
http://throwtheswitch.org
Other
588 stars 247 forks source link

ceedling utils:gcov not working #762

Open SampaiCody opened 1 year ago

SampaiCody commented 1 year ago

Using the following tools:

Windows 10
Ceedling version 0.32.0-164e950
gcovr version 4.1
Ruby version 3.2.1
Python 3.10.5

Project.yml

:plugins:
  :load_paths:
    - vendor/ceedling/plugins
  :enabled:
    - module_generator
    - gcov
    - xml_tests_report
    - 
:gcov:
  :utilities:
    - gcovr
    - HtmlDetailed
  :gcovr:
    :html_medium_threshold: 75
    :html_high_threshold: 90

Running command "ceedling gcov:all" gives expected coverage output.

But then running "ceedling utils:gcov" results in the following output:

NoMethodError: undefined method `+' for nil:NilClass
C:/myProjectPath/vendor/ceedling/lib/ceedling/system_wrapper.rb:54:in `shell_capture3'
C:/myProjectPath/vendor/ceedling/lib/ceedling/tool_executor.rb:69:in `block in exec'
C:/myProjectPath/vendor/ceedling/lib/ceedling/tool_executor.rb:65:in `exec'
C:/myProjectPath/vendor/ceedling/plugins/gcov/lib/gcovr_reportinator.rb:314:in `get_gcovr_version'
C:/myProjectPath/vendor/ceedling/plugins/gcov/lib/gcovr_reportinator.rb:14:in `make_reports'
vendor/ceedling/lib/../plugins/gcov/gcov.rake:209:in `block (2 levels) in <top (required)>'
C:/Ruby32-x64/bin/ceedling:32:in `load'
C:/Ruby32-x64/bin/ceedling:32:in `<main>'
Tasks: TOP => utils:gcov
(See full trace by running task with --trace)
ERROR: Ceedling Failed

It looks like "gcovr.exe --version" is not working somehow, but from the command line it's working fine.

Any help is highly appreciated!

SampaiCody commented 1 year ago

Tried downgrading Ruby to version 2.7.8, but same result.

SampaiCody commented 1 year ago

Tried with Ruby 2.7.8 and Ceedling 0.31.1, also with same result.

jyc-biz commented 1 year ago

Hey @SampaiCody, I am using the following combination, and gcov/gcovr works for me:

Ceedling:: 0.31.1
Unity:: 2.5.4 
CMock:: 2.5.4 
CException:: 1.3.3 
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091)

I am running Ceedling using WSL2.

Hopefully this helps!

podema commented 1 year ago

I had the same problem, i observed that ceedling only calls "gcovr" directly (defaults_gcov.rb), and thus gcovr python script should be on PATH. I added the Scripts folder of my local Python installation and it now works. you should be able to call gcovr directly without calling it with "python -m gcovr".

It solved the problem in my case

ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]
Ceedling:: 0.32.0
Unity:: 2.5.4
CMock:: 2.5.4
CException:: 1.3.3

Running on windows with Ruby installer for Windows and MinGW

breakersun commented 1 year ago

thank you @podema I solved it on Windows 10 just do this (with the latest Python 3):