Skip to content

Commit 61d6ef2

Browse files
authored
Merge branch 'main' into min-sleep-busy-wait
2 parents 0fc0a40 + 856e98a commit 61d6ef2

File tree

134 files changed

+4996
-3347
lines changed

Some content is hidden

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

134 files changed

+4996
-3347
lines changed

.github/workflows/api-docs.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ on:
66

77
jobs:
88
build:
9-
109
runs-on: macos-latest
11-
1210
steps:
1311
- name: Requirements
14-
run: brew install doxygen
15-
&& brew install sphinx-doc
16-
&& pip3 install sphinx-rtd-theme
17-
&& pip3 install breathe
18-
&& pip3 install sphinx-sitemap
19-
&& pip3 install exhale
12+
run: |
13+
brew install doxygen
14+
brew install sphinx-doc
15+
python3 -m venv .venv
16+
source .venv/bin/activate
17+
pip3 install sphinx-rtd-theme
18+
pip3 install breathe
19+
pip3 install sphinx-sitemap
20+
pip3 install exhale
2021
- name: Checkout repo
2122
uses: actions/checkout@1.0.0
2223
- name: Build docs

.github/workflows/build-rti.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,32 @@ on:
44
workflow_call:
55

66
jobs:
7-
run:
7+
native-build:
88
strategy:
99
matrix:
10-
platform: [ubuntu-latest, macos-latest, windows-latest]
10+
platform: [ubuntu-24.04, macos-latest, windows-latest]
1111
runs-on: ${{ matrix.platform }}
1212

1313
steps:
1414
- name: Check out reactor-c repository
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
1616
- name: Build the RTI with AUTH=OFF
1717
run: .github/scripts/build-rti.sh -DAUTH=OFF
1818
- name: Build the RTI with AUTH=ON
1919
run: .github/scripts/build-rti.sh -DAUTH=ON
20+
21+
docker-build:
22+
runs-on: ubuntu-24.04
23+
steps:
24+
- name: Check out reactor-c repository
25+
uses: actions/checkout@v4
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
- name: Build Docker image
29+
uses: docker/build-push-action@v6
30+
with:
31+
file: ./core/federated/RTI/rti.Dockerfile
32+
context: .
33+
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/riscv64
34+
push: false
35+
tags: lflang/rti:latest

.github/workflows/build-trace-tools.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
run:
88
strategy:
99
matrix:
10-
platform: [ubuntu-latest, macos-latest, windows-latest]
10+
platform: [ubuntu-24.04, macos-latest, windows-latest]
1111
runs-on: ${{ matrix.platform }}
1212

1313
steps:

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
concurrency:
1313
group: ci-${{ github.ref }}-${{ github.event_path }}
14-
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
14+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
1515

1616
jobs:
1717
check-labels:
@@ -55,6 +55,14 @@ jobs:
5555
compiler-ref: ${{ needs.fetch-lf.outputs.ref }}
5656
if: ${{ !github.event.pull_request.draft ||contains( github.event.pull_request.labels.*.name, 'zephyr') }}
5757

58+
lf-default-flexpret:
59+
needs: [fetch-lf]
60+
uses: lf-lang/lingua-franca/.github/workflows/c-flexpret-tests.yml@master
61+
with:
62+
runtime-ref: ${{ github.ref }}
63+
compiler-ref: ${{ needs.fetch-lf.outputs.ref }}
64+
if: ${{ !github.event.pull_request.draft ||contains( github.event.pull_request.labels.*.name, 'flexpret') }}
65+
5866
lf-default:
5967
needs: [fetch-lf]
6068
uses: lf-lang/lingua-franca/.github/workflows/c-tests.yml@master
@@ -89,4 +97,4 @@ jobs:
8997
compiler-ref: ${{ needs.fetch-lf.outputs.ref }}
9098
scheduler: ADAPTIVE
9199
all-platforms: ${{ !github.event.pull_request.draft || contains( github.event.pull_request.labels.*.name, 'mac') || contains( github.event.pull_request.labels.*.name, 'windows') }}
92-
if: ${{ !github.event.pull_request.draft || contains( github.event.pull_request.labels.*.name, 'schedulers') }}
100+
if: ${{ !github.event.pull_request.draft || contains( github.event.pull_request.labels.*.name, 'schedulers') }}

.github/workflows/clang-format.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ on: [pull_request]
55

66
jobs:
77
clang-format:
8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-24.04
99
steps:
1010
- uses: actions/checkout@v2
11-
- name: Install clang-tidy
11+
- name: Install clang-tidy and clang-format
1212
run: |
1313
sudo apt-get update
1414
sudo apt-get install -y clang-tidy
15+
sudo apt-get install -y pipx
16+
pipx install clang-format
17+
clang-format --version
1518
- name: Analyze
1619
run: make format-check

.github/workflows/unit-tests.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
run:
1212
strategy:
1313
matrix:
14-
platform: [ubuntu-latest, macos-latest, windows-latest]
14+
platform: [ubuntu-24.04, macos-latest]
1515
runs-on: ${{ matrix.platform }}
1616

1717
steps:
@@ -24,4 +24,13 @@ jobs:
2424
cd build
2525
cmake .. ${{ inputs.cmake-args }}
2626
cmake --build .
27-
make test
27+
sudo make test
28+
- name: Run RTI unit tests
29+
run: |
30+
cd core/federated/RTI
31+
mkdir build
32+
cd build
33+
cmake ..
34+
cmake --build .
35+
ctest
36+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ util/tracing/trace_to_csv.o
1616
util/tracing/trace_to_influxdb
1717
util/tracing/trace_to_influxdb.o
1818
util/tracing/trace_util.o
19+
20+
# Generated trace lib
21+
trace/**/*.a

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ if(DEFINED LF_SINGLE_THREADED)
2222
add_compile_definitions(LF_SINGLE_THREADED=1)
2323
endif()
2424

25-
# Warnings as errors
26-
add_compile_options(-Werror)
27-
28-
set(Test test)
2925
set(Lib lib)
3026
set(CoreLibPath core)
3127
set(CoreLib reactor-c)
@@ -42,7 +38,6 @@ include_directories(${CMAKE_SOURCE_DIR}/include/core/utils)
4238
include_directories(${CMAKE_SOURCE_DIR}/include/api)
4339

4440
enable_testing()
45-
add_subdirectory(${Test})
4641
add_subdirectory(${Lib})
4742
add_subdirectory(${CoreLibPath})
4843

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ To run tests for the multithreaded runtime, provide a nonzero number of workers
4141
when invoking `cmake`. For example:
4242

4343
- `cmake .. -DNUMBER_OF_WORKERS=2`
44+
- `cmake --build .`
45+
- `sudo make test`
46+
47+
Note that one of the tests in the multithreaded test suite requires sudo because
48+
it changes the scheduling policy and priorities.
4449

4550
To define/undefine other preprocessor definitions such as `LOG_LEVEL`, pass them as
4651
arguments to `cmake` in the same way as with `NUMBER_OF_WORKERS`, using the same

core/CMakeLists.txt

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ include(${LF_ROOT}/core/lf_utils.cmake)
77
list(APPEND GENERAL_SOURCES tag.c clock.c port.c mixed_radix.c reactor_common.c lf_token.c environment.c)
88

99
# Add tracing support if requested
10-
if (DEFINED LF_TRACE)
10+
if(DEFINED LF_TRACE)
1111
message(STATUS "Including sources specific to tracing.")
1212
list(APPEND GENERAL_SOURCES tracepoint.c)
1313
endif()
@@ -16,7 +16,7 @@ endif()
1616
list(APPEND REACTORC_SOURCES ${GENERAL_SOURCES})
1717

1818
# Add sources for either threaded or single-threaded runtime
19-
if (DEFINED FEDERATED)
19+
if(DEFINED FEDERATED)
2020
include(federated/CMakeLists.txt)
2121
include(federated/network/CMakeLists.txt)
2222
endif()
@@ -35,14 +35,14 @@ endif()
3535

3636
# Add sources for the local RTI if we are using scheduling enclaves
3737
if(DEFINED LF_ENCLAVES)
38-
include(federated/RTI/local_rti.cmake)
38+
include(federated/RTI/local_rti.cmake)
3939
endif()
4040

4141
# Include sources from subdirectories
4242
include(utils/CMakeLists.txt)
4343

44-
if (DEFINED MODAL_REACTORS)
45-
include(modal_models/CMakeLists.txt)
44+
if(DEFINED MODAL_REACTORS)
45+
include(modal_models/CMakeLists.txt)
4646
endif()
4747

4848
# Print sources used for compilation
@@ -53,15 +53,28 @@ add_library(reactor-c)
5353
target_sources(reactor-c PRIVATE ${REACTORC_SOURCES})
5454
lf_enable_compiler_warnings(reactor-c)
5555

56-
if (DEFINED LF_TRACE)
56+
if(DEFINED LF_TRACE)
5757
include(${LF_ROOT}/trace/api/CMakeLists.txt)
58-
if(NOT LF_TRACE_PLUGIN)
59-
set(LF_TRACE_PLUGIN lf::trace-impl)
58+
target_link_libraries(reactor-c PUBLIC lf::trace-api)
59+
# If the user specified an external trace plugin. Find it and link with it
60+
if (LF_TRACE_PLUGIN)
61+
message(STATUS "Linking trace plugin library ${LF_TRACE_PLUGIN}")
62+
find_library(TRACE_LIB NAMES ${LF_TRACE_PLUGIN} HINTS "${LF_ROOT}")
63+
if (NOT TRACE_LIB)
64+
message(FATAL_ERROR "The trace plugin library ${LF_TRACE_PLUGIN} not found")
65+
endif()
66+
# We also link with libdl because it is needed for some platforms.
67+
# TODO: Figure out why this is the case and how to avoid it.
68+
target_link_libraries(reactor-c PRIVATE ${TRACE_LIB} dl)
69+
else()
70+
# If not, use the default implementation
71+
message(STATUS "Linking with default trace implementation")
6072
include(${LF_ROOT}/trace/impl/CMakeLists.txt)
73+
target_link_libraries(reactor-c PRIVATE lf::trace-impl)
6174
endif()
62-
message(STATUS "linking trace plugin library ${LF_TRACE_PLUGIN}")
63-
target_link_libraries(reactor-c PUBLIC lf::trace-api)
64-
target_link_libraries(reactor-c PRIVATE "${LF_TRACE_PLUGIN}")
75+
else()
76+
include(${LF_ROOT}/trace/api/types/CMakeLists.txt)
77+
target_link_libraries(reactor-c PUBLIC lf::trace-api-types)
6578
endif()
6679

6780
include(${LF_ROOT}/version/api/CMakeLists.txt)
@@ -93,43 +106,46 @@ target_include_directories(reactor-c PUBLIC ../include/core/threaded)
93106
target_include_directories(reactor-c PUBLIC ../include/core/utils)
94107
target_include_directories(reactor-c PUBLIC federated/RTI/)
95108

96-
if (APPLE)
97-
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
109+
if(APPLE)
110+
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
98111
SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
99-
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
112+
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
100113
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
101114
endif()
102115

103116
# Link with OpenSSL library
104117
if(DEFINED FEDERATED_AUTHENTICATED)
105-
if (APPLE)
118+
if(APPLE)
106119
set(OPENSSL_ROOT_DIR /usr/local/opt/openssl)
107120
endif()
121+
108122
find_package(OpenSSL REQUIRED)
109123
target_link_libraries(reactor-c PUBLIC OpenSSL::SSL)
110124
endif()
111125

112-
if(DEFINED _LF_CLOCK_SYNC_ON)
126+
if(DEFINED FEDERATED)
113127
find_library(MATH_LIBRARY m)
114128
if(MATH_LIBRARY)
115129
target_link_libraries(reactor-c PUBLIC ${MATH_LIBRARY})
116130
endif()
117131
endif()
118132

119133
# Unless specified otherwise initial event queue and reaction queue to size 10
120-
if (NOT DEFINED INITIAL_EVENT_QUEUE_SIZE)
134+
if(NOT DEFINED INITIAL_EVENT_QUEUE_SIZE)
121135
set(INITIAL_EVENT_QUEUE_SIZE 10)
122136
endif()
123-
if (NOT DEFINED INITIAL_REACT_QUEUE_SIZE)
137+
138+
if(NOT DEFINED INITIAL_REACT_QUEUE_SIZE)
124139
set(INITIAL_REACT_QUEUE_SIZE 10)
125140
endif()
126141

127142
target_compile_definitions(reactor-c PRIVATE INITIAL_EVENT_QUEUE_SIZE=${INITIAL_EVENT_QUEUE_SIZE})
128143
target_compile_definitions(reactor-c PRIVATE INITIAL_REACT_QUEUE_SIZE=${INITIAL_REACT_QUEUE_SIZE})
129144
target_compile_definitions(reactor-c PUBLIC PLATFORM_${CMAKE_SYSTEM_NAME})
130145

131-
# Macro for translating a command-line argument into compile definition for
132-
# reactor-c lib
146+
# If variable X is defined in cMake (set using SET()) or passed in as a command-line
147+
# argument using -DX=<value>, then make it a compiler flag for reactor-c so that X
148+
# is also defined in the C code for reactor-c.
133149
macro(define X)
134150
if(DEFINED ${X})
135151
message(STATUS ${X}=${${X}})
@@ -142,9 +158,9 @@ message(STATUS "Applying preprocessor definitions...")
142158
define(_LF_CLOCK_SYNC_ATTENUATION)
143159
define(_LF_CLOCK_SYNC_COLLECT_STATS)
144160
define(_LF_CLOCK_SYNC_EXCHANGES_PER_INTERVAL)
145-
define(_LF_CLOCK_SYNC_INITIAL)
146-
define(_LF_CLOCK_SYNC_ON)
161+
define(LF_CLOCK_SYNC) # 1 for OFF, 2 for INIT and 3 for ON.
147162
define(_LF_CLOCK_SYNC_PERIOD_NS)
163+
define(_LF_FEDERATE_NAMES_COMMA_SEPARATED)
148164
define(ADVANCE_MESSAGE_INTERVAL)
149165
define(EXECUTABLE_PREAMBLE)
150166
define(FEDERATED_CENTRALIZED)

0 commit comments

Comments
 (0)