Skip to content

Commit b98fce5

Browse files
chuynh4duarteCindy T HuynhLeStarchthomas-bckevin-f-ortega
authored andcommitted
Add reusable InT test scripts (nasa#3923)
* add deployment function * update file to use config json file * remove unuse function * fix typos * fixed spelling * update to use get_mnemonic * rm shellcmd from fileManager and add health & systemResources testcase * check memory usage and number of CPUs * remove Ref.PingReceiver and fixed typos * fixed spelling fileDownlink,health,systemResources and add config.json file * Update config.json * replace ActiveLogger to EventManager * Updated config.json use lowercase CdhCore and FileHandling(fileDownlink,fileManager,prmDb) and ComCcsds(cmdSeq) etc * update test_cmd_version to compare version of telemetry channel vs. evr version * extend max_delay to work with Raspberry pi * rename config.json to int_config.json * delete Ref/config.json new file name int_config.json * add time.sleep between AppendFile cmd to work with rasberry Pi * fix int_config.json and add new Int DpMgr, DpWriter and DpCatalog * add comments to confirm /tmp/1MiB.txt and /tmp/test_seq.seq exist before execute script * add send uplink files * Rename config.json, fix spelling * python formatting --------- Co-authored-by: Cindy T Huynh <[email protected]> Co-authored-by: M Starch <[email protected]> Co-authored-by: Thomas Boyer-Chammard <[email protected]> Co-authored-by: Kevin F. Ortega <[email protected]>
1 parent 49214d0 commit b98fce5

File tree

23 files changed

+1272
-20
lines changed

23 files changed

+1272
-20
lines changed

Ref/PrmDb.dat

-47 Bytes
Binary file not shown.
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"Drv.BlockDriver" : "Ref.blockDrv",
32
"Svc.ActiveRateGroup" : "Ref.rateGroup1Comp",
4-
"Svc.CommandDispatcher" : "Ref.cmdDisp",
3+
"Svc.CommandDispatcher" : "CdhCore.cmdDisp",
54
"Svc.CmdSequencer" : "Ref.cmdSeq",
6-
"Svc.FileDownlink" : "Ref.fileDownlink",
7-
"Svc.FileManager" : "Ref.fileManager",
5+
"Svc.FileDownlink" : "FileHandling.fileDownlink",
6+
"Svc.FileManager" : "FileHandling.fileManager",
87
"Svc.FileUplink" : "Ref.fileUplink",
98
"Ref.PingReceiver" : "Ref.pingRcvr",
10-
"Svc.ActiveLogger" : "Ref.eventLogger",
9+
"Svc.EventManager" : "CdhCore.events",
1110
"Svc.TlmChan" : "Ref.tlmSend",
12-
"Svc.PrmDb" : "Ref.prmDb",
13-
"Svc.DpCatalog" : "Ref.dpCat",
14-
"Svc.DpManager" : "Ref.dpMgr",
15-
"Svc.DpWriter" : "Ref.dpWriter",
11+
"Svc.PrmDb" : "FileHandling.prmDb",
12+
"Svc.PrmDb.filename" : "/tmp/PrmDb.dat",
13+
"Svc.DpCatalog" : "DataProducts.dpCat",
14+
"Svc.DpManager" : "DataProducts.dpMgr",
15+
"Svc.DpWriter" : "DataProducts.dpWriter",
1616
"Svc.ComQueue" : "Ref.comQueue",
1717
"Ref.TypeDemo" : "Ref.typeDemo",
18-
"Svc.Health" : "Ref.health",
18+
"Svc.Health" : "CdhCore.health",
1919
"Ref.SignalGen" : "Ref.SG1",
2020
"Ref.SendBuff" : "Ref.sendBuffComp",
2121
"Drv.TcpClient" : "Ref.comDriver",
@@ -25,7 +25,7 @@
2525
"Svc.PosixTime" : "Ref.posixTime",
2626
"Svc.RateGroupDriver" : "Ref.rateGroupDriverComp",
2727
"Ref.RecvBuff" : "Ref.recvBuffComp",
28-
"Svc.Version" : "Ref.version",
28+
"Svc.Version" : "CdhCore.version",
2929
"Svc.PassiveTextLogger" : "Ref.textLogger",
3030
"Svc.SystemResources" : "Ref.systemResources",
3131
"Svc.BufferManager" : "Ref.dpBufferManager",
@@ -35,3 +35,4 @@
3535
"Svc.FprimeFramer" : "Ref.fprimeFramer",
3636
"Svc.ComStub" : "Ref.comStub"
3737
}
38+

Ref/test/int/logs/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

Ref/test/int/test_cmd_parameter.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
"""test_parameter.py:
2+
3+
Test the command dispatcher with basic integration tests.
4+
"""
5+
6+
7+
def test_send_parameter(fprime_test_api):
8+
"""Test that commands may be sent
9+
10+
Tests command send, dispatch, and receipt using send_and_assert command with a pair of CmdDispatcher commands.
11+
12+
recvBuffComp.PARAMETER1_PRM_SET (call telemetry confirm value)
13+
recvBuffComp.PARAMETER1_PRM_SAVE
14+
recvBuffComp.PARAMETER2_PRM_SET (call telemetry confirm value)
15+
recvBuffComp.PARAMETER2_PRM_SAVE
16+
17+
sendBuffComp.PARAMETER3_PRM_SET (call telemetry confirm value)
18+
sendBuffComp.PARAMETER3_PRM_SAVE
19+
sendBuffComp.PARAMETER4_PRM_SET (call telemetry confirm value)
20+
sendBuffComp.PARAMETER4_PRM_SAVE
21+
22+
Notes: send a parameterX_set,value=current telemetry channel.
23+
the function assert_telemetry will fail because no_change
24+
"""
25+
26+
## setup default-value
27+
fprime_test_api.send_and_assert_command(
28+
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER1_PRM_SET",
29+
[1],
30+
max_delay=5,
31+
)
32+
fprime_test_api.send_and_assert_command(
33+
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER2_PRM_SET",
34+
[2],
35+
max_delay=5,
36+
)
37+
fprime_test_api.send_and_assert_command(
38+
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER3_PRM_SET",
39+
[3],
40+
max_delay=5,
41+
)
42+
fprime_test_api.send_and_assert_command(
43+
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER4_PRM_SET",
44+
[4],
45+
max_delay=5,
46+
)
47+
48+
# Only work if send command PARAMETER1_PRM_SET then check telemetry. Unsigned integer 0..4294967295)
49+
fprime_test_api.send_and_assert_command(
50+
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER1_PRM_SET",
51+
[10],
52+
max_delay=5,
53+
)
54+
55+
# Check Telem only will not work
56+
param1_change = fprime_test_api.get_telemetry_pred(
57+
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "Parameter1", 10
58+
)
59+
fprime_test_api.assert_telemetry(param1_change, timeout=5)
60+
61+
# Send PARAMETER1_PRM_SAVE
62+
fprime_test_api.send_and_assert_command(
63+
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER1_PRM_SAVE",
64+
max_delay=1,
65+
)
66+
67+
# Send PARAMETER2_PRM_SET (confirm new value / SAVE ) signed integer -32867 and 32767
68+
fprime_test_api.send_and_assert_command(
69+
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER2_PRM_SET",
70+
[20],
71+
max_delay=5,
72+
)
73+
74+
param2_change = fprime_test_api.get_telemetry_pred(
75+
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "Parameter2", 20
76+
)
77+
fprime_test_api.assert_telemetry(param2_change, timeout=5)
78+
79+
fprime_test_api.send_and_assert_command(
80+
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER2_PRM_SAVE",
81+
max_delay=5,
82+
)
83+
84+
# Send PARAMETER3_PRM_SET (confirm new value / SAVE ) unsigned integer 0..255
85+
fprime_test_api.send_and_assert_command(
86+
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER3_PRM_SET",
87+
[30],
88+
max_delay=5,
89+
)
90+
91+
param3_change = fprime_test_api.get_telemetry_pred(
92+
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "Parameter3", 30
93+
)
94+
fprime_test_api.assert_telemetry(param3_change, timeout=5)
95+
96+
fprime_test_api.send_and_assert_command(
97+
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER3_PRM_SAVE",
98+
max_delay=5,
99+
)
100+
101+
# Send PARAMETER4_PRM_SET (confirm new value / SAVE ) float
102+
fprime_test_api.send_and_assert_command(
103+
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER4_PRM_SET",
104+
[40],
105+
max_delay=5,
106+
)
107+
108+
param4_change = fprime_test_api.get_telemetry_pred(
109+
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "Parameter4", 40
110+
)
111+
fprime_test_api.assert_telemetry(param4_change, timeout=5)
112+
113+
fprime_test_api.send_and_assert_command(
114+
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER4_PRM_SAVE",
115+
max_delay=5,
116+
)
117+
118+
# Notes: send a xxx_set,value=current will not update telemetry channel. call assert_telemetry will fail
Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" test_cmd_dispatcher.py:
1+
"""test_cmd_dispatcher.py:
22
33
Test the command dispatcher with basic integration tests.
44
"""
@@ -7,6 +7,31 @@
77
def test_send_command(fprime_test_api):
88
"""Test that commands may be sent
99
10-
Tests command send, dispatch, and receipt using send_and_assert command with a pair of NO-OP commands.
10+
Tests command send, dispatch, and receipt using send_and_assert command with a pair of CmdDispatcher commands.
1111
"""
12-
fprime_test_api.send_and_assert_command("cmdDisp.CMD_NO_OP", max_delay=0.1)
12+
13+
fprime_test_api.send_and_assert_command(
14+
fprime_test_api.get_mnemonic("Svc.CommandDispatcher") + "." + "CMD_NO_OP",
15+
max_delay=1,
16+
)
17+
18+
fprime_test_api.send_and_assert_command(
19+
fprime_test_api.get_mnemonic("Svc.CommandDispatcher")
20+
+ "."
21+
+ "CMD_CLEAR_TRACKING",
22+
max_delay=1,
23+
)
24+
25+
fprime_test_api.send_and_assert_command(
26+
fprime_test_api.get_mnemonic("Svc.CommandDispatcher")
27+
+ "."
28+
+ "CMD_NO_OP_STRING",
29+
["test_string_2"],
30+
max_delay=1,
31+
)
32+
33+
fprime_test_api.send_and_assert_command(
34+
fprime_test_api.get_mnemonic("Svc.CommandDispatcher") + "." + "CMD_TEST_CMD_1",
35+
[2, 3, 4],
36+
max_delay=1,
37+
)

0 commit comments

Comments
 (0)