You are here
Home > embedded > Testing >

How To Install Ceedling On Windows

This post shows ways about how to install ceedling on windows operating system with the latest updates.

Ceedling as you know is a powerful tool for unit testing and is used mostly for testing C language code in embedded system. There are various tools for embedded testing like pclint, parasoft, vectorcast, tessy and few AI powered intelligent tools. What makes embedded system unit testing tools different than application testing tools is it utilizes components like hardware, real time operating system and cross compilation. Please note unit testing will not find bugs in your code but it will help you to reduce bugs in system testing and build robust software. This post will discuss about ceedling installation and related issues.

Contents

Install Ceedling With Mingw On Windows

Ceedling requires both Ruby and GCC to run, lets start the installation with ruby on rails platform.

Install Ruby on Rails on Windows

The easy way to install Ruby on Windows is to download self-contained Windows-installer from rubyinstaller.org

You can confirm that the installation was successful by opening up a power shell and running ruby –version:

ruby -v
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x64-mingw32]

Install GCC

This is three-step process – Step 1. Get GCC using MinGW from www.mingw.org via the MinGW installer, and install basic MinGW that provides GCC installation.

basic minigw installation for ceedling on windows

Step 2 – Now click on ‘Installation’ from the navigation menu then → Apply Changes and apply. This will install gcc required for ceedling. When it’s done, you can close the installer.

Step 3 – Add the path in the environment variable for GCC.

GCC add environment path

Install Ceedling

On powershell just run following command

PS C:\Users\Admin\Desktop> gem install ceedling
Successfully installed ceedling-0.31.1
Parsing documentation for ceedling-0.31.1
Done installing documentation for ceedling after 1 seconds
1 gem installed
PS C:\Users\Admin\Desktop>

This will install ceedling on native windows.

Please rate our website(required)

Install Ceedling Using WSL

Please note this method will work with Windows 11 only since it has provision for WSL. First Enable WSL – windows subsystem for linux on your Windows 11 PC.

Install Ruby Using rbenv

sudo apt-get update
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
rbenv install 2.3.1
rbenv global 2.3.1
ruby -v

Time To Install ceedling

Install ceedling using gem install ceedling.

Play Around With Ceedling Using Example Program

To create ceedling project with available example projects, run the command to create temp_sensor project ceedling example temp_sensor.

Now, navigate to ‘temp_sensor’ project, Run ceedling help to view all the options.

ceedling help
ceedling clean # Delete all build artifacts and temp…
ceedling clobber # Delete all generated files (and bui…
ceedling environment # List all configured environment var…
ceedling files:include # List all collected include files
ceedling files:source # List all collected source files
ceedling files:support # List all collected support files
ceedling files:test # List all collected test files
ceedling gcov:* # Run single test w/ coverage ([] re… ceedling gcov:all # Run code coverage for all tests ceedling gcov:delta # Run code coverage for changed files ceedling gcov:path[dir] # Run tests whose test path contains … ceedling gcov:pattern[regex] # Run tests by matching regular expre… ceedling logging # Enable logging ceedling module:create[module_path] # Generate module (source, header and… ceedling module:destroy[module_path] # Destroy module (source, header and … ceedling module:stub[module_path] # Generate module stubs from header ceedling options:export[filename] # Export tools options to a new proje… ceedling paths:include # List all collected include paths ceedling paths:source # List all collected source paths ceedling paths:support # List all collected support paths ceedling paths:test # List all collected test paths ceedling summary # Execute plugin result summaries (no… ceedling test: # Run single test ([*] real test or s…
ceedling test:all # Run all unit tests (also just 'test…
ceedling test:delta # Run tests for changed files
ceedling test:path[dir] # Run tests whose test path contains …
ceedling test:pattern[regex] # Run tests by matching regular expre…
ceedling utils:gcov # Create gcov code coverage html/xml/…
ceedling verbosity[level] # Set verbose output (silent:[0] - ob…
ceedling version # Display build environment version info

Run all tests using ‘ceedling test:all’ and get the HTML report by running ‘ceedling gcov:all’ followed by ‘ceedling utils:gcov’. The HTML report will be created in ‘\temp_sensor\build\artifacts\gcov’ folder.

GCC code coverage HTML report

Troubleshooting

GCC path is not set correctly

If you are getting the below error, set the GCC path as explained above and restart the system.

ERROR: Config filepath [:tools][:test_linker][:executable][‘gcc.exe’] does not exist in system search paths.
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/ceedling-0.31.1/lib/ceedling/configurator.rb:309:in `validate’: unhandled exception

ERROR: Config filepath [:tools][:gcov_compiler][:executable][‘gcc.exe’] does not exist in system search paths.
ERROR: Config filepath [:tools][:gcov_linker][:executable][‘gcc.exe’] does not exist in system search paths.

gcovr failed to start

When you try to generate HTML report you will get the following error for the first time.

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

install gcovr and it will solve the error.

install gcovr on windows

If you are still getting ‘gcovr’ error make sure you have set the PATH variable for python.

python path variable on windows

Hope you like this short guide of How To Install Ceedling On Windows, happy unit testing.

Leave a Reply

Top