source file directories

685 views
Skip to first unread message

Łukasz Przeniosło

unread,
Mar 3, 2021, 5:44:18 AM3/3/21
to ThrowTheSwitch Forums
Hello there,
I am trying to work out the Ceedling system. I managed to run it correctly when the needed source files are placed in the src directory. But I have 2 problems with my source files:
  1. It would be best for the sake of proper maintenance if I did not have manually copy the files to src each time I pull some changes from a git repo that is in some other directory. Is it possible to instruct Ceedling to look for source files in a different than src directory? For example, provide it with a relative to src path?

  2. In my source files I want to write the tests for I have relative include paths, such as:

    #include "../../../../adc/adc.h"

    This is another obstacle that I would need to deal with if I were to place all source files to the dedicated src directory. Without having to move the files, this problem would not be in place (hopefully...).
I would appreciate all feedback!

Mark Vander Voord

unread,
Mar 3, 2021, 7:11:28 AM3/3/21
to ThrowTheSwitch Forums
Hi.

Yes, it's easy to set up different paths for your source files, tests, and includes. It's no problem if you want to specify relative paths with Ceedling... make them relative to where your project.yml file is, and call ceedling from that folder, and everything will work out fine.

To configure the paths that Ceedling will look for your files, you set the :paths: in the project.yml file:

:paths:
  :source:
    - "+:one/subfolder/"
    - "+:../use/all/folders/nested/**"
  :test:
    - "test/"
  :include:
    - "another/path/of/includes"

You can find this sort of configuration information in the ceedling docs here:


There you will find all the ways of managing paths and even individual files.

Mark




--
You received this message because you are subscribed to the Google Groups "ThrowTheSwitch Forums" group.
To unsubscribe from this group and stop receiving emails from it, send an email to throwtheswitc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/throwtheswitch/feb862f6-c2cb-470a-8856-ced89ce79d1cn%40googlegroups.com.

Łukasz Przeniosło

unread,
Mar 3, 2021, 7:15:50 AM3/3/21
to ThrowTheSwitch Forums
Hi Mark,
Understood, thank you!

--
Pozdrawiam / Best Regards,
Łukasz Przeniosło
Przenioslo Electronics & Software
ul. Ofiar Katynia 21
72-100 Goleniów, Poland
VATID: PL5993131022
tel. +48 792 456 829
www.przenioslo.com



You received this message because you are subscribed to a topic in the Google Groups "ThrowTheSwitch Forums" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/throwtheswitch/Q3ruuk83mJ4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to throwtheswitc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/throwtheswitch/CAAu8-XG0z4oT1%3DzVaHSjTA0CYj1TqtcHDfmQubahxe8v3N%2B3mw%40mail.gmail.com.

Łukasz Przeniosło

unread,
Mar 3, 2021, 8:09:52 AM3/3/21
to ThrowTheSwitch Forums
Mark, one more question. This one I cannot quite grasp:
lets say I want to test some functions from the c/h files I have added. In the project file:

:files:
  :include:
    - ../../dir1/dir2/inc/adc.h
  :source:
    - ../../dir1/dir2/src/adc.c

And this works. But now that adc.c file includes another file called myTypes.h. So in my test_adc.c file I include: mock_myTypes.h and run ceedling and get an error:

ERROR: Found no file 'myTypes.h' in search paths.
rake aborted!

But I want to mock this one! Is there a flaw in my understanding of the system?

Mark Vander Voord

unread,
Mar 3, 2021, 8:35:14 AM3/3/21
to ThrowTheSwitch Forums
Mocks are generated automatically by CMock by looking at the header file for that module. It then creates a mock version of the "public" functions it finds in the header. Because of this, Ceedling needs to be able to find that header file somewhere in its paths. So if you have a file "myTypes.h" the PATH (or directly include the file, if you wish... but paths are much cleaner because it's automatic as you expand) needs to include myTypes.h.

Once Ceedling sees myTypes.h in the path, it will know how to make a mock for it automatically.

Mark

Łukasz Przeniosło

unread,
Mar 3, 2021, 8:51:02 AM3/3/21
to ThrowTheSwitch Forums
I see, this makes sense.

but paths are much cleaner because it's automatic as you expand

I agree, but since I am trying to figure out whether I know what I am doing, I am trying to pick files separately now. 
Ok so under the files -> include section I have added the path to the myTypes.h. Now the mock_myTypes.h file is created under build/test/mocks, but it does not respect the include path. The file does:

include "myTypes.h"

instead of

include "../../../../../../myTypes.h"

If I manually change it, it will go forward. But if I remove the file from cache, it will be overwritten- this imposes a problem with git integration, since I believe that cached files should not be committed?
Reply all
Reply to author
Forward
0 new messages