mirror of
https://github.com/greatscottgadgets/hackrf.git
synced 2026-02-20 00:33:48 +01:00
ci: check shortfall count to isolate failures in firmware
This commit is contained in:
@@ -22,21 +22,39 @@ def program_device():
|
|||||||
|
|
||||||
|
|
||||||
def capture():
|
def capture():
|
||||||
print("Capturing data...")
|
shortfall_count = -1
|
||||||
rx_100kB = subprocess.run(["host/build/hackrf-tools/src/hackrf_transfer",
|
capture_tries = 0
|
||||||
"-r", FILENAME, "-d", "RunningFromRAM",
|
|
||||||
"-n", "50000", "-s", "20000000"],
|
while shortfall_count != 0:
|
||||||
capture_output=True, encoding="UTF-8")
|
print("Capturing data...")
|
||||||
print(rx_100kB.stdout)
|
rx_100kB = subprocess.run(["host/build/hackrf-tools/src/hackrf_transfer",
|
||||||
print(rx_100kB.stderr)
|
"-r", FILENAME, "-d", "RunningFromRAM",
|
||||||
print(f"Wrote capture data to file: {FILENAME}")
|
"-n", "50000", "-s", "20000000"],
|
||||||
|
capture_output=True, encoding="UTF-8")
|
||||||
|
print(rx_100kB.stdout)
|
||||||
|
print(rx_100kB.stderr)
|
||||||
|
print(f"Wrote capture data to file: {FILENAME}")
|
||||||
|
|
||||||
|
debug_state_proc = subprocess.run(["host/build/hackrf-tools/src/hackrf_debug", "--state"],
|
||||||
|
capture_output=True, encoding="UTF-8")
|
||||||
|
print(debug_state_proc.stdout)
|
||||||
|
print(debug_state_proc.stderr)
|
||||||
|
capture_tries += 1
|
||||||
|
debug_state = debug_state_proc.stdout.split("\n")
|
||||||
|
shortfalls_line = [s for s in debug_state if s.startswith("Number of shortfalls")]
|
||||||
|
shortfall_count = [int(c) for c in shortfalls_line[0].split() if c.isdigit()][0]
|
||||||
|
|
||||||
|
if capture_tries == 10:
|
||||||
|
print("Unable to transmit data with 0 shortfalls. " \
|
||||||
|
"This is not indicative of a device failure. " \
|
||||||
|
"Likely an issue with the testing infrastructure.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def check():
|
def check_bytes():
|
||||||
print(f"Checking length of {FILENAME}")
|
print(f"Checking length of {FILENAME}")
|
||||||
rx_data = Path(FILENAME).read_bytes()
|
rx_data = Path(FILENAME).read_bytes()
|
||||||
# file should be 100k bytes when using 50k samples
|
if len(rx_data) != 100000: # file should be 100k bytes when using 50k samples
|
||||||
if len(rx_data) != 100000:
|
|
||||||
print(f"ERROR: Only {str(len(rx_data))} bytes found in file, expected 100k.")
|
print(f"ERROR: Only {str(len(rx_data))} bytes found in file, expected 100k.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
@@ -61,7 +79,7 @@ def check():
|
|||||||
def main():
|
def main():
|
||||||
program_device()
|
program_device()
|
||||||
capture()
|
capture()
|
||||||
check()
|
check_bytes()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user