简体   繁体   English

带有多个源文件扩展名的 Ceedling

[英]Ceedling with multiple source file extensions

I am trying to setup up unit tests for my existing embedded project.我正在尝试为我现有的嵌入式项目设置单元测试。 Unfortunatly the project has mixed extentions for the source files ".c" and ".C".不幸的是,该项目的源文件“.c”和“.C”混合了扩展名。 Due to version control history I cannnot just rename all files to ".c"由于版本控制历史,我不能只是将所有文件重命名为“.c”

I tried to edit the yaml file accordingly, but it seems it ceedling only support one or the other extension.我试图相应地编辑 yaml 文件,但它似乎只支持一个或另一个扩展名。

Normal普通的

...
:extension:
  :executable: .out
  :source: .c
...

Not working way, but desired不工作,但需要

...
:extension:
  :executable: .out
  :source: .c ; .C
...

LED.C is not compiled. LED.C 未编译。 So the linker fails.所以链接器失败。

Test 'test_LED.c'
-----------------
Generating runner for test_LED.c...
Compiling test_LED_runner.c...
Compiling test_LED.c...
Linking test_LED.out...
build/test/out/c/test_LED.o: In function `test_LED_NeedToImplement':
C:\Users\de7d7b\Workspaces\C_\myProject/test/test_LED.c:14: undefined reference to `LED_turnOn'
collect2.exe: error: ld returned 1 exit status

This is currently does not seem possible with Ceedling as of 0.29.1 due to the source extensions being only used as a single configuration string and not an array.从 0.29.1 开始,这在 Ceedling 中似乎是不可能的,因为源扩展仅用作单个配置字符串而不是数组。 I highly recommend opening a feature request for it.我强烈建议为它打开一个功能请求。

In the mean time, there is at leas a partial workaround you can do by creating symlink for each file.同时,您至少可以通过为每个文件创建符号链接来解决部分问题。 This is annoying, but will allow you to utilize ceedling without renaming all the files.这很烦人,但可以让您在不重命名所有文件的情况下使用 ceedling。 For example if the file you want to test was in src:例如,如果您要测试的文件在 src 中:

ln -s LED.C src/LED.c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM