Skip to content

compiling unit tests uses arduino platform specific code #331

Open
@daniel-mohr

Description

@daniel-mohr

Issue Summary

During compiling the unit tests, arduino_ci compiles all *.c* files of the library.

But it uses not the platform specific dependencies. Since the unit tests should run on system running arduino_ci this sounds clear. But its not; the source code was written for the specified arduino system and at most time can not be build on a system running arduino_ci.

Arduino or Unit Test Code, Illustrating the Problem

As example I used Udp.h for the platform zero in the source code of the library. So the unit tests cannot be compiled.

Since I'm writing the code I'm free to split it. Some parts could be tested -- e. g. macros running on linux systems,
which could be stored in separated header files.

So, I see a few solutions:

  1. Add to arduino_ci the possibility to skip some files during building unit tests.
  2. Add to arduino_ci the possibility to add custom code to mock some libraries or at least to mock some header files of used libraries.
  3. Add documentation how to add custom code to mock something.

I'm not sure if adding mocked header files to /var/lib/gems/*/gems/arduino_ci-*/cpp/arduino/ or /var/lib/gems/*/bundler/gems/arduino_ci-*/cpp/arduino/ is the right way. But it works. ?

Arduino Architecture(s) Affected

all

Metadata

Metadata

Assignees

No one assigned

    Labels

    arduino mocksCompilation mocks for the Arduino librarybugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions