Using ceedling in Linux(WSL)
Introduction
This guide aims to describe how to install ceedling in a WSL Linux distribution. It assumes you already have Linux installed in WSL.
This will be using a snapshot not the current release. This will describe how to get Ceedling snapshot running as well using the gcov/gcovr plugin .
This is more of my personal notes, you can see the latest guide to install Ceedling in the respective github repository
Requirements
Windows 10 or 11 with WSL 2.0
Ubuntu 22.04.2 LTS (this is the version I'm using)
Notes on versions:
In case issues occur in the future these are my current versions:
Ceedling snapshot 0.32.0-164e950
Ruby ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]
Python 2.7.13
gcovr 4.1
gcov (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
References
Guide to installing WSL from Microsoft: https://learn.microsoft.com/en-us/windows/wsl/install
Guide to installing Ceedling: https://github.com/ThrowTheSwitch/Ceedling/blob/master/docs/CeedlingPacket.md
The minimum install
This is the minimum to get Ceedling going
Installing Ruby
Ceedling is a set of ruby scripts so you need to install it. No particular version is needed
sudo apt install ruby-rubygems
Installing GDB
sudo apt install gdb
Installing Ceedling
This is to install the latest release of ceedling
sudo gem install ceedling
Trying it out
With that done you should be able to pull examples and try ceedling. Use help in any folder to get all the available commands in your current location
ceedling help
Snapshot
Personally, I am using a snapshot to get the newer features of ceedling.
You will need download a .gem from https://github.com/ThrowTheSwitch/Ceedling/releases.
If you find one that you like I advise you to keep the .gem stored somewhere. Then just install it with the following command. Replace <path to .gem> with the path to the folder with the snapshot you just downloaded
sudo gem install --local "<path to .gem>"
Verify that the ceedling installed is at least 0.32.0
gem list --local ceedling
ceedling version
GCOV
Gcov is a really useful code coverage tool. Ceedling supports it as a plugin. It also uses gcovr, a python library, to generate HTML reports. You will likely already have gcov installed already in Linux so this will just describe how to install gcovr.
There are some specific versions required.
gcovr version 4.1
python 2.7 - I actually have 3.10.12 on one of my WSL Linux but 2.7 on windows, I don't remember where the issue was
This assumes you have Python already installed. Install gcovr v4.1:
pip install 'gcovr == 4.1'
Try it
To see if gcov is working correctly, use any of the examples you can pull fromCeedling. For example (check if the test runs first)
mkdir ./ceedling_test
cd ceedling_test
ceedling example temp_sensor .
ceedling test:all
And run gcov on it:
ceedling clobber gcov:all utils:gcov