mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-03 14:23:02 +02:00
has_fix() only checks that fix-mode is set (2d/3d), but altitude and other fields may not yet be populated in the operational datastore when gpsd is still processing its first NMEA cycles after boot. Calling verify_position() immediately after has_fix() passes can therefore race and fail with: KeyError: 'altitude' This manifests reliably on the second GPS receiver (gps1) after reboot, because it is initialized slightly later than gps0 and hits the window where fix-mode is set but altitude has not yet appeared. not ok 11 - Verify gps1 position is near the coordinates # Traceback (most recent call last): # File "test/case/hardware/gps_simple/test.py", line 29, in verify_position # alt = float(state["altitude"]) # ~~~~~^^^^^^^^^^^^ # KeyError: 'altitude' Add has_position() to infamy/gps.py, which gates on fix-mode AND all position fields (latitude, longitude, altitude, satellites-used) being present. Replace the has_fix() polls in both the pre- and post-reboot verify steps with has_position(). Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
=== GPS receiver basic test
|
|
|
|
ifdef::topdoc[:imagesdir: {topdoc}../../test/case/hardware/gps_simple]
|
|
|
|
==== Description
|
|
|
|
Verify that two simulated GPS receivers are detected and report valid
|
|
fixes via the ietf-hardware operational datastore.
|
|
|
|
The test injects NMEA sentences through QEMU pipe chardev FIFOs,
|
|
which appear as virtio serial ports inside the guest.
|
|
|
|
==== Topology
|
|
|
|
image::topology.svg[GPS receiver basic test topology, align=center, scaledwidth=75%]
|
|
|
|
==== Sequence
|
|
|
|
. Set up topology and attach to target DUT
|
|
. Configure GPS hardware components
|
|
. Verify both GPS receivers are activated
|
|
. 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 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
|
|
|
|
|