Added Unittests #103

Merged
meierj merged 18 commits from mueller/added-unittests into develop 2021-10-07 17:22:24 +02:00
13 changed files with 142 additions and 16 deletions
Showing only changes of commit f61d0e83f0 - Show all commits

View File

@ -35,16 +35,16 @@ endif()
include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake)
pre_project_config()
if(TGT_BSP MATCHES "arm/q7s")
if(EIVE_BUILD_WATCHDOG)
set(PROJECT_NAME_TO_SET eive-watchdog)
elseif(EIVE_BUILD_UNITTESTS)
set(PROJECT_NAME_TO_SET eive-unittest)
elseif(TGT_BSP MATCHES "arm/q7s")
set(PROJECT_NAME_TO_SET eive-obsw-$ENV{USERNAME})
else()
set(PROJECT_NAME_TO_SET eive-obsw)
endif()
if(EIVE_BUILD_WATCHDOG)
set(PROJECT_NAME_TO_SET eive-watchdog)
endif()
# Project Name
project(${PROJECT_NAME_TO_SET} ASM C CXX)
@ -77,6 +77,7 @@ set(LINUX_PATH linux)
set(COMMON_PATH common)
set(WATCHDOG_PATH watchdog)
set(COMMON_CONFIG_PATH ${COMMON_PATH}/config)
set(UNITTEST_CFG_PATH ${UNITTEST_PATH}/testcfg)
set(LIB_CSP_PATH ${THIRD_PARTY_FOLDER}/libcsp)
set(LIB_ETL_PATH ${THIRD_PARTY_FOLDER}/etl)
@ -88,6 +89,10 @@ set(LIB_JSON_PATH ${THIRD_PARTY_FOLDER}/json)
set(FSFW_WARNING_SHADOW_LOCAL_GCC OFF)
set(EIVE_ADD_LINUX_FILES False)
if(EIVE_BUILD_UNITTESTS)
option(FSFW_ADD_UNITTESTS "Build the FSFW unittests as well" ON)
endif()
if(FSFW_CUSTOM_UNITTEST_RUNNER OR FSFW_ADD_UNITTESTS)
set(CATCH2_TARGET Catch2)
else()
@ -131,6 +136,11 @@ else()
set(FSFW_CONFIG_PATH "${BSP_PATH}/fsfwconfig")
endif()
if(EIVE_BUILD_UNITTESTS)
configure_file(${UNITTEST_CFG_PATH}/TestsConfig.h.in TestsConfig.h)
set(FSFW_CONFIG_PATH ${UNITTEST_CFG_PATH})
endif()
# Configuration files
if(NOT EIVE_BUILD_WATCHDOG)
configure_file(${COMMON_CONFIG_PATH}/commonConfig.h.in commonConfig.h)
@ -142,6 +152,9 @@ if(NOT EIVE_BUILD_WATCHDOG)
configure_file(${BSP_PATH}/boardconfig/rpiConfig.h.in rpiConfig.h)
endif()
endif()
configure_file(${WATCHDOG_PATH}/watchdogConf.h.in watchdogConf.h)
# Set common config path for FSFW
@ -166,14 +179,16 @@ if(EIVE_ADD_JSON_LIB)
endif()
if(NOT EIVE_BUILD_WATCHDOG)
if(EIVE_ADD_LINUX_FILES)
add_subdirectory(${LINUX_PATH})
if(NOT EIVE_BUILD_UNITTESTS)
if(EIVE_ADD_LINUX_FILES)
add_subdirectory(${LINUX_PATH})
endif()
add_subdirectory(${BSP_PATH})
if(ADD_CSP_LIB)
add_subdirectory(${LIB_CSP_PATH})
endif()
endif()
add_subdirectory(${BSP_PATH})
add_subdirectory(${COMMON_PATH})
if(ADD_CSP_LIB)
add_subdirectory(${LIB_CSP_PATH})
endif()
endif()
if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
@ -184,7 +199,8 @@ if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
add_subdirectory(${LIB_ARCSEC_PATH})
endif()
if(EIVE_BUILD_UNITTEST)
if(EIVE_BUILD_UNITTESTS)
add_subdirectory(${LIB_CATCH2_PATH})
add_subdirectory(${UNITTEST_PATH})
endif()
@ -234,7 +250,7 @@ if(EIVE_ADD_JSON_LIB)
)
endif()
if(EIVE_BUILD_UNITTEST)
if(EIVE_BUILD_UNITTESTS)
target_link_libraries(${TARGET_NAME} PRIVATE
${CATCH2_TARGET}
)

View File

@ -0,0 +1,60 @@
#ifndef FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#define FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_
#include "OBSWConfig.h"
#include <cstdint>
namespace pcduSwitches {
/* Switches are uint8_t datatype and go from 0 to 255 */
enum SwitcherList: uint8_t {
Q7S,
PAYLOAD_PCDU_CH1,
RW,
TCS_BOARD_8V_HEATER_IN,
SUS_REDUNDANT,
DEPLOYMENT_MECHANISM,
PAYLOAD_PCDU_CH6,
ACS_BOARD_SIDE_B,
PAYLOAD_CAMERA,
TCS_BOARD_3V3,
SYRLINKS,
STAR_TRACKER,
MGT,
SUS_NOMINAL,
SOLAR_CELL_EXP,
PLOC,
ACS_BOARD_SIDE_A,
NUMBER_OF_SWITCHES
};
static const uint8_t ON = 1;
static const uint8_t OFF = 0;
/* Output states after reboot of the PDUs */
static const uint8_t INIT_STATE_Q7S = ON;
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH1 = OFF;
static const uint8_t INIT_STATE_RW = OFF;
#if BOARD_TE0720 == 1
/* Because the TE0720 is not connected to the PCDU, this switch is always on */
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = ON;
#else
static const uint8_t INIT_STATE_TCS_BOARD_8V_HEATER_IN = OFF;
#endif
static const uint8_t INIT_STATE_SUS_REDUNDANT = OFF;
static const uint8_t INIT_STATE_DEPLOYMENT_MECHANISM = OFF;
static const uint8_t INIT_STATE_PAYLOAD_PCDU_CH6 = OFF;
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_B = OFF;
static const uint8_t INIT_STATE_PAYLOAD_CAMERA = OFF;
static const uint8_t INIT_STATE_TCS_BOARD_3V3 = OFF;
static const uint8_t INIT_STATE_SYRLINKS = OFF;
static const uint8_t INIT_STATE_STAR_TRACKER = OFF;
static const uint8_t INIT_STATE_MGT = OFF;
static const uint8_t INIT_STATE_SUS_NOMINAL = OFF;
static const uint8_t INIT_STATE_SOLAR_CELL_EXP = OFF;
static const uint8_t INIT_STATE_PLOC = OFF;
static const uint8_t INIT_STATE_ACS_BOARD_SIDE_A = OFF;
}
#endif /* FSFWCONFIG_DEVICES_POWERSWITCHERLIST_H_ */

2
fsfw

@ -1 +1 @@
Subproject commit 354e158cc196d7deaf7de24ebcc96f5f6f5f20eb
Subproject commit 04cb8e82f1aaae89e20985539c74c1e36bb85ae3

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build-Debug-Host/eive-obsw"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="eive-obsw"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.toolchain.gnu.mingw.base.1455833186.1840876443.466368954"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eive-obsw"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@ -4,6 +4,7 @@
#include <tmtc/apid.h>
#include <tmtc/pusIds.h>
#include "objects/systemObjectList.h"
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>

View File

@ -1 +1,5 @@
add_subdirectory(testcfg)
target_sources(${TARGET_NAME} PRIVATE
main.cpp
)

6
unittest/main.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "fsfw_tests/unit/CatchRunner.h"
int main(int argc, char* argv[]) {
fsfwtest::customMain(argc, argv);
}

View File

@ -7,7 +7,7 @@
//! Used to determine whether C++ ostreams are used which can increase
//! the binary size significantly. If this is disabled,
//! the C stdio functions can be used alternatively
#define FSFW_CPP_OSTREAM_ENABLED 0
#define FSFW_CPP_OSTREAM_ENABLED 1
//! More FSFW related printouts. Useful for development.
#define FSFW_ENHANCED_PRINTOUT 0
@ -20,6 +20,9 @@
#endif
#endif
#define FSFW_USE_PUS_C_TELEMETRY 1
#define FSFW_USE_PUS_C_TELECOMMANDS 1
//! Can be used to enable additional debugging printouts for developing the FSFW
#define FSFW_PRINT_VERBOSITY_LEVEL 0

View File

@ -2,6 +2,7 @@
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
#include <cstdint>
#include "commonSubsystemIds.h"
#include <fsfw/events/fwSubsystemIdRanges.h>
/**

View File

@ -2,6 +2,7 @@
#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
#include <cstdint>
#include "commonObjects.h"
#include <fsfw/objectmanager/frameworkObjects.h>
// The objects will be instantiated in the ID order

View File

@ -1,6 +1,7 @@
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
#define CONFIG_RETURNVALUES_CLASSIDS_H_
#include "commonClassIds.h"
#include <fsfw/returnvalues/FwClassIds.h>
/**

View File

@ -11,7 +11,7 @@
* Chose APID(s) for mission and define it here.
*/
namespace apid {
static const uint16_t DEFAULT_APID = 0x00;
static const uint16_t EIVE_OBSW = 0x65;
}