File: test-debug.py

package info (click to toggle)
hackrf 2024.02.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 36,692 kB
  • sloc: ansic: 56,310; xml: 3,424; perl: 2,730; python: 1,427; makefile: 598; asm: 514; vhdl: 319; sh: 179; awk: 20
file content (37 lines) | stat: -rw-r--r-- 928 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/python3
import sys
import subprocess

PASS, FAIL  = range(2)
EUT         = "RunningFromRAM"


def check_debug(target, register, reg_val):
    hackrf_debug = subprocess.run(["host/build/hackrf-tools/src/hackrf_debug",
                                   f"--{target}", "--register", register,
                                   "--read", "--device", EUT],
                                  capture_output=True, encoding="UTF-8")

    if reg_val in hackrf_debug.stdout:
        print(f"hackrf_debug --{target} passed.")
        return PASS
    else:
        print(f"hackrf_debug --{target} failed.")
        return FAIL


def main():
    results = [
        check_debug("si5351c", "2", "0x03"),
        check_debug("max2837", "3", "0x1b9"),
        check_debug("rffc5072", "2", "0x9055"),
    ]

    if FAIL not in results:
        sys.exit(PASS)
    else:
        sys.exit(FAIL)


if __name__ == "__main__":
    main()