![]() |
reactor-c 1.0
C Runtime for Lingua Franca
|
Contributions to reactor-c are welcome as long as they conform with the programming style, include tests, and can be released open-source with BSD licence.
All code contributions must go through a pull request (PR), pass all tests run in CI, and get an approving review before it is merged. Pushing to the main branch is restricted. All code review is conducted using the Github review system on PRs. Before requesting a code review, ensure that you have:
This repository uses Doxygen to generate online documentation from source files. It uses Javadoc-style documentation with Markdown supported in the comment bodies.
To build the documentation on your local machine, in a clone of the reactor-c repository, simply run
(Running make with no arguments will list available targets.)
The documentation conventions are:
Each source file include in the documentation should begin with documentation having the following form:
Each function should be documented using the following pattern:
When a function's doc includes an @ingroup tag, then it will be listed the "Topics" section of the documentation. Otherwise, it will only appear in the "Files" section (which is harder to navigate). The defined topics are:
The groups are defined in the file docs/doxygen.h.
System tests are Lingua Franca programs that either compile and run to completion (the test passes) or fail to compile or exit the run with an error condition (returning non-zero). System tests are defined in the test/C directory of the lingua-franca repo.
The Github Actions tests for this repo will automatically run all the C Lingua Franca tests with each of the available schedulers and with both the C and CCpp target specified. The version of the lingua-franca repo that is used to do this is specified by the lingua-franca-ref.txt file in this directory. Normally, this should point to master, but to run tests temporarily with a branch of the code generator, just change lingua-franca-ref.txt to point to your branch.
To run the system tests locally on your machine, check out the lingua-franca repository and replace the reactor-c submodule with your branch:
Then follow the lingua-franca instructions for running tests.
To create a new unit test, write a C program with a file name ending in "test.c" in a subdirectory of the test directory. That file should contain a main and should return 0 if the test succeeds.
To run tests for the single-threaded runtime, execute the following. Note that -U is required to undefine a name that may be cached from a previous run.
To run the scheduling tests on a Linux platform, provide a nonzero number of workers when invoking cmake and use sudo. For example, in the build directory:
One of the tests requires sudo because it changes the scheduling policy and priorities.
To define/undefine other preprocessor definitions such as LOG_LEVEL, pass them as arguments to cmake in the same way as with NUMBER_OF_WORKERS, using the same -D/-U prefixes.
We use clang-format to format our codebase. To run the formatter on all source and header files in reactor-c:
The CI will do a "dry-run" of the formatter to verify that all files are correctly formatted and will indicate errors if not.
VSCode can be configured to run clang-format on files as they are saved. To achieve this set the following settings:
Comments
Please adhere to the following principles when writing documentation for your code: