Skip to content

Commit a5ce7f9

Browse files
committed
Merge branch 'main' into memory-report-ci
2 parents 8ba2c18 + 91d4ad5 commit a5ce7f9

File tree

251 files changed

+28787
-525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+28787
-525
lines changed

.clang-tidy

Lines changed: 8 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -1,214 +1,21 @@
11
Checks: '
22
clang-diagnostic-*,
3-
boost-*,
43
Google-*,
54
clang-analyzer-*,
65
modernize-*,
76
performance-*,
87
portability-*,
98
readability-*,
10-
cppcoreguidelines-*,
11-
llvm-*,
129
cert-*,
13-
-clang-analyzer-core.CallAndMessage'
10+
-readability-else-after-return,
11+
-clang-analyzer-core.CallAndMessage,
12+
-clang-analyzer-optin.performance.Padding,
13+
-readability-magic-numbers,
14+
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
15+
-readability-function-cognitive-complexity,
16+
-modernize-macro-to-enum
17+
'
1418
WarningsAsErrors: true
1519
HeaderFilterRegex: ''
1620
AnalyzeTemporaryDtors: false
1721
FormatStyle: none
18-
CheckOptions:
19-
- key: cert-dcl16-c.NewSuffixes
20-
value: 'L;LL;LU;LLU'
21-
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
22-
value: '0'
23-
- key: cppcoreguidelines-avoid-magic-numbers.IgnoredFloatingPointValues
24-
value: '1.0;100.0;'
25-
- key: cppcoreguidelines-avoid-magic-numbers.IgnoredIntegerValues
26-
value: '1;2;3;4;'
27-
- key: cppcoreguidelines-explicit-virtual-functions.FinalSpelling
28-
value: final
29-
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
30-
value: '1'
31-
- key: cppcoreguidelines-explicit-virtual-functions.OverrideSpelling
32-
value: override
33-
- key: cppcoreguidelines-macro-usage.AllowedRegexp
34-
value: '^DEBUG_*'
35-
- key: cppcoreguidelines-macro-usage.CheckCapsOnly
36-
value: '0'
37-
- key: cppcoreguidelines-macro-usage.IgnoreCommandLineMacros
38-
value: '1'
39-
- key: cppcoreguidelines-no-malloc.Allocations
40-
value: '::malloc;::calloc'
41-
- key: cppcoreguidelines-no-malloc.Deallocations
42-
value: '::free'
43-
- key: cppcoreguidelines-no-malloc.Reallocations
44-
value: '::realloc'
45-
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
46-
value: '1'
47-
- key: cppcoreguidelines-owning-memory.LegacyResourceConsumers
48-
value: '::free;::realloc;::freopen;::fclose'
49-
- key: cppcoreguidelines-owning-memory.LegacyResourceProducers
50-
value: '::malloc;::aligned_alloc;::realloc;::calloc;::fopen;::freopen;::tmpfile'
51-
- key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader
52-
value: ''
53-
- key: cppcoreguidelines-pro-bounds-constant-array-index.IncludeStyle
54-
value: 'llvm'
55-
- key: cppcoreguidelines-pro-type-member-init.IgnoreArrays
56-
value: '0'
57-
- key: cppcoreguidelines-pro-type-member-init.UseAssignment
58-
value: '0'
59-
- key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctions
60-
value: '0'
61-
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
62-
value: '0'
63-
- key: google-readability-braces-around-statements.ShortStatementLines
64-
value: '1'
65-
- key: google-readability-function-size.StatementThreshold
66-
value: '800'
67-
- key: google-readability-namespace-comments.ShortNamespaceLines
68-
value: '10'
69-
- key: google-readability-namespace-comments.SpacesBeforeComments
70-
value: '2'
71-
- key: llvm-namespace-comment.ShortNamespaceLines
72-
value: '1'
73-
- key: llvm-namespace-comment.SpacesBeforeComments
74-
value: '1'
75-
- key: modernize-loop-convert.MaxCopySize
76-
value: '16'
77-
- key: modernize-loop-convert.MinConfidence
78-
value: reasonable
79-
- key: modernize-loop-convert.NamingStyle
80-
value: CamelCase
81-
- key: modernize-make-shared.IgnoreMacros
82-
value: '1'
83-
- key: modernize-make-shared.IncludeStyle
84-
value: 'llvm'
85-
- key: modernize-make-shared.MakeSmartPtrFunction
86-
value: 'std::make_shared'
87-
- key: modernize-make-shared.MakeSmartPtrFunctionHeader
88-
value: memory
89-
- key: modernize-make-unique.IgnoreMacros
90-
value: '1'
91-
- key: modernize-make-unique.IncludeStyle
92-
value: 'llvm'
93-
- key: modernize-make-unique.MakeSmartPtrFunction
94-
value: 'std::make_unique'
95-
- key: modernize-make-unique.MakeSmartPtrFunctionHeader
96-
value: memory
97-
- key: modernize-pass-by-value.IncludeStyle
98-
value: llvm
99-
- key: modernize-pass-by-value.ValuesOnly
100-
value: '0'
101-
- key: modernize-raw-string-literal.ReplaceShorterLiterals
102-
value: '0'
103-
- key: modernize-replace-auto-ptr.IncludeStyle
104-
value: llvm
105-
- key: modernize-replace-random-shuffle.IncludeStyle
106-
value: llvm
107-
- key: modernize-use-auto.MinTypeNameLength
108-
value: '5'
109-
- key: modernize-use-auto.RemoveStars
110-
value: '0'
111-
- key: modernize-use-default-member-init.IgnoreMacros
112-
value: '1'
113-
- key: modernize-use-default-member-init.UseAssignment
114-
value: '0'
115-
- key: modernize-use-emplace.ContainersWithPushBack
116-
value: '::std::vector;::std::list;::std::deque'
117-
- key: modernize-use-emplace.SmartPointers
118-
value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr'
119-
- key: modernize-use-emplace.TupleMakeFunctions
120-
value: '::std::make_pair;::std::make_tuple'
121-
- key: modernize-use-emplace.TupleTypes
122-
value: '::std::pair;::std::tuple'
123-
- key: modernize-use-equals-default.IgnoreMacros
124-
value: '1'
125-
- key: modernize-use-equals-delete.IgnoreMacros
126-
value: '1'
127-
- key: modernize-use-nodiscard.ReplacementString
128-
value: '[[nodiscard]]'
129-
- key: modernize-use-noexcept.ReplacementString
130-
value: ''
131-
- key: modernize-use-noexcept.UseNoexceptFalse
132-
value: '1'
133-
- key: modernize-use-nullptr.NullMacros
134-
value: 'NULL'
135-
- key: modernize-use-override.FinalSpelling
136-
value: final
137-
- key: modernize-use-override.IgnoreDestructors
138-
value: '0'
139-
- key: modernize-use-override.OverrideSpelling
140-
value: override
141-
- key: modernize-use-transparent-functors.SafeMode
142-
value: '0'
143-
- key: modernize-use-using.IgnoreMacros
144-
value: '1'
145-
- key: performance-faster-string-find.StringLikeClasses
146-
value: 'std::basic_string'
147-
- key: performance-for-range-copy.AllowedTypes
148-
value: ''
149-
- key: performance-for-range-copy.WarnOnAllAutoCopies
150-
value: '0'
151-
- key: performance-inefficient-string-concatenation.StrictMode
152-
value: '0'
153-
- key: performance-inefficient-vector-operation.VectorLikeClasses
154-
value: '::std::vector'
155-
- key: performance-move-const-arg.CheckTriviallyCopyableMove
156-
value: '1'
157-
- key: performance-move-constructor-init.IncludeStyle
158-
value: llvm
159-
- key: performance-type-promotion-in-math-fn.IncludeStyle
160-
value: llvm
161-
- key: performance-unnecessary-copy-initialization.AllowedTypes
162-
value: ''
163-
- key: performance-unnecessary-value-param.AllowedTypes
164-
value: ''
165-
- key: performance-unnecessary-value-param.IncludeStyle
166-
value: llvm
167-
- key: portability-simd-intrinsics.Std
168-
value: ''
169-
- key: portability-simd-intrinsics.Suggest
170-
value: '0'
171-
- key: readability-braces-around-statements.ShortStatementLines
172-
value: '0'
173-
- key: readability-function-size.BranchThreshold
174-
value: '4294967295'
175-
- key: readability-function-size.LineThreshold
176-
value: '4294967295'
177-
- key: readability-function-size.NestingThreshold
178-
value: '4294967295'
179-
- key: readability-function-size.ParameterThreshold
180-
value: '4294967295'
181-
- key: readability-function-size.StatementThreshold
182-
value: '800'
183-
- key: readability-function-size.VariableThreshold
184-
value: '4294967295'
185-
- key: readability-identifier-length.MinimumParameterNameLength
186-
value: 2
187-
- key: readability-identifier-naming.IgnoreFailedSplit
188-
value: '0'
189-
- key: readability-implicit-bool-conversion.AllowIntegerConditions
190-
value: '0'
191-
- key: readability-implicit-bool-conversion.AllowPointerConditions
192-
value: '0'
193-
- key: readability-inconsistent-declaration-parameter-name.IgnoreMacros
194-
value: '1'
195-
- key: readability-inconsistent-declaration-parameter-name.Strict
196-
value: '0'
197-
- key: readability-magic-numbers.IgnoredFloatingPointValues
198-
value: '1.0;100.0;'
199-
- key: readability-magic-numbers.IgnoredIntegerValues
200-
value: '1;2;3;4;'
201-
- key: readability-redundant-smartptr-get.IgnoreMacros
202-
value: '1'
203-
- key: readability-simplify-boolean-expr.ChainedConditionalAssignment
204-
value: '0'
205-
- key: readability-simplify-boolean-expr.ChainedConditionalReturn
206-
value: '0'
207-
- key: readability-simplify-subscript-expr.Types
208-
value: '::std::basic_string;::std::basic_string_view;::std::vector;::std::array'
209-
- key: readability-static-accessed-through-instance.NameSpecifierNestingThreshold
210-
value: '3'
211-
- key: readability-uppercase-literal-suffix.IgnoreMacros
212-
value: '1'
213-
- key: readability-uppercase-literal-suffix.NewSuffixes
214-
value: ''
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Set up build environment
2+
description: Set up Java and Gradle.
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- uses: actions/setup-java@v3
8+
with:
9+
distribution: temurin
10+
java-version: 17
11+
- name: Gradle Build Action
12+
uses: gradle/gradle-build-action@v2.8.0

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ jobs:
2121
submodules: recursive
2222
- name: Install deps
2323
run: sudo apt-get install lcov
24+
- name: Setup java and gradle for compiling lfc
25+
uses: ./.github/actions/prepare-build-env
26+
# Uncomment to SSH into the runner.
27+
# - name: Setup upterm session
28+
# uses: lhotari/action-upterm@v1
2429
- name: Run tests
2530
run: |
31+
source env.bash
2632
make format-check
2733
make test
2834
make coverage

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ cmake-build-debug
66
cmake-build-release
77
.idea
88
include/reactor-uc/config.h
9+
!lfc/bin
910

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "external/Unity"]
22
path = external/Unity
33
url = https://github.com/ThrowTheSwitch/Unity.git
4+
[submodule "external/nanopb"]
5+
path = external/nanopb
6+
url = https://github.com/nanopb/nanopb.git

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Changelog
2+
3+
24
## Sep 21
35
- Adding PhysicalActions and also extend the Posix support (using pthread to allow testing with threads scheduling async events.)
46
-

CMakeLists.txt

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ cmake_minimum_required(VERSION 3.9)
22
project(reactor-uc LANGUAGES C)
33

44
# Command line options for the build
5-
set(BUILD_TESTS OFF CACHE BOOL "Build unit tests")
5+
set(BUILD_EXAMPLES OFF CACHE BOOL "Build examples")
6+
set(BUILD_TESTS OFF CACHE BOOL "Build all tests")
7+
set(BUILD_LF_TESTS OFF CACHE BOOL "Build lf tests")
8+
set(BUILD_UNIT_TESTS OFF CACHE BOOL "Build unit tests")
69
set(TEST_COVERAGE OFF CACHE BOOL "Compute test coverage")
710
set(ASAN OFF CACHE BOOL "Compile with AddressSanitizer")
811
set(PLATFORM "POSIX" CACHE STRING "Platform to target")
@@ -25,47 +28,61 @@ endif()
2528

2629
# Clang-tidy for static code analysis
2730
if(BUILD_TESTS)
31+
set(BUILD_LF_TESTS ON)
32+
set(BUILD_UNIT_TESTS ON)
2833
set(CMAKE_BUILD_TYPE "Debug")
2934
find_program(CLANG_TIDY clang-tidy)
3035
if (CLANG_TIDY)
31-
set(CMAKE_C_CLANG_TIDY clang-tidy; --header-filter=include/\(.*\)\\.h; --warnings-as-errors)
36+
set(CMAKE_C_CLANG_TIDY clang-tidy; --header-filter=include/\(.*\)\\.h; --warnings-as-errors=*;)
3237
else ()
3338
message(WARNING "Please install clang-tidy!")
3439
endif()
3540
endif()
3641

37-
# TODO: Explicitly name all the sources.
38-
file(GLOB SOURCES "src/*.c")
39-
message(${SOURCES})
42+
# Add nanopb library manually
43+
set(NANOPB_PATH external/nanopb)
44+
add_library(nanopb ${NANOPB_PATH}/pb_common.c ${NANOPB_PATH}/pb_encode.c ${NANOPB_PATH}/pb_decode.c)
45+
set_target_properties(nanopb PROPERTIES C_CLANG_TIDY "") # Disable clang-tidy for this external lib.
46+
47+
file(GLOB SOURCES "src/*.c" "external/proto/*.c")
4048

4149
if (PLATFORM STREQUAL "POSIX")
4250
add_library(reactor-uc STATIC ${SOURCES})
43-
target_compile_definitions(reactor-uc PUBLIC PLATFORM_POSIX)
4451
target_link_libraries(reactor-uc PRIVATE pthread)
52+
if(BUILD_EXAMPLES)
53+
add_subdirectory(examples/posix)
54+
endif ()
4555
elseif (PLATFORM STREQUAL "ZEPHYR")
4656
zephyr_library_named(reactor-uc)
4757
zephyr_library_sources(${SOURCES})
4858
zephyr_library_link_libraries(kernel)
49-
add_compile_definitions(PLATFORM_ZEPHYR)
5059
else ()
5160
message(FATAL_ERROR "No valid platform specified")
5261
endif ()
5362

63+
add_compile_definitions("PLATFORM_${PLATFORM}")
64+
65+
target_link_libraries(reactor-uc PRIVATE nanopb)
66+
target_compile_options(reactor-uc PRIVATE -Wall -Wextra -Werror)
5467
add_compile_options (-fdiagnostics-color=always)
55-
target_include_directories(reactor-uc PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
68+
target_include_directories(reactor-uc PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include ${CMAKE_CURRENT_LIST_DIR}/external)
5669

5770
configure_file(
5871
${CMAKE_CURRENT_SOURCE_DIR}/include/reactor-uc/config.h.in
5972
${CMAKE_CURRENT_SOURCE_DIR}/include/reactor-uc/config.h
6073
)
6174

62-
if(BUILD_TESTS)
63-
target_compile_options(reactor-uc PRIVATE -Wall -Wextra -pedantic -Werror)
75+
if(BUILD_UNIT_TESTS)
6476
set(UNITY_DIR ${CMAKE_CURRENT_LIST_DIR}/external/Unity)
6577
include(CTest)
6678
add_library(Unity STATIC ${UNITY_DIR}/src/unity.c)
6779
target_include_directories(Unity PUBLIC ${UNITY_DIR}/src)
6880
set_target_properties( Unity PROPERTIES C_CLANG_TIDY "") # Disable clang-tidy for this external lib.
69-
add_subdirectory(test)
81+
add_subdirectory(test/unit)
7082
endif()
7183

84+
if(BUILD_LF_TEST)
85+
# TODO: Setup automatic code-gen and compiling of the LF tests as well.
86+
# Ideally we include code-coverage from the LF tests into the overall coverage.
87+
# Currently it is done from a stupid Makefile
88+
endif()

0 commit comments

Comments
 (0)