Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion .ci/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,37 @@
platforms=["arm"],
cxxids=["clang"],
build_dir="build/s32k148-threadx-clang",
)
),
"integrationtest-posix-freertos": BuildOpTpl(
config_cmd="cmake --preset integrationtest-posix-freertos",
build_cmd="cmake --build --preset integrationtest-posix-freertos",
configs=["Debug", "Release"],
platforms=["linux"],
build_dir="build/integrationtest-posix-freertos",
),
"integrationtest-posix-threadx": BuildOpTpl(
config_cmd="cmake --preset integrationtest-posix-threadx",
build_cmd="cmake --build --preset integrationtest-posix-threadx",
configs=["Debug", "Release"],
platforms=["linux"],
build_dir="build/integrationtest-posix-threadx",
),
"integrationtest-s32k148-freertos-gcc": BuildOpTpl(
config_cmd="cmake --preset integrationtest-s32k148-freertos-gcc",
build_cmd="cmake --build --preset integrationtest-s32k148-freertos-gcc",
configs=["Debug", "Release", "RelWithDebInfo"],
platforms=["arm"],
cxxids=["gcc"],
build_dir="build/integrationtest-s32k148-freertos-gcc",
),
"integrationtest-s32k148-threadx-gcc": BuildOpTpl(
config_cmd="cmake --preset integrationtest-s32k148-threadx-gcc",
build_cmd="cmake --build --preset integrationtest-s32k148-threadx-gcc",
configs=["Debug", "Release", "RelWithDebInfo"],
platforms=["arm"],
cxxids=["gcc"],
build_dir="build/integrationtest-s32k148-threadx-gcc",
),
}


Expand Down
4 changes: 2 additions & 2 deletions .ci/posix_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def build_reference_app():

def run_pytest():
os.chdir("./test/pyTest")
subprocess.run(["pytest", "-s", "-v", "--target=posix", "--app=freertos"], check=True)
subprocess.run(["pytest", "-s", "-v", "--target=posix", "--app=threadx"], check=True)
subprocess.run(["pytest", "-s", "-v", "--target=posix", "--app=refApp_freertos"], check=True)
subprocess.run(["pytest", "-s", "-v", "--target=posix", "--app=refApp_threadx"], check=True)

if __name__ == "__main__":
try:
Expand Down
18 changes: 13 additions & 5 deletions .ci/s32k148_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,40 @@
import os
import sys


def run_cmd(cmd, cwd=None):
print(f"\n>>> Running: {cmd}", flush=True)
subprocess.run(cmd, shell=True, check=True, cwd=cwd)


def main():
target = "s32k148"
toolchain = "gcc"
cxxstd = "14"
matrix = [
{"app": "freertos", "preset": "s32k148-freertos-gcc"},
{"app": "threadx", "preset": "s32k148-threadx-gcc"},
{"app": "refApp_freertos", "preset": "s32k148-freertos-gcc"},
{"app": "refApp_threadx", "preset": "s32k148-threadx-gcc"},
{
"app": "intTestApp_freertos",
"preset": "integrationtest-s32k148-freertos-gcc",
},
]
for item in matrix:
preset = item["preset"]
run_cmd(f'python3 .ci/build.py --preset "{preset}" --platform "arm" --cxxid "{toolchain}" --cxxstd "{cxxstd}"')
run_cmd(
f'python3 .ci/build.py --preset "{preset}" --platform "arm" --cxxid "{toolchain}" --cxxstd "{cxxstd}"'
)

os.chdir("test/pyTest")

for item in matrix:
app = item["app"]
run_cmd(f'pytest -s --target={target} --no-restart --app={app}')
run_cmd(f"pytest -s --target={target} --no-restart --app={app}")


if __name__ == "__main__":
try:
main()
except subprocess.CalledProcessError as e:
print(f"\nERROR: command failed with exit code {e.returncode}")
sys.exit(e.returncode)

20 changes: 19 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
# max-parallel: 1
matrix:
preset: [ "tests-posix-debug", "tests-posix-release", "tests-s32k1xx-debug", "tests-s32k1xx-release", "posix-freertos", "posix-threadx", "posix-freertos-with-tracing", "posix-rust", "s32k148-freertos-gcc", "s32k148-threadx-gcc", "s32k148-freertos-clang", "s32k148-threadx-clang", "s32k148-rust-gcc" ]
preset: [ "tests-posix-debug", "tests-posix-release", "tests-s32k1xx-debug", "tests-s32k1xx-release", "posix-freertos", "posix-threadx", "posix-freertos-with-tracing", "posix-rust", "s32k148-freertos-gcc", "s32k148-threadx-gcc", "s32k148-freertos-clang", "s32k148-threadx-clang", "s32k148-rust-gcc" , "integrationtest-posix-freertos", "integrationtest-posix-threadx", "integrationtest-s32k148-freertos-gcc", "integrationtest-s32k148-threadx-gcc"]
platform: [ "arm", "linux" ]
config: [ "Debug", "Release", "RelWithDebInfo" ]
cxxid: ["gcc", "clang"]
Expand Down Expand Up @@ -80,6 +80,24 @@ jobs:
- preset: "s32k148-threadx-clang"
cxxid: "gcc"

- preset: "integrationtest-posix-freertos"
platform: "arm"
- preset: "integrationtest-posix-threadx"
platform: "arm"
- preset: "integrationtest-posix-freertos"
cxxid: "clang"
- preset: "integrationtest-posix-threadx"
cxxid: "clang"

- preset: "integrationtest-s32k148-freertos-gcc"
platform: "linux"
- preset: "integrationtest-s32k148-threadx-gcc"
platform: "linux"
- preset: "integrationtest-s32k148-freertos-gcc"
cxxid: "clang"
- preset: "integrationtest-s32k148-threadx-gcc"
cxxid: "clang"

steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
23 changes: 22 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,25 @@ set(BUILD_TARGET_RTOS

set(BUILD_EXECUTABLE
""
CACHE STRING "Which build to enable: referenceApp, unitTest")
CACHE STRING
"Which build to enable: referenceApp, unitTest, integrationTest")

if (BUILD_EXECUTABLE STREQUAL "referenceApp")
# no action for referenceApp build
elseif (BUILD_EXECUTABLE STREQUAL "unitTest")
add_compile_definitions(UNIT_TEST=1)
elseif (BUILD_EXECUTABLE STREQUAL "integrationTest")
add_compile_definitions(INTEGRATION_TEST=1)
endif ()

# Convert target name to lower case to match directory name
string(TOLOWER "${BUILD_TARGET_PLATFORM}" OPENBSW_TARGET)

if (BUILD_EXECUTABLE STREQUAL "referenceApp")
include(executables/referenceApp/platforms/${OPENBSW_TARGET}/Options.cmake)
elseif (BUILD_EXECUTABLE STREQUAL "integrationTest")
include(
executables/integrationTest/platforms/${OPENBSW_TARGET}/Options.cmake)
endif ()

# Configure async and Rtos libs depending on target rtos.
Expand Down Expand Up @@ -125,6 +131,16 @@ if (BUILD_EXECUTABLE STREQUAL "referenceApp")
endif ()
endif ()

if (BUILD_EXECUTABLE STREQUAL "integrationTest")
set(OPENBSW_APP_DIR "${CMAKE_CURRENT_LIST_DIR}/executables/integrationTest")
if (BUILD_TARGET_PLATFORM STREQUAL "S32K148EVB")
set(OPENBSW_PLATFORM_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/platforms/s32k1xx")
else ()
set(OPENBSW_PLATFORM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/platforms/posix")
endif ()
endif ()

if (BUILD_TRACING)
add_compile_definitions(TRACING=1)
if (TRACING_BUFFER_SIZE)
Expand Down Expand Up @@ -206,4 +222,9 @@ elseif (BUILD_EXECUTABLE STREQUAL "referenceApp")
target_include_directories(etl BEFORE
INTERFACE executables/referenceApp/etl_profile)
add_subdirectory(executables/referenceApp)
elseif (BUILD_EXECUTABLE STREQUAL "integrationTest")
target_include_directories(
etl BEFORE INTERFACE executables/integrationTest/etl_profile)
add_subdirectory(executables/integrationTest)

endif ()
86 changes: 86 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,68 @@
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-g3 -Os -DNDEBUG",
"CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "integrationtest-posix-freertos",
"displayName": "Integrationtest POSIX-FREERTOS compliant configuration",
"description": "Configure for POSIX-FREERTOS compliant environment",
"inherits": "_config-base",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_EXECUTABLE": "integrationTest",
"BUILD_TARGET_PLATFORM": "POSIX",
"BUILD_TARGET_RTOS": "FREERTOS"
}
},
{
"name": "integrationtest-posix-threadx",
"displayName": "Integrationtest POSIX-THREADX compliant configuration",
"description": "Configure for POSIX-THREADX compliant environment",
"inherits": "_config-base",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_EXECUTABLE": "integrationTest",
"BUILD_TARGET_PLATFORM": "POSIX",
"BUILD_TARGET_RTOS": "THREADX"
}
},
{
"name": "integrationtest-s32k148-freertos-gcc",
"generator": "Ninja Multi-Config",
"displayName": "Integrationtest S32K148-FREERTOS configuration (GCC)",
"description": "Configure Integrationtest for S32K148-FREERTOS platform using ARM GCC toolchain",
"inherits": "_config-base",
"toolchainFile": "${sourceDir}/cmake/toolchains/ArmNoneEabi-gcc.cmake",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_EXECUTABLE": "integrationTest",
"BUILD_TARGET_PLATFORM": "S32K148EVB",
"BUILD_TARGET_RTOS": "FREERTOS",
"CMAKE_ASM_FLAGS_RELWITHDEBINFO": "-g3",
"CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo;Debug;Release",
"CMAKE_C_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "integrationtest-s32k148-threadx-gcc",
"generator": "Ninja Multi-Config",
"displayName": "Integrationtest S32K148-THREADX configuration (GCC)",
"description": "Configure Integrationtest for S32K148-THREADX platform using ARM GCC toolchain",
"inherits": "_config-base",
"toolchainFile": "${sourceDir}/cmake/toolchains/ArmNoneEabi-gcc.cmake",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"BUILD_EXECUTABLE": "integrationTest",
"BUILD_TARGET_PLATFORM": "S32K148EVB",
"BUILD_TARGET_RTOS": "THREADX",
"CMAKE_ASM_FLAGS_RELWITHDEBINFO": "-g3",
"CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo;Debug;Release",
"CMAKE_C_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-g3 -O2 -DNDEBUG",
"CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -275,6 +337,30 @@
"displayName": "S32K148 ThreadX build (Clang)",
"description": "Build reference application for S32K148 platform with Clang (Release by default; for Debug use --config Debug)",
"configurePreset": "s32k148-threadx-clang"
},
{
"name": "integrationtest-posix-freertos",
"displayName": "build integration test for POSIX-FREERTOS",
"description": "Build integration test application for POSIX-compliant environment (Release by default; for Debug use --config Debug)",
"configurePreset": "integrationtest-posix-freertos"
},
{
"name": "integrationtest-posix-threadx",
"displayName": "build integration test for POSIX-THREADX",
"description": "Build integration test application for POSIX-compliant environment (Release by default; for Debug use --config Debug)",
"configurePreset": "integrationtest-posix-threadx"
},
{
"name": "integrationtest-s32k148-freertos-gcc",
"displayName": "Build integration test for S32K148-FREERTOS build (GCC)",
"description": "Build integrationtest application for S32K148 platform with GCC (Release by default; for Debug use --config Debug)",
"configurePreset": "integrationtest-s32k148-freertos-gcc"
},
{
"name": "integrationtest-s32k148-threadx-gcc",
"displayName": "Build integration test for S32K148-THREADX build (GCC)",
"description": "Build integrationtest application for S32K148 platform with GCC (Release by default; for Debug use --config Debug)",
"configurePreset": "integrationtest-s32k148-threadx-gcc"
}
],
"testPresets": [
Expand Down
25 changes: 25 additions & 0 deletions executables/integrationTest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Platform configuration should be inherited from parent CMakeLists.txt
if (NOT DEFINED OPENBSW_TARGET)
string(TOLOWER "${BUILD_TARGET_PLATFORM}" OPENBSW_TARGET)
endif ()

add_subdirectory(platforms/${OPENBSW_TARGET})

# Configure async and Rtos libs depending on target rtos.
if (BUILD_TARGET_RTOS STREQUAL "FREERTOS")
add_library(asyncPlatform ALIAS asyncFreeRtos)
add_library(osRtos ALIAS freeRtos)
add_library(asyncRtosImpl ALIAS asyncFreeRtosImpl)
elseif (BUILD_TARGET_RTOS STREQUAL "THREADX")
add_library(asyncPlatform ALIAS asyncThreadX)
add_library(osRtos ALIAS threadX)
add_library(asyncRtosImpl ALIAS asyncThreadXImpl)
endif ()

add_subdirectory(application)
add_subdirectory(asyncBinding)
add_subdirectory(asyncCoreConfiguration)
add_subdirectory(consoleCommands)

# Empty dummy lib for integration test
add_library(commonImpl INTERFACE)
8 changes: 8 additions & 0 deletions executables/integrationTest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Purpose

As the name suggest integrationTest app is specifically designed for the purpose
of integration test using pytest framework.

## Overview

This app has bare minimum functionalities of referenceApp, currently supports PWM pytests.
40 changes: 40 additions & 0 deletions executables/integrationTest/application/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
add_executable(
app.integrationTest
src/app/app.cpp
src/logger/logger.cpp
src/console/console.cpp
src/systems/RuntimeSystem.cpp
src/systems/SysAdminSystem.cpp
src/main.cpp)

target_include_directories(app.integrationTest PRIVATE include)

target_link_libraries(
app.integrationTest
PRIVATE asyncBinding
asyncConsole
bspMcu
etl
lifecycle
consoleCommands
logger
printf
loggerIntegration
main
stdioConsoleInput
osRtos
asyncRtosImpl
util
runtime
bspUart
socBsp)

set_target_properties(app.integrationTest PROPERTIES SUFFIX ".elf")

if (TARGET startUp)
get_target_property(LINKER_SCRIPT startUp PROP_LINKER_SCRIPT)

if (DEFINED LINKER_SCRIPT)
target_link_options(app.integrationTest PRIVATE -T ${LINKER_SCRIPT})
endif ()
endif ()
17 changes: 17 additions & 0 deletions executables/integrationTest/application/include/app/app.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2025 Accenture.

#pragma once

#include "lifecycle/StaticBsp.h"
#include <lifecycle/LifecycleManager.h>

namespace app
{
void run();
}

namespace platform
{
extern void platformLifecycleAdd(::lifecycle::LifecycleManager& lifecycleManager, uint8_t level);
extern StaticBsp& getStaticBsp();
} // namespace platform
13 changes: 13 additions & 0 deletions executables/integrationTest/application/include/console/console.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2025 Accenture.

#pragma once

namespace console
{
void enable();
void disable();

void init();
void run();

} // namespace console
Loading
Loading