How can we modifiy the test command line to call a wrapper?
I would like to run my tests in valgrind.
From the command line, we would invoke this like:
valgind build/test/out/test_voodoo/test_voodoo.out
Basically, calling the valgrind binary and passing the test executable name as its argument.
How can we do this in ceedling?
basically I want to do something like
ceedling --mixin=valgrind test:voodoo
I was able to do this in ceedling 0.31 (using an options file) but:
- I forgot how and no longer work for that company
- I cant even figure out what options I need to set
I have tried to work this out - I thought maybe command_hooks would be useful here (probably with pre_test_fixture_execute), but I cant work out how to specify the tool i want to run
Ah,
Something like:
:pre_test_fixture_execute:
:executable: valgrind
:arguments:
- ${1}
:logging: TRUE
Is there anyway to make it not run the test binary seperately? Or, for preference a way to just provide a wrapper to the test executable without doing a pre_test_fixture ?
Using:
:pre_test_fixture_execute:
:executable: valgrind
:arguments:
- ${1}
:logging: TRUE
Fails:
Running Command Hook :pre_test_fixture_execute...
🪲 ERROR: Exception raised in plugin `command_hooks` within build hook :pre_test_fixture_execute
🧨 EXCEPTION: undefined method `split' for nil:NilClass
🌱 Ceedling could not complete operations because of errors
I cant tell if this is due to the underlying command failing or not - but if so, I would expect to see some logging. I do see logging if I ask valgrind to print its version:
:pre_test_fixture_execute:
:executable: valgrind --version
:arguments:
- ${1}
:logging: TRUE
Running Command Hook :pre_test_fixture_execute...
Command Hook :pre_test_fixture_execute output >> valgrind-3.22.0
Running test_command_handler.out...
To switch from using the hook for running valgrind BEFORE the test fixture to REPLACING the test fixture, you want to use test_fixture instead of pre_test_fixture_execute. This works like this:
:tools:
:test_fixture:
:name: valgrind
:executable: valgrind --version
:arguments:
- ${1}
:logging: TRUE
If you want to OPTIONALLY do this, as you mentioned, the ceedling 1.0.n way of doing it is to use mixins instead of the old config option. You can still create a separate project.yml file which just has this change, and you can specify it as you have above.
I hope this helps! Let me know if you have further issues!