Description
I found another quirk on the preprocessing of files to create partials. When the module to be "partialled" has an include with a path
#include "utils/header.h"
The relative path is cut out on the ceedling_partial_... files, and because the include now becomes #include "header.h", the compilation fails to find it.
I added a zip file with a compressed folder with the smallest reproducible example. It's the same structure as the example on the documentation, but I added a header.h with a silly typedef-ed enum, and modified Sensor_Init to return a value of that type.
This happens whether the #include is in the .h or in the .c of the module to be partial-ed.
It can be worked around by adding the absolute path of the header to the project.yml file (Ceedling is then capable of finding it).
partials.zip
Steps to Reproduce the Problem
- Get the "sensor" example, as listed on https://throwtheswitch.github.io/Ceedling/1.1.0/testing-guide/partials/example/
- Create a new Ceedling project, and add
:use_partials: TRUE.
- Create
sensor.h and sensor.c and copy the contents, as per the documentation
- Create
hal.h on test/support and add
#include <inttypes.h>
void HAL_SensorEnable(void);
uint16_t HAL_SensorRead(void);
- Create
test_sensor.c and copy the contents, as listed in the example
- Add a dependency that includes a relative path on it, e.g.
#include utils/header.h
Expected Behavior
Ceedling can compile the tests and run them
Actual Behavior
The created partial files, ceedling_partial_sensor_impl.c and ceedling_partial_sensor_impl.h, have the relative path stripped and only show the name of the module on the include #include "header.h", which can't be found and the compilation fails
👟 Preprocessing Test Files
---------------------------
Preprocessing test file test_sensor.c...
🧨 EXCEPTION: 'Default Test File Full Preprocessor' (gcc) terminated with exit code [1] and output ⏩️
In file included from test/test_sensor.c:14:
build/test/partials/test_sensor/ceedling_partial_sensor_impl.h:5:10: fatal error: header.h: No such file or directory
5 | #include "header.h"
| ^~~~~~~~~~
compilation terminated.
Executed Command: gcc -E -I"build/test/mocks/test_sensor" -I"build/test/partials/test_sensor" -I"test/support" -I"src" -I"build/vendor/unity/src" -I"build/vendor/cmock/src" -I"build/vendor/ceedling" -D"TEST" -D"CEEDLING_PARTIALS_PREFIX=ceedling_partial_" -D"UNITY_EXCLUDE_FLOAT" -D"CMOCK_MOCK_PREFIX=mock_" -DGNU_COMPILER -x c "test/test_sensor.c" -o "build/test/preprocess/files/test_sensor/full_expansion/test_sensor.c"
Specifications
Ceedling => 1.1.0.pre.2-645b64a
----------------------
/home/joel/.local/share/gem/ruby/3.3.0/gems/ceedling-1.1.0.pre.2/
Build Frameworks
----------------------
CMock => 2.6.3
Unity => 2.6.3
CException => 1.3.4
Description
I found another quirk on the preprocessing of files to create partials. When the module to be "partialled" has an include with a path
The relative path is cut out on the
ceedling_partial_...files, and because the include now becomes#include "header.h", the compilation fails to find it.I added a zip file with a compressed folder with the smallest reproducible example. It's the same structure as the example on the documentation, but I added a
header.hwith a silly typedef-ed enum, and modifiedSensor_Initto return a value of that type.This happens whether the #include is in the .h or in the .c of the module to be partial-ed.
It can be worked around by adding the absolute path of the header to the
project.ymlfile (Ceedling is then capable of finding it).partials.zip
Steps to Reproduce the Problem
:use_partials: TRUE.sensor.handsensor.cand copy the contents, as per the documentationhal.hontest/supportand addtest_sensor.cand copy the contents, as listed in the example#include utils/header.hExpected Behavior
Ceedling can compile the tests and run them
Actual Behavior
The created partial files,
ceedling_partial_sensor_impl.candceedling_partial_sensor_impl.h, have the relative path stripped and only show the name of the module on the include#include "header.h", which can't be found and the compilation failsSpecifications