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
68 changes: 68 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
cmake_minimum_required(VERSION 3.15)

project (TestApp C CXX)

set(PROJECT_DESCRIPTION "TestApp Software")

if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(TESTAPP_STANDALONE_BUILD TRUE)
else()
set(TESTAPP_STANDALONE_BUILD "")
endif()

set(RUNNING_UNITTESTS_WITH_EMULATOR OFF CACHE BOOL "is crosscompiled")

if("${CMAKE_PROJECT_NAME}" STREQUAL "TestApp")
if("${DEVICE_UNDER_TEST_ARCH}" STREQUAL "")
set(PROJECT_PLATFORM "")
set(DEVICE_UNDER_TEST_ARCH "")
endif()
endif()

# Setup Project configuration and pull dependencies
include(${PROJECT_SOURCE_DIR}/cmake/testAppSetupProject.cmake)
include(testAppPullDependencies)

# Enable download dependencies only in order to save resources by dowloading all toolchain depencies once
if(TESTAPP_DOWNLOAD_ONLY)
return()
endif()
if(TESTAPP_ENABLE_TESTS)
include(testAppAddTest)
endif()


if("${CMAKE_PROJECT_NAME}" STREQUAL "TestApp")
# Standalone build: for example tests that can be run on Target.
# Add integration test example to create 'IntegrationTests' Object library for tests to be referenced.
# when TestApp is built as submodule, 'IntegrationTests' library should be defined in the top project and extended within its context.
add_subdirectory(${PROJECT_SOURCE_DIR}/IntegrationTests)
endif()
add_subdirectory(${PROJECT_SOURCE_DIR}/Platform)
add_subdirectory(${PROJECT_SOURCE_DIR}/TestApp)
add_subdirectory(${PROJECT_SOURCE_DIR}/OSAdapter/src/Observer)
add_subdirectory(${PROJECT_SOURCE_DIR}/OSAdapter/src/OsAbstraction)
add_subdirectory(${PROJECT_SOURCE_DIR}/OSAdapter/src/OsExtension)

if(DEVICE_UNDER_TEST_ARCH STREQUAL "ARM")
message(STATUS "DEVICE_UNDER_TEST_ARCH ${DEVICE_UNDER_TEST_ARCH}")
else()
message(STATUS "DEVICE_UNDER_TEST_ARCH '${DEVICE_UNDER_TEST_ARCH}' is not defined")
endif()

message(STATUS "RUNNING_UNITTESTS_WITH_EMULATOR ${RUNNING_UNITTESTS_WITH_EMULATOR}")
message(STATUS "APP_OSADAPTER ${APP_OSADAPTER}")
message(STATUS "TESTAPP_ENABLE_TESTS ${TESTAPP_ENABLE_TESTS}")
message(STATUS "TESTAPP_ENABLE_MOCKS ${TESTAPP_ENABLE_MOCKS}")
message(STATUS "TESTAPP_STANDALONE_BUILD ${TESTAPP_STANDALONE_BUILD}")
message(STATUS "MCU ${MCU}")

# Add TestApp unit tests
if(TESTAPP_ENABLE_TESTS)
add_subdirectory(TestApp/test)
endif()

# Add TestApp mocks
if(TESTAPP_ENABLE_MOCKS)
add_subdirectory(TestApp/mock)
endif()
29 changes: 29 additions & 0 deletions IntegrationTests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# In order to define new integration test object library within top project:
# You need to creates an Object Library which compiles source files but does not archive or link their object files into a library.
# Instead other targets created by add_library() such as TestApp in our case will reference the objects.

add_subdirectory(DemoApplication)

# 1. Add integration tests to object library to be referenced by TestApp
add_library(IntegrationTests OBJECT
${CMAKE_CURRENT_SOURCE_DIR}/test_suite/testSuite1.cpp
)

# 2. Add includes for test dependencies...
target_include_directories(IntegrationTests
PUBLIC
)

# 3. Specify c++ compile features used in the integartion tests
target_compile_features(IntegrationTests
PUBLIC
cxx_std_14
)

# 4. Add test dependencies...
target_link_libraries(IntegrationTests
PUBLIC
Demoapplication
TestApp-Interface
TestEnvironment
)
112 changes: 112 additions & 0 deletions IntegrationTests/DemoApplication/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Interface used to write the test
add_library(DemoappTypes
INTERFACE
)

target_include_directories(DemoappTypes
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include/DemoappTypes
)

target_link_libraries(DemoappTypes
INTERFACE
etl
)

add_library(Tier1competetion
${CMAKE_CURRENT_SOURCE_DIR}/src/Tier1competetion/Tier1competetion.cpp
)
target_include_directories(Tier1competetion
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include/Tier1competetion
)
# Specify c++ compile features used in the Tier1competetion
target_compile_features(Tier1competetion
PUBLIC
cxx_std_14
)
# Tier1competetion dependencies
target_link_libraries(Tier1competetion
PUBLIC
DemoappTypes
OsExtension
etl
)

add_library(Dashboard
${CMAKE_CURRENT_SOURCE_DIR}/src/Dashboard/Dashboard.cpp
)
target_include_directories(Dashboard
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include/Dashboard
)
# Specify c++ compile features used in the Dashboard
target_compile_features(Dashboard
PUBLIC
cxx_std_14
)
# Dashboard dependencies
target_link_libraries(Dashboard
PUBLIC
DemoappTypes
OsExtension
etl
)

add_library(Tier2competetion
${CMAKE_CURRENT_SOURCE_DIR}/src/Tier2competetion/Tier2competetion.cpp
)
target_include_directories(Tier2competetion
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include/Tier2competetion
)
# Specify c++ compile features used in the Dashboard
target_compile_features(Tier2competetion
PUBLIC
cxx_std_14
)
# Tier2competetion dependencies
target_link_libraries(Tier2competetion
PUBLIC
DemoappTypes
OsExtension
etl
)

if(DEVICE_UNDER_TEST_ARCH MATCHES "PPC|ARM" AND NOT RUNNING_UNITTESTS_WITH_EMULATOR)
# TestApp Library (to link within the tests and target platform)
add_library(Demoapplication
${CMAKE_CURRENT_SOURCE_DIR}/src/Dashboard/Task.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Dashboard/Dashboard.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Tier1competetion/Task.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Tier1competetion/Tier1competetion.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Tier2competetion/Task.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/Tier2competetion/Tier2competetion.cpp
)

target_include_directories(Demoapplication
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include/DemoappTypes
${CMAKE_CURRENT_SOURCE_DIR}/include/Dashboard
${CMAKE_CURRENT_SOURCE_DIR}/include/Tier1competetion
${CMAKE_CURRENT_SOURCE_DIR}/include/Tier2competetion
${PROJECT_SOURCE_DIR}/Platform/RequiredInterface/TestAppRtosInterface
${PROJECT_SOURCE_DIR}/Platform/RequiredInterface/CommunicationChannelInterface
)

# Specify c++ compile features used in the TestApp
target_compile_features(Demoapplication
PUBLIC
cxx_std_14
)

# TestApp dependencies
target_link_libraries(Demoapplication
PUBLIC
TestAppRtos
etl
)

endif()


8 changes: 8 additions & 0 deletions IntegrationTests/DemoApplication/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# IntegrationTests

The tests defined here maps to either
## test_suite_fdx_lauterbach : https://github.com/eclipse/kiso-testing/blob/master/examples/fdx_lauterbach.yaml or

## test_suite_rtt : https://github.com/eclipse/kiso-testing/blob/master/examples/j_link_rtt_segger.yaml

regarding on which tests (channel in use) that were invoked from host side.
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**
* @file include/Dashboard/Dashboard/Dashboard.hpp
*
* @copyright Copyright 2023 Robert Bosch GmbH.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
*/

#ifndef DASHBOARD_DASHBOARD_HPP
#define DASHBOARD_DASHBOARD_HPP

#include <OsExtension/MessageBuffer.hpp>

namespace dashboard {

class Dashboard {
public:
/// Constructor.
Dashboard() = default;

/// Default destructor
~Dashboard() = default;

/// Copy constructor.
Dashboard(Dashboard const&) = delete;

/// Move constructor.
Dashboard(Dashboard&&) = delete;

/// @brief Copy assignment operator.
/// @return result of copy assignment
Dashboard& operator=(Dashboard const&) = delete;

/// @brief Move assignment operator.
/// @return result of move assignment
Dashboard& operator=(Dashboard&&) = delete;


/**
* @brief one cycle Method to be run by TestRuner task
*/
void oneCycle(QueueSetMemberHandle_t& queueSetMemberHandle);

/**
* @brief set _dashboardToTier2competetionMessageBuffer Reference
*/
void setDashboardToTier2competetionMessageBufferReference(osextension::MessageBufferReference& mbf);

/**
* @brief set _tier2competetionToDashboardMessageBuffer Reference
*/
void setTier2competetionToDashboardMessageBufferReference(osextension::MessageBufferReference& mbf);

/**
* @brief set _dashboardToTier1competetionMessageBuffer Reference
*/
void setDashboardToTier1competetionMessageBufferReference(osextension::MessageBufferReference& mbf);

/**
* @brief set _tier1competetionToDashboardMessageBuffer Reference
*/
void setTier1competetionToDashboardMessageBufferReference(osextension::MessageBufferReference& mbf);

/**
* @brief set dashboard queue set handle
*/
void setDashboardQueueSetHandle(QueueSetHandle_t queueSetHandle);

/**
* @brief get dashboard queue set handle
*/
QueueSetHandle_t getDashboardQueueSetHandle() const;

private:
/// Message Buffer reference for incoming messages from Tier1competetion
osextension::MessageBufferReference* _tier1competetionToDashboardMessageBufferReference = nullptr;

/// Message Buffer reference for incoming messages from Tier2competetion
osextension::MessageBufferReference* _tier2competetionToDashboardMessageBufferReference = nullptr;

/// Outgoing Message Buffer reference to the Tier1competetion
osextension::MessageBufferReference* _dashboardToTier1competetionMessageBufferReference = nullptr;

/// Outgoing Message Buffer reference to the Tier2competetion
osextension::MessageBufferReference* _dashboardToTier2competetionMessageBufferReference = nullptr;

/// FreeRTOS queue set handle
QueueSetHandle_t _queueSetHandle = nullptr;
};

} // namespace dashboard

#endif // DASHBOARD_DASHBOARD_HPP
Loading