diff --git a/test/case/hardware/gps_simple/test.adoc b/test/case/hardware/gps_simple/test.adoc index ca7ed86a..2715ce0f 100644 --- a/test/case/hardware/gps_simple/test.adoc +++ b/test/case/hardware/gps_simple/test.adoc @@ -19,12 +19,14 @@ image::topology.svg[GPS receiver basic test topology, align=center, scaledwidth= . Set up topology and attach to target DUT . Configure GPS hardware components . Verify both GPS receivers are activated -. Verify both GPS receivers have a fix +. Verify both GPS receivers report full position data +. Verify both GPS receivers have a satellite fix . Verify gps0 position is near the coordinates . Verify gps1 position is near the coordinates . Save the configuration to startup configuration and reboot . Verify both GPS receivers are activated -. Verify both GPS receivers have a fix +. Verify both GPS receivers report full position data +. Verify both GPS receivers have a satellite fix . Verify gps0 position is near the coordinates . Verify gps1 position is near the coordinates diff --git a/test/case/hardware/gps_simple/test.py b/test/case/hardware/gps_simple/test.py index beb87267..28e2dd5f 100755 --- a/test/case/hardware/gps_simple/test.py +++ b/test/case/hardware/gps_simple/test.py @@ -84,7 +84,11 @@ with infamy.Test() as test: until(lambda: gps.is_activated(target, "gps0"), attempts=500) until(lambda: gps.is_activated(target, "gps1"), attempts=500) - with test.step("Verify both GPS receivers have a fix"): + with test.step("Verify both GPS receivers report full position data"): + until(lambda: gps.has_position(target, "gps0"), attempts=60) + until(lambda: gps.has_position(target, "gps1"), attempts=60) + + with test.step("Verify both GPS receivers have a satellite fix"): until(lambda: gps.has_fix(target, "gps0"), attempts=60) until(lambda: gps.has_fix(target, "gps1"), attempts=60) @@ -106,7 +110,11 @@ with infamy.Test() as test: until(lambda: gps.is_activated(target, "gps0"), attempts=500) until(lambda: gps.is_activated(target, "gps1"), attempts=500) - with test.step("Verify both GPS receivers have a fix"): + with test.step("Verify both GPS receivers report full position data"): + until(lambda: gps.has_position(target, "gps0"), attempts=60) + until(lambda: gps.has_position(target, "gps1"), attempts=60) + + with test.step("Verify both GPS receivers have a satellite fix"): until(lambda: gps.has_fix(target, "gps0"), attempts=60) until(lambda: gps.has_fix(target, "gps1"), attempts=60) diff --git a/test/infamy/gps.py b/test/infamy/gps.py index d3743a50..3ec9e31d 100644 --- a/test/infamy/gps.py +++ b/test/infamy/gps.py @@ -208,3 +208,13 @@ def has_fix(target, name="gps0"): if not state: return False return state.get("fix-mode") in ("2d", "3d") + + +def has_position(target, name="gps0"): + """Check if GPS has a fix and all position fields are populated.""" + state = get_gps_state(target, name) + if not state: + return False + if state.get("fix-mode") not in ("2d", "3d"): + return False + return all(k in state for k in ("latitude", "longitude", "altitude", "satellites-used"))