new test folder
This commit is contained in:
parent
4803fb2cbd
commit
82299c7e3e
@ -10,6 +10,7 @@ endif()
|
|||||||
|
|
||||||
option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)
|
option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)
|
||||||
# Options to exclude parts of the FSFW from compilation.
|
# Options to exclude parts of the FSFW from compilation.
|
||||||
|
option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON)
|
||||||
option(FSFW_USE_RMAP "Compile with RMAP" ON)
|
option(FSFW_USE_RMAP "Compile with RMAP" ON)
|
||||||
option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON)
|
option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON)
|
||||||
|
|
||||||
@ -48,22 +49,22 @@ if(NOT FSFW_OSAL)
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(FSFW_OSAL_DEFINITION FSFW_HOST)
|
set(FSFW_OSAL_DEFINITION FSFW_OSAL_HOST)
|
||||||
|
|
||||||
if(FSFW_OSAL MATCHES host)
|
if(FSFW_OSAL MATCHES host)
|
||||||
set(OS_FSFW_NAME "Host")
|
set(OS_FSFW_NAME "Host")
|
||||||
elseif(FSFW_OSAL MATCHES linux)
|
elseif(FSFW_OSAL MATCHES linux)
|
||||||
set(OS_FSFW_NAME "Linux")
|
set(OS_FSFW_NAME "Linux")
|
||||||
set(FSFW_OSAL_DEFINITION FSFW_LINUX)
|
set(FSFW_OSAL_DEFINITION FSFW_OSAL_LINUX)
|
||||||
elseif(FSFW_OSAL MATCHES freertos)
|
elseif(FSFW_OSAL MATCHES freertos)
|
||||||
set(OS_FSFW_NAME "FreeRTOS")
|
set(OS_FSFW_NAME "FreeRTOS")
|
||||||
set(FSFW_OSAL_DEFINITION FSFW_FREERTOS)
|
set(FSFW_OSAL_DEFINITION FSFW_OSAL_FREERTOS)
|
||||||
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
||||||
${LIB_OS_NAME}
|
${LIB_OS_NAME}
|
||||||
)
|
)
|
||||||
elseif(FSFW_OSAL STREQUAL rtems)
|
elseif(FSFW_OSAL STREQUAL rtems)
|
||||||
set(OS_FSFW_NAME "RTEMS")
|
set(OS_FSFW_NAME "RTEMS")
|
||||||
set(FSFW_OSAL_DEFINITION FSFW_RTEMS)
|
set(FSFW_OSAL_DEFINITION FSFW_OSAL_RTEMS)
|
||||||
else()
|
else()
|
||||||
message(WARNING
|
message(WARNING
|
||||||
"Invalid operating system for FSFW specified! Setting to host.."
|
"Invalid operating system for FSFW specified! Setting to host.."
|
||||||
@ -83,6 +84,7 @@ target_compile_definitions(${LIB_FSFW_NAME} INTERFACE
|
|||||||
message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.")
|
message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.")
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it.
|
# The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it.
|
||||||
# If this is not given, we include the default configuration and emit a warning.
|
# If this is not given, we include the default configuration and emit a warning.
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(opt)
|
add_subdirectory(opt)
|
||||||
add_subdirectory(osal)
|
add_subdirectory(osal)
|
||||||
# add_subdirectory(tests)
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
add_subdirectory(internal)
|
|
||||||
|
|
||||||
if(LINK_CATCH2)
|
|
||||||
add_subdirectory(tests)
|
|
||||||
endif()
|
|
@ -1,4 +0,0 @@
|
|||||||
CXXSRC += $(wildcard $(CURRENTPATH)/osal/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/serialize/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/globalfunctions/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp)
|
|
@ -1,3 +0,0 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
|
||||||
IntTestSerialization.cpp
|
|
||||||
)
|
|
@ -1,3 +0,0 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
|
||||||
TestArrayPrinter.cpp
|
|
||||||
)
|
|
@ -1,8 +0,0 @@
|
|||||||
CXXSRC += $(wildcard $(CURRENTPATH)/container/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/action/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/serialize/*.cpp)
|
|
||||||
CXXSRC += $(wildcard $(CURRENTPATH)/storagemanager/*.cpp)
|
|
||||||
|
|
||||||
# OSAL not included for now.
|
|
||||||
|
|
||||||
INCLUDES += $(CURRENTPATH)
|
|
@ -1,34 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Run this script to unlock all permissions to run the linux binaries
|
|
||||||
# and create threads
|
|
||||||
|
|
||||||
binaries=$(find $directory -type f -name "*.elf")
|
|
||||||
|
|
||||||
echo Unlocking real time permissions for binaries and bash console...
|
|
||||||
|
|
||||||
# Set up the soft realtime limit to maximum (99)
|
|
||||||
# Please note that the hard limit needs to be set to 99 too
|
|
||||||
# for this to work (check with ulimit -Hr).
|
|
||||||
# If that has not been done yet, add
|
|
||||||
# <username> hard rtprio 99
|
|
||||||
# to /etc/security/limits.conf
|
|
||||||
# It is also necessary and recommended to add
|
|
||||||
# <username> soft rtprio 99
|
|
||||||
# as well. This can also be done in the command line
|
|
||||||
# but would need to be done for each session.
|
|
||||||
ulimit -Sr 99
|
|
||||||
|
|
||||||
for binary in ${binaries}; do
|
|
||||||
sudo setcap 'cap_sys_nice=eip' ${binary}
|
|
||||||
result=$?
|
|
||||||
if [ ${result} = 0 ];then
|
|
||||||
echo ${binary} was unlocked
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# sudo setcap 'cap_sys_nice=eip' /bin/bash
|
|
||||||
# result=$?
|
|
||||||
# if [ ${result} = 0 ];then
|
|
||||||
# echo /bin/bash was unlocked
|
|
||||||
# fi
|
|
||||||
|
|
2
tests/CMakeLists.txt
Normal file
2
tests/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(inc)
|
3
tests/inc/CMakeLists.txt
Normal file
3
tests/inc/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
target_include_directories(${LIB_FSFW_NAME} PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
@ -2,7 +2,7 @@
|
|||||||
#define FRAMEWORK_TEST_UNITTESTCLASS_H_
|
#define FRAMEWORK_TEST_UNITTESTCLASS_H_
|
||||||
|
|
||||||
#include "UnittDefinitions.h"
|
#include "UnittDefinitions.h"
|
||||||
#include "../../returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,7 +17,7 @@
|
|||||||
class InternalUnitTester: public HasReturnvaluesIF {
|
class InternalUnitTester: public HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
struct TestConfig {
|
struct TestConfig {
|
||||||
bool testArrayPrinter;
|
bool testArrayPrinter = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
InternalUnitTester();
|
InternalUnitTester();
|
||||||
@ -27,7 +27,7 @@ public:
|
|||||||
* Some function which calls all other tests
|
* Some function which calls all other tests
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t performTests(struct InternalUnitTester::TestConfig& testConfig);
|
virtual ReturnValue_t performTests(const struct InternalUnitTester::TestConfig& testConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
|||||||
#ifndef UNITTEST_INTERNAL_UNITTDEFINITIONS_H_
|
#ifndef UNITTEST_INTERNAL_UNITTDEFINITIONS_H_
|
||||||
#define UNITTEST_INTERNAL_UNITTDEFINITIONS_H_
|
#define UNITTEST_INTERNAL_UNITTDEFINITIONS_H_
|
||||||
|
|
||||||
#include "../../returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "../../serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_
|
#ifndef FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_
|
||||||
#define FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_
|
#define FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_
|
||||||
|
|
||||||
#include "../../../returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
namespace testserialize {
|
namespace testserialize {
|
7
tests/src/CMakeLists.txt
Normal file
7
tests/src/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
if(FSFW_ADD_INTERNAL_TESTS)
|
||||||
|
add_subdirectory(internal)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(FSFW_ADD_UNITTESTS)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${LIB_FSFW_NAME} PRIVATE
|
||||||
InternalUnitTester.cpp
|
InternalUnitTester.cpp
|
||||||
UnittDefinitions.cpp
|
UnittDefinitions.cpp
|
||||||
)
|
)
|
@ -1,11 +1,11 @@
|
|||||||
#include "InternalUnitTester.h"
|
#include "fsfw/tests/internal/InternalUnitTester.h"
|
||||||
#include "UnittDefinitions.h"
|
#include "fsfw/tests/internal/UnittDefinitions.h"
|
||||||
|
|
||||||
#include "osal/IntTestMq.h"
|
#include "fsfw/tests/internal/osal/IntTestMq.h"
|
||||||
#include "osal/IntTestSemaphore.h"
|
#include "fsfw/tests/internal/osal/IntTestSemaphore.h"
|
||||||
#include "osal/IntTestMutex.h"
|
#include "fsfw/tests/internal/osal/IntTestMutex.h"
|
||||||
#include "serialize/IntTestSerialization.h"
|
#include "fsfw/tests/internal/serialize/IntTestSerialization.h"
|
||||||
#include "globalfunctions/TestArrayPrinter.h"
|
#include "fsfw/tests/internal/globalfunctions/TestArrayPrinter.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
@ -13,7 +13,8 @@ InternalUnitTester::InternalUnitTester() {}
|
|||||||
|
|
||||||
InternalUnitTester::~InternalUnitTester() {}
|
InternalUnitTester::~InternalUnitTester() {}
|
||||||
|
|
||||||
ReturnValue_t InternalUnitTester::performTests(struct InternalUnitTester::TestConfig& testConfig) {
|
ReturnValue_t InternalUnitTester::performTests(
|
||||||
|
const struct InternalUnitTester::TestConfig& testConfig) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::info << "Running internal unit tests.." << std::endl;
|
sif::info << "Running internal unit tests.." << std::endl;
|
||||||
#else
|
#else
|
@ -1,4 +1,4 @@
|
|||||||
#include "UnittDefinitions.h"
|
#include "fsfw/tests/internal/UnittDefinitions.h"
|
||||||
|
|
||||||
ReturnValue_t unitt::put_error(std::string errorId) {
|
ReturnValue_t unitt::put_error(std::string errorId) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
3
tests/src/internal/globalfunctions/CMakeLists.txt
Normal file
3
tests/src/internal/globalfunctions/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
target_sources(${LIB_FSFW_NAME} PRIVATE
|
||||||
|
TestArrayPrinter.cpp
|
||||||
|
)
|
@ -1,4 +1,4 @@
|
|||||||
#include "TestArrayPrinter.h"
|
#include "fsfw/tests/internal/globalfunctions/TestArrayPrinter.h"
|
||||||
|
|
||||||
void arrayprinter::testArrayPrinter() {
|
void arrayprinter::testArrayPrinter() {
|
||||||
{
|
{
|
@ -1,4 +1,4 @@
|
|||||||
target_sources(${TARGET_NAME} PRIVATE
|
target_sources(${LIB_FSFW_NAME} PRIVATE
|
||||||
IntTestMq.cpp
|
IntTestMq.cpp
|
||||||
IntTestMutex.cpp
|
IntTestMutex.cpp
|
||||||
IntTestSemaphore.cpp
|
IntTestSemaphore.cpp
|
@ -1,5 +1,5 @@
|
|||||||
#include "IntTestMq.h"
|
#include "fsfw/tests/internal/osal/IntTestMq.h"
|
||||||
#include <fsfw/unittest/internal/UnittDefinitions.h>
|
#include "fsfw/tests/internal/UnittDefinitions.h"
|
||||||
|
|
||||||
#include <fsfw/ipc/MessageQueueIF.h>
|
#include <fsfw/ipc/MessageQueueIF.h>
|
||||||
#include <fsfw/ipc/QueueFactory.h>
|
#include <fsfw/ipc/QueueFactory.h>
|
||||||
@ -49,5 +49,4 @@ void testmq::testMq() {
|
|||||||
if(senderId != testSenderMqId) {
|
if(senderId != testSenderMqId) {
|
||||||
unitt::put_error(id);
|
unitt::put_error(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
#include "IntTestMutex.h"
|
#include "fsfw/tests/internal/osal/IntTestMutex.h"
|
||||||
|
#include "fsfw/tests/internal/UnittDefinitions.h"
|
||||||
|
|
||||||
#include <fsfw/ipc/MutexFactory.h>
|
#include <fsfw/ipc/MutexFactory.h>
|
||||||
#include <fsfw/unittest/internal/UnittDefinitions.h>
|
|
||||||
|
|
||||||
#if defined(WIN32) || defined(UNIX)
|
#if defined(WIN32) || defined(UNIX)
|
||||||
#include <fsfw/osal/host/Mutex.h>
|
#include <fsfw/osal/host/Mutex.h>
|
@ -1,8 +1,8 @@
|
|||||||
#include "IntTestSemaphore.h"
|
#include "fsfw/tests/internal/osal/IntTestSemaphore.h"
|
||||||
#include <fsfw/unittest/internal/UnittDefinitions.h>
|
#include "fsfw/tests/internal/UnittDefinitions.h"
|
||||||
|
|
||||||
#include <fsfw/tasks/SemaphoreFactory.h>
|
#include <fsfw/tasks/SemaphoreFactory.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <fsfw/timemanager/Stopwatch.h>
|
#include <fsfw/timemanager/Stopwatch.h>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
3
tests/src/internal/serialize/CMakeLists.txt
Normal file
3
tests/src/internal/serialize/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
target_sources(${LIB_FSFW_NAME} PRIVATE
|
||||||
|
IntTestSerialization.cpp
|
||||||
|
)
|
@ -1,5 +1,5 @@
|
|||||||
#include "IntTestSerialization.h"
|
#include "fsfw/tests/internal/serialize/IntTestSerialization.h"
|
||||||
#include <fsfw/unittest/internal/UnittDefinitions.h>
|
#include "fsfw/tests/internal/UnittDefinitions.h"
|
||||||
|
|
||||||
#include <fsfw/serialize/SerializeElement.h>
|
#include <fsfw/serialize/SerializeElement.h>
|
||||||
#include <fsfw/serialize/SerialBufferAdapter.h>
|
#include <fsfw/serialize/SerialBufferAdapter.h>
|
@ -4,4 +4,3 @@ add_subdirectory(osal)
|
|||||||
add_subdirectory(serialize)
|
add_subdirectory(serialize)
|
||||||
add_subdirectory(datapoollocal)
|
add_subdirectory(datapoollocal)
|
||||||
add_subdirectory(storagemanager)
|
add_subdirectory(storagemanager)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user