ThrowTheSwitch / Ceedling

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

Test linking issue #904

Closed mdyme closed 1 month ago

mdyme commented 4 months ago

Two tests are using the same mock file:

test_simple1.c: ...

include "mock_function.c"

...

test_simple2.c: ...

include "mock_function.c"

...

function.c id following:

ifdef FUNCTION

void my_function() {};

endif

These tests are using different set of defines in yml file: ... :defines: :test_simple1:

When running these tests I have following linker issue: ... Generating include list for mock_function.c Creating mock for mock_function.c Compiling mock_function.c Linking test_simple1.elf Running test_simple1.elf ... Generating include list for mock_function.c Creating mock for mock_function.c Linking test_simple2.elf test_simple2.o: undefined reference to `my_function_Stub' ...

When building test_simlpe2 step "Compiling mock_function.c" is missing. This causes linking issue. When running test_simple2 alone there is no linker issue.

Could not find in documentation how to enforce recompilation of all mocs for each test.

mvandervoord commented 4 months ago

If you look into switching to the release candidate for Ceedling, this has already been fixed.

mdyme commented 4 months ago

mvandervoord thank you for your quick response, we will consider this upgrade

mdyme commented 1 month ago

At this point we are not able to adapt our large project to all breaking changes for version 0.32_RC. Could you provide information which commit is fixing this linking issue?

mvandervoord commented 1 month ago

This isn't a feature we're considering backporting to the previous release. The entire structure of how dependency tracking and per-file compilation options changed in order to support this.

mdyme commented 1 month ago

Ok, got it. What Ruby version is recommended for 0.32_RC?

ckielstra commented 1 month ago

From the release notes: Ceedling now runs in Ruby3. This latest version of Ceedling is not backwards compatible with earlier versions of Ruby.

mdyme commented 1 month ago

Thanks for your answers.

Probably it should be reported under another issue, but when running 0.32_RC with Ruby3.3 I have:

ceedling test:my_test
<internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require': cannot load such file -- constructor (LoadError)
Did you mean?  ostruct
        from <internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
        from C:/my_project_path/ceedling/ceed_ws//vendor/ceedling/bin/ceedling:24:in `<main>'
Failed: ceedling test:my_test

The same for Ruby 3.2.

On Ruby 3.0 I have different issue related with vendor version:

ceedling test:my_test
Loaded project configuration from environment variable `CEEDLING_PROJECT_FILE`.
 > Using: C:/my_project_path/ceedling/generic.yml
 > Working directory: C:/my_project_path/ceedling

EXCEPTION: Could not collect version information for vendor component: C:/workspace/gitwork/Ceedling/vendor/unity/src/unity.h
Failed: ceedling test:my_test

Any suggestions how to handle these issues? Couldn't find anything interesting in Ceedling's documentation, or I checked wrong .md files.

Letme commented 1 month ago

I think Mark wanted to you change to 1.0.0 pre-releases, not 0.32_RC. I also suggest you compare your project.yml with generated project.ymlwhen you would start a new project, because there are some differences between 0.31 and 1.0.0.

mdyme commented 1 month ago

Closing issue - moving new issues to https://github.com/ThrowTheSwitch/Ceedling/issues/943