Skip to content

Commit 8bb5663

Browse files
committed
Update sdd, topology, and add int tests
1 parent 207e503 commit 8bb5663

File tree

5 files changed

+81
-13
lines changed

5 files changed

+81
-13
lines changed

FprimeZephyrReference/Components/Watchdog/docs/sdd.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ The `Components::Watchdog` component provides the mechanism to "pet" the physica
88

99
The requirements for `Components::Watchdog` are as follows:
1010

11-
Requirement | Description | Verification Method
12-
----------- | ----------- | -------------------
13-
WD-001 | The `Components::Watchdog` component shall activate upon startup. | Unit Test
14-
WD-002 | The `Components::Watchdog` component shall oscillate the watchdog GPIO pin (24) on/off on each rategroup tick. | Unit Test
15-
WD-003 | The `Components::Watchdog` component shall provide telemetry for watchdog transition count. | Unit Test
16-
WD-004 | The `Components::Watchdog` component shall respond to stop signals to halt the watchdog petting. | Unit Test
17-
WD-005 | The `Components::Watchdog` component shall provide a test command to stop the watchdog petting. | Unit Test
18-
WD-006 | The `Components::Watchdog` component shall emit an event when the watchdog petting stops. | Unit Test
11+
Requirement | Description | Verification Method | Verified?
12+
----------- | ----------- | ------------------- | ---------
13+
WD-001 | The `Components::Watchdog` component shall activate upon startup. | Inspection | Yes
14+
WD-002 | The `Components::Watchdog` component shall oscillate the watchdog GPIO pin (24) on/off on each rategroup tick. | Inspection | Yes
15+
WD-003 | The `Components::Watchdog` component shall provide telemetry for watchdog transition count. | Integration Test | In Progress
16+
WD-004 | The `Components::Watchdog` component shall respond to stop signals to halt the watchdog petting. | Integration Test | Yes
17+
WD-005 | The `Components::Watchdog` component shall provide a test command to stop the watchdog petting. | Integration Test | Yes
18+
WD-006 | The `Components::Watchdog` component shall emit an event when the watchdog petting stops. | Integration Test | Yes
1919

2020
## 3. Design
2121

@@ -52,7 +52,3 @@ WatchdogStop | Emits once the watchdog petting has stopped. .
5252
Name | Type | Description
5353
---- | ---- | -----
5454
WatchdogTransitions | U32 | Number of times the GPIO has oscillated from on/off during watchdog petting
55-
56-
## 4. Unit Testing
57-
58-
TODO

FprimeZephyrReference/ReferenceDeployment/Top/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ register_fprime_module(
1414
AUTOCODER_INPUTS
1515
"${CMAKE_CURRENT_LIST_DIR}/instances.fpp"
1616
"${CMAKE_CURRENT_LIST_DIR}/topology.fpp"
17+
"${CMAKE_CURRENT_LIST_DIR}/ReferenceDeploymentPackets.fppi"
1718
SOURCES
1819
"${CMAKE_CURRENT_LIST_DIR}/ReferenceDeploymentTopology.cpp"
1920
DEPENDS

FprimeZephyrReference/ReferenceDeployment/Top/topology.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ module ReferenceDeployment {
8484
# High rate (10Hz) rate group
8585
rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup10Hz] -> rateGroup10Hz.CycleIn
8686
rateGroup10Hz.RateGroupMemberOut[0] -> comDriver.schedIn
87-
rateGroup10Hz.RateGroupMemberOut[1] -> watchdog.run
8887

8988
# Slow rate (1Hz) rate group
9089
rateGroupDriver.CycleOut[Ports_RateGroups.rateGroup1Hz] -> rateGroup1Hz.CycleIn
9190
rateGroup1Hz.RateGroupMemberOut[0] -> ComCcsds.comQueue.run
9291
rateGroup1Hz.RateGroupMemberOut[1] -> CdhCore.$health.Run
9392
rateGroup1Hz.RateGroupMemberOut[2] -> ComCcsds.commsBufferManager.schedIn
9493
rateGroup1Hz.RateGroupMemberOut[3] -> CdhCore.tlmSend.Run
94+
rateGroup1Hz.RateGroupMemberOut[4] -> watchdog.run
9595
}
9696

9797
connections Watchdog {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### To run Integration Tests:
2+
3+
First, start GDS with:
4+
5+
6+
Run Integration Test:
7+
pytest integration_test.py --deployment ../../../build-artifacts/zephyr/fprime-zephyr-deployment
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
"""
2+
integration_test.py:
3+
4+
Simple integration tests for the Watchdog component.
5+
Tests are ordered so that stop tests run last.
6+
"""
7+
8+
def get_watchdog_transitions(fprime_test_api):
9+
"""Helper function to request packet and get fresh WatchdogTransitions telemetry"""
10+
fprime_test_api.clear_histories()
11+
fprime_test_api.send_and_assert_command("CdhCore.tlmSend.SEND_PKT", ["5"], max_delay=2)
12+
result = fprime_test_api.assert_telemetry(
13+
"ReferenceDeployment.watchdog.WatchdogTransitions",
14+
start="NOW", timeout=3
15+
)
16+
return result.get_val()
17+
18+
19+
def test_01_watchdog_telemetry_basic(fprime_test_api):
20+
"""Test that we can read WatchdogTransitions telemetry"""
21+
value = get_watchdog_transitions(fprime_test_api)
22+
assert value >= 0, f"WatchdogTransitions should be >= 0, got {value}"
23+
24+
25+
def test_02_watchdog_increments(fprime_test_api):
26+
"""Test that WatchdogTransitions increments over time"""
27+
import time
28+
29+
initial_value = get_watchdog_transitions(fprime_test_api)
30+
time.sleep(2.0) # Wait for watchdog to run more cycles
31+
updated_value = get_watchdog_transitions(fprime_test_api)
32+
33+
assert updated_value > initial_value, \
34+
f"WatchdogTransitions should increase. Initial: {initial_value}, Updated: {updated_value}"
35+
36+
37+
def test_03_stop_watchdog_command(fprime_test_api):
38+
"""Test TEST_STOP_WATCHDOG command sends and emits WatchdogStop event"""
39+
fprime_test_api.clear_histories()
40+
41+
fprime_test_api.send_and_assert_command(
42+
"ReferenceDeployment.watchdog.TEST_STOP_WATCHDOG",
43+
max_delay=2
44+
)
45+
46+
fprime_test_api.assert_event(
47+
"ReferenceDeployment.watchdog.WatchdogStop",
48+
timeout=2
49+
)
50+
51+
52+
def test_04_watchdog_stops_incrementing(fprime_test_api):
53+
"""Test that WatchdogTransitions stops incrementing after TEST_STOP_WATCHDOG"""
54+
import time
55+
56+
# Get initial value (should be from stopped watchdog from previous test)
57+
initial_value = get_watchdog_transitions(fprime_test_api)
58+
59+
# Wait and check that it's not incrementing (watchdog should already be stopped)
60+
time.sleep(2.0)
61+
final_value = get_watchdog_transitions(fprime_test_api)
62+
63+
assert final_value == initial_value, \
64+
f"Watchdog should remain stopped. Initial: {initial_value}, Final: {final_value}"

0 commit comments

Comments
 (0)