59 #include "Mockfram_cfg.h"
61 #include "Mocksys_mon_cfg.h"
71 #define DUMMY_TASK_ID_0 (0)
72 #define DUMMY_TASK_ID_1 (1)
73 #define DUMMY_TASK_ID_2 (2)
74 #define DUMMY_CYCLE_TIME (10)
75 #define DUMMY_MAX_JITTER (1)
155 OS_GetTickCount_ExpectAndReturn(0u);
161 OS_GetTickCount_ExpectAndReturn(0u);
164 OS_GetTickCount_ExpectAndReturn(100u);
169 OS_EnterTaskCritical_Ignore();
170 OS_ExitTaskCritical_Ignore();
173 OS_GetTickCount_ExpectAndReturn(0u);
181 OS_GetTickCount_ExpectAndReturn(100u);
182 DIAG_Handler_ExpectAndReturn(
189 OS_EnterTaskCritical_Ignore();
190 OS_ExitTaskCritical_Ignore();
193 OS_GetTickCount_ExpectAndReturn(0u);
201 OS_GetTickCount_ExpectAndReturn(100u);
202 DIAG_Handler_ExpectAndReturn(
216 TEST_ASSERT_NOT_EQUAL(424242, notifications[
SYSM_TASK_ID_MAX + 1u].timestampEnter);
221 OS_EnterTaskCritical_Expect();
222 OS_ExitTaskCritical_Expect();
225 TEST_ASSERT_EQUAL(UINT32_MAX, notifications[
DUMMY_TASK_ID_0].timestampEnter);
227 OS_EnterTaskCritical_Expect();
228 OS_ExitTaskCritical_Expect();
236 OS_EnterTaskCritical_Expect();
237 OS_ExitTaskCritical_Expect();
240 TEST_ASSERT_EQUAL(UINT32_MAX, notifications[
DUMMY_TASK_ID_0].timestampEnter);
242 const uint32_t exitTime = 100;
243 OS_EnterTaskCritical_Expect();
244 OS_ExitTaskCritical_Expect();
247 TEST_ASSERT_EQUAL(exitTime, notifications[
DUMMY_TASK_ID_0].timestampExit);
249 TEST_ASSERT_EQUAL(exitTime + 1, notifications[
DUMMY_TASK_ID_0].duration);
254 OS_EnterTaskCritical_Ignore();
259 TEST_ASSERT_NOT_EQUAL(UINT32_MAX, notifications[
DUMMY_TASK_ID_0].timestampEnter);
260 TEST_ASSERT_NOT_EQUAL(UINT32_MAX, notifications[
DUMMY_TASK_ID_0].timestampExit);
265 OS_EnterTaskCritical_Ignore();
266 OS_ExitTaskCritical_Ignore();
301 .task100msAlgorithmEnterTimestamp = 1,
302 .task100msAlgorithmViolatingDuration = 2,
303 .task100msEnterTimestamp = 3,
304 .task100msViolatingDuration = 4,
305 .task10msEnterTimestamp = 5,
306 .task10msViolatingDuration = 6,
307 .task1msEnterTimestamp = 7,
308 .task1msViolatingDuration = 8,
309 .taskEngineEnterTimestamp = 9,
310 .taskEngineViolatingDuration = 10,
314 .task100msAlgorithmEnterTimestamp = 0,
315 .task100msAlgorithmViolatingDuration = 0,
316 .task100msEnterTimestamp = 0,
317 .task100msViolatingDuration = 0,
318 .task10msEnterTimestamp = 0,
319 .task10msViolatingDuration = 0,
320 .task1msEnterTimestamp = 0,
321 .task1msViolatingDuration = 0,
322 .taskEngineEnterTimestamp = 0,
323 .taskEngineViolatingDuration = 0,
@ DIAG_ID_SYSTEM_MONITORING
Assert macro implementation.
@ FRAM_BLOCK_ID_SYS_MON_RECORD
#define NULL_PTR
Null pointer.
struct that stores for each task the last violation of timing
uint32_t taskEngineViolatingDuration
uint32_t taskEngineEnterTimestamp
bool anyTimingIssueOccurred
uint32_t task10msViolatingDuration
uint32_t task100msViolatingDuration
uint32_t task100msEnterTimestamp
uint32_t task1msViolatingDuration
uint32_t task100msAlgorithmEnterTimestamp
uint32_t task10msEnterTimestamp
uint32_t task1msEnterTimestamp
uint32_t task100msAlgorithmViolatingDuration
bool recordedViolationEngine
bool recordedViolation10ms
bool recordedViolation100ms
bool recordedViolation1ms
bool recordedViolation100msAlgo
bool recordedViolationAny
SYSM_NOTIFICATION_s * TEST_SYSM_GetNotifications(void)
void SYSM_GetRecordedTimingViolations(SYSM_TIMING_VIOLATION_RESPONSE_s *pAnswer)
Returns the timing violation flags determined from fram state.
void SYSM_CheckNotifications(void)
overall system monitoring
void SYSM_Notify(SYSM_TASK_ID_e taskId, SYSM_NOTIFY_TYPE_e state, uint32_t timestamp)
Sets needed bits to indicate that a task is running.
void SYSM_UpdateFramData(void)
Commits the stored changes to FRAM if necessary.
void SYSM_CopyFramStruct(const FRAM_SYS_MON_RECORD_s *const kpkFrom, FRAM_SYS_MON_RECORD_s *pTo)
Copy from the from entry to the to entry.
@ SYSM_RECORDING_DISABLED
@ SYSM_HANDLING_SWITCH_OFF_CONTACTOR
#define TEST_ASSERT_PASS_ASSERT(_code_under_test)
assert whether assert macro has passed
#define TEST_ASSERT_FAIL_ASSERT(_code_under_test)
assert whether assert macro has failed
FRAM_SYS_MON_RECORD_s fram_sys_mon_record
void TEST_SYSM_DummyCallback_1(SYSM_TASK_ID_e taskId)
void TEST_SYSM_DummyCallback_2(SYSM_TASK_ID_e taskId)
void testSYSM_NotifyHitAssertWithIllegalNotifyType(void)
void testSYSM_NotifyInvalidTaskID(void)
void testSYSM_CheckNotificationsSYSMDisabled(void)
void testSYSM_CheckNotificationsProvokeDurationViolation(void)
void TEST_SYSM_DummyCallback_0(SYSM_TASK_ID_e taskId)
void testSYSM_GetRecordedTimingViolations(void)
void testSYSM_CopyFramStructInvalidInput(void)
void testSYSM_CheckNotificationsEarlyExitOnTimestampEquality(void)
void testSYSM_CheckNotificationsProvokeDurationViolationWithRecording(void)
SYSM_MONITORING_CFG_s sysm_ch_cfg[3]
void testSYSM_NotifyEnterTimestampProperlySet(void)
void testSYSM_CopyFramStruct(void)
void testSYSM_NotifyExitTimestampProperlySetAndDurationCalculated(void)