Skip to content

Commit a4dd672

Browse files
committed
Fix #812 Add Perf API functional tests
and add Perf Trigger and Perf Start commands to functional tests workflow
1 parent eb9c523 commit a4dd672

File tree

5 files changed

+81
-1
lines changed

5 files changed

+81
-1
lines changed

.github/workflows/functional-tests.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,14 @@ jobs:
6363
- name: List cpu1
6464
run: ls build/exe/cpu1/
6565

66+
# Run cFS, send commands to set perf trigger and start perf data, and run functional tests
6667
- name: Run cFS
6768
run: |
6869
./core-cpu1 &
6970
sleep 10
70-
../host/cmdUtil --pktid=0x1806 --cmdcode=4 --endian=LE --string="20:CFE_TEST_APP" --string="20:CFE_TestMain" --string="64:cfe_testcase" --uint32=16384 --uint8=0 --uint8=0 --uint16=100 &
71+
../host/cmdUtil --pktid=0x1806 --cmdcode=17 --endian=LE --uint32=3 --uint32=0x40000000
72+
../host/cmdUtil --pktid=0x1806 --cmdcode=14 --endian=LE --uint32=2
73+
../host/cmdUtil --pktid=0x1806 --cmdcode=4 --endian=LE --string="20:CFE_TEST_APP" --string="20:CFE_TestMain" --string="64:cfe_testcase" --uint32=16384 --uint8=0 --uint8=0 --uint16=100
7174
7275
sleep 30
7376
counter=0

modules/cfe_testcase/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ add_cfe_app(cfe_testcase
1111
src/es_cds_test.c
1212
src/es_counter_test.c
1313
src/es_misc_test.c
14+
src/es_perf_test.c
1415
src/es_mempool_test.c
1516
src/es_resource_id_test.c
1617
src/evs_filters_test.c

modules/cfe_testcase/src/cfe_test.c

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void CFE_TestMain(void)
6565
ESMemPoolTestSetup();
6666
ESMiscTestSetup();
6767
ESResourceIDTestSetup();
68+
ESPerfTestSetup();
6869
ESTaskTestSetup();
6970
EVSFiltersTestSetup();
7071
EVSSendTestSetup();

modules/cfe_testcase/src/cfe_test.h

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ void ESInfoTestSetup(void);
9696
void ESMemPoolTestSetup(void);
9797
void ESMiscTestSetup(void);
9898
void ESResourceIDTestSetup(void);
99+
void ESPerfTestSetup(void);
99100
void ESTaskTestSetup(void);
100101
void EVSFiltersTestSetup(void);
101102
void EVSSendTestSetup(void);
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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

Comments
 (0)