|
| 1 | +/************************************************************************* |
| 2 | +** |
| 3 | +** GSC-18128-1, "Core Flight Executive Version 6.7" |
| 4 | +** |
| 5 | +** Copyright (c) 2006-2019 United States Government as represented by |
| 6 | +** the Administrator of the National Aeronautics and Space Administration. |
| 7 | +** All Rights Reserved. |
| 8 | +** |
| 9 | +** Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | +** you may not use this file except in compliance with the License. |
| 11 | +** You may obtain a copy of the License at |
| 12 | +** |
| 13 | +** http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | +** |
| 15 | +** Unless required by applicable law or agreed to in writing, software |
| 16 | +** distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | +** See the License for the specific language governing permissions and |
| 19 | +** limitations under the License. |
| 20 | +** |
| 21 | +** File: es_perf_test.c |
| 22 | +** |
| 23 | +** Purpose: |
| 24 | +** Functional test of ES Performance APIs |
| 25 | +** |
| 26 | +*************************************************************************/ |
| 27 | + |
| 28 | +/* |
| 29 | + * Includes |
| 30 | + */ |
| 31 | + |
| 32 | +#include "cfe_test.h" |
| 33 | + |
| 34 | +void TestPerfLogEntry(void) |
| 35 | +{ |
| 36 | + UtAssert_VOIDCALL(CFE_ES_PerfLogEntry(0)); |
| 37 | + UtAssert_VOIDCALL(CFE_ES_PerfLogEntry(CFE_MISSION_ES_PERF_MAX_IDS-1)); |
| 38 | + UtAssert_VOIDCALL(CFE_ES_PerfLogEntry(CFE_MISSION_ES_PERF_MAX_IDS)); |
| 39 | +} |
| 40 | + |
| 41 | +void TestPerfLogExit(void) |
| 42 | +{ |
| 43 | + UtAssert_VOIDCALL(CFE_ES_PerfLogExit(0)); |
| 44 | + UtAssert_VOIDCALL(CFE_ES_PerfLogExit(CFE_MISSION_ES_PERF_MAX_IDS-1)); |
| 45 | + UtAssert_VOIDCALL(CFE_ES_PerfLogExit(CFE_MISSION_ES_PERF_MAX_IDS)); |
| 46 | +} |
| 47 | + |
| 48 | +void TestPerfLogAdd(void) |
| 49 | +{ |
| 50 | + UtAssert_VOIDCALL(CFE_ES_PerfLogAdd(0, 0)); |
| 51 | + UtAssert_VOIDCALL(CFE_ES_PerfLogAdd(0, 1)); |
| 52 | + UtAssert_VOIDCALL(CFE_ES_PerfLogAdd(0, 0xFFFFFFFF)); |
| 53 | + UtAssert_VOIDCALL(CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS-1, 0)); |
| 54 | + UtAssert_VOIDCALL(CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS-1, 1)); |
| 55 | + UtAssert_VOIDCALL(CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS-1, 0xFFFFFFFF)); |
| 56 | + UtAssert_VOIDCALL(CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS, 0)); |
| 57 | + UtAssert_VOIDCALL(CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS, 1)); |
| 58 | + UtAssert_VOIDCALL(CFE_ES_PerfLogAdd(CFE_MISSION_ES_PERF_MAX_IDS, 0xFFFFFFFF)); |
| 59 | +} |
| 60 | + |
| 61 | +/* These commands should trigger and stop perf data (based on value commanded in functional test workflow) */ |
| 62 | +void TestPerfLogTrigger(void) |
| 63 | +{ |
| 64 | + UtAssert_VOIDCALL(CFE_ES_PerfLogEntry(126)); |
| 65 | + UtAssert_VOIDCALL(CFE_ES_PerfLogExit(126)); |
| 66 | +} |
| 67 | + |
| 68 | +void ESPerfTestSetup(void) |
| 69 | +{ |
| 70 | + UtTest_Add(TestPerfLogEntry, NULL, NULL, "Test PerfLogEntry"); |
| 71 | + UtTest_Add(TestPerfLogExit, NULL, NULL, "Test PerfLogExit"); |
| 72 | + UtTest_Add(TestPerfLogAdd, NULL, NULL, "Test PerfLogAdd"); |
| 73 | + UtTest_Add(TestPerfLogTrigger, NULL, NULL, "Test Perf Trigger"); |
| 74 | +} |
0 commit comments