0

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". Due to version control history I cannnot just rename all files to ".c"

I tried to edit the yaml file accordingly, but it seems it ceedling only support one or the other extension.

Normal

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

Not working way, but desired

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

LED.C is not compiled. 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
Clifford
  • 88,407
  • 13
  • 85
  • 165
  • Seems to me that the proper solution is to find the person who uses upper case in their file extensions, tell them to fix their s*** and commit again. Source file naming is something that should be mentioned very early on in your coding standard. – Lundin Sep 09 '19 at 14:01
  • .C (upper case) was the original convention for C++, an early of a long line of stumbles. To be fair; using case-ignoring file systems is every bit as thick as relying on case-sensitive file systems. – mevets Sep 09 '19 at 15:23
  • Which tool are you using with that YAML? Did you try other separators like colon, comma, or simply space? – the busybee Sep 09 '19 at 15:56
  • What _VCS_ system are you using? It would be a pretty poor one if it did not support file renaming under version control (i.e. retaining history). For SVN for example: https://stackoverflow.com/questions/17279947/how-to-rename-a-file-using-svn. Essentially you rename it _in the repository_. Tortoise SVN even has a rename function in the context menu, and will offer to automatically rename "similarly named files" (although that may be be limited to files with the same name but different extension). Otherwise a simple script to batch-rename all such files. – Clifford Sep 09 '19 at 17:40
  • have you tried ".c .C" and ".c , .C" instead of ".c ; .C" ? – Guillaume D Sep 10 '19 at 13:35

1 Answers1

0

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. 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. For example if the file you want to test was in src:

ln -s LED.C src/LED.c
Dom
  • 1,687
  • 6
  • 27
  • 37