ThrowTheSwitch / Ceedling

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

Errno::ENOENT: No such file or directory - gcovr --version #745

Open gokish03 opened 1 year ago

gokish03 commented 1 year ago

I'm trying to generate a Code coverage html file using Gcov . But when run the command it resulted an error. Here is my project.yml file.


Notes:

Sample project C code is not presently written to produce a release artifact.

As such, release build options are disabled.

This sample, therefore, only demonstrates running a collection of unit tests.

:project: :use_exceptions: FALSE :use_test_preprocessor: TRUE :use_auxiliary_dependencies: TRUE :build_root: build

:release_build: TRUE

:test_fileprefix: test

:which_ceedling: vendor/cedling

:which_ceedling: gem :ceedling_version: 0.31.1 :default_tasks:

:test_build:

:use_assembly: TRUE

:release_build:

:output: MyApp.out

:use_assembly: FALSE

:environment:

:extension: :executable: .out

:paths: :test:

:defines:

in order to add common defines:

1) remove the trailing [] from the :common: section

2) add entries to the :common: section (e.g. :test: has TEST defined)

:common: &common_defines [] :test:

:cmock: :mockprefix: mock :when_no_prototypes: :warn :enforce_strict_ordering: TRUE :plugins:

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: :html_report_type: detailed :reports:

:tools:

Ceedling defaults to using gcc for compiling, linking, etc.

As [:tools] is blank, gcc will be used (so long as it's in your system path)

See documentation to configure a given toolchain for use

LIBRARIES

These libraries are automatically injected into the build process. Those specified as

common will be used in all types of builds. Otherwise, libraries can be injected in just

tests or releases. These options are MERGED with the options in supplemental yaml files.

:libraries: :placement: :end :flag: "-l${1}" :path_flag: "-L ${1}" :system: [] # for example, you might list 'm' to grab the math library :test: [] :release: []

:plugins: :load_paths:

My Ceedling version is as below: Ceedling:: 0.31.1 Unity:: 2.5.4 CMock:: 2.5.4 CException:: 1.3.3

Python Version: Python 3.11.0 ruby version - ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c5) [x64-mingw32] Environment variables screenshot attached. Screenshot 2023-02-07 154547

May I know what's error is? Thanks.

mvandervoord commented 1 year ago

Try pip install gcovr to ask python to install the coverage libraries for you.

Also, when pasting code snippets into comments, if you put three backticks on a line alone "``" before and after your code, it will start a code block that won't do weird formatting like yourproject.yml` above.

like this:

see how much easier this is to look at?
gokish03 commented 1 year ago

Thank you for the info on formatting code block. Coming to Gcovr, Its already installed. Please see below.

PS C:\GIT\Stellantis\Stellantis_12V_2kW_Primary\Primary2kW_12v\Stellantis_Primary2kW_12v.X> pip install gcovr
Requirement already satisfied: gcovr in c:\python311\lib\site-packages (5.2)
Requirement already satisfied: jinja2 in c:\python311\lib\site-packages (from gcovr) (3.1.2)
Requirement already satisfied: lxml in c:\python311\lib\site-packages (from gcovr) (4.9.2)
Requirement already satisfied: pygments in c:\python311\lib\site-packages (from gcovr) (2.14.0)
Requirement already satisfied: MarkupSafe>=2.0 in c:\python311\lib\site-packages (from jinja2->gcovr) (2.1.2)
mvandervoord commented 1 year ago

If you run gcovr --version from the command prompt, does it return a version?

It might be the same issue that others have run into... that the environment isn't handling the paths well. (see https://github.com/ThrowTheSwitch/Ceedling/issues/246 ). In that case, you need to define custom tools in your project.yml file which list python3 as the executable and then the full path to gcovr as the first argument.

Letme commented 1 year ago

Was this issue resolved? Can we get more info or close it...

dmalcorps commented 1 year ago

I would like to chime in on this one, because I am facing the exact same issue.

rake aborted!
Errno::ENOENT: No such file or directory - gcovr --version
C:/<long_path>/Ruby32-x64/bin/ceedling:32:in `load'
C:/<long_path>/Ruby32-x64/bin/ceedling:32:in `<main>'
Tasks: TOP => utils:gcov
(See full trace by running task with --trace)
ERROR: Ceedling Failed

By the way, adding "--trace" does not change the console output at all.

Running gcovr --version in the same terminal gives the following output:

gcovr 6.0

Copyright (c) 2013-2023 the gcovr authors
Copyright (c) 2013 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.

The exact same configuration works under linux just fine.