Created
January 18, 2017 15:31
-
-
Save dagar/bc2b75658d2811cb1b8bb91feffef845 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| """ | |
| This is a simple helper for running pixhawk onboard unit tests. | |
| The script returns 0 if the tests successfully pass, or -1 otherwise. | |
| """ | |
| from __future__ import print_function | |
| import serial | |
| import sys | |
| def main(port): | |
| ser = serial.Serial(port, 57600, timeout=20) | |
| rc = 1 | |
| line = 1 | |
| while line: | |
| line = ser.readline() | |
| print(line, end="") | |
| if "All tests passed" in line: | |
| rc = 0 | |
| if "NuttShell (NSH)" in line: | |
| return rc | |
| return rc | |
| if __name__ == "__main__": | |
| if len(sys.argv) != 2: | |
| print("Error, specify serial port", file=sys.stderr) | |
| sys.exit(1) | |
| sys.exit(main(sys.argv[1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment