Skip to content

Commit

Permalink
Jenkins: hardware test exit from failed hardware check with error, so…
Browse files Browse the repository at this point in the history
… the check will fail
  • Loading branch information
BazookaJoe1900 authored Feb 25, 2020
1 parent f3fefd7 commit 27471d9
Showing 1 changed file with 91 additions and 28 deletions.
119 changes: 91 additions & 28 deletions Tools/HIL/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from subprocess import call, Popen
from argparse import ArgumentParser
import re
import unittest
import os

def do_test(port, baudrate, test_name):
databits = serial.EIGHTBITS
Expand Down Expand Up @@ -69,41 +71,102 @@ def do_test(port, baudrate, test_name):

return success

class TestHadrwareMethods(unittest.TestCase):
TEST_DEVICE = 0
TEST_BAUDRATE = 0

def test_autodeclination(self):
print("runnig test device " + self.TEST_DEVICE)
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "autodeclination"))

def test_bezier(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "bezier"))

def test_bson(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "bson"))

def test_uorb(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "commander"))

def test_controllib(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "controllib"))

# def test_dataman(self):
# self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "dataman"))

def floattest_float(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "float"))

def hrttest_hrt(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "hrt"))

def test_hrt(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "hrt"))

def test_IntrusiveQueue(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "IntrusiveQueue"))

def test_List(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "List"))

def test_mathlib(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "mathlib"))

def test_matrix(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "matrix"))

def test_microbench_hrt(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "microbench_hrt"))

def test_microbench_math(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "microbench_math"))

def test_microbench_matrix(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "microbench_matrix"))

def test_microbench_uorb(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "microbench_uorb"))

# def test_mixer(self):
# self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "mixer"))

def test_param(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "param"))

def test_parameters(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "parameters"))

def test_perf(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "perf"))

def search_mintest_xxx(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "search_min"))

def test_sleep(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "sleep"))

def test_smoothz(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "smoothz"))

def test_time(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "time"))

def test_uorb(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "uorb"))

def test_versioning(self):
self.assertTrue(do_test(self.TEST_DEVICE, self.TEST_BAUDRATE, "versioning"))

def main():
parser = ArgumentParser(description=__doc__)
parser.add_argument('--device', "-d", nargs='?', default = None, help='')
parser.add_argument("--baudrate", "-b", dest="baudrate", type=int, help="Mavlink port baud rate (default=57600)", default=57600)
args = parser.parse_args()

TestHadrwareMethods.TEST_DEVICE = args.device
TestHadrwareMethods.TEST_BAUDRATE = args.baudrate

do_test(args.device, args.baudrate, "autodeclination")
do_test(args.device, args.baudrate, "bezier")
do_test(args.device, args.baudrate, "bson")
do_test(args.device, args.baudrate, "commander")
do_test(args.device, args.baudrate, "controllib")
do_test(args.device, args.baudrate, "conv")
#do_test(args.device, args.baudrate, "dataman")
do_test(args.device, args.baudrate, "float")
do_test(args.device, args.baudrate, "hrt")
do_test(args.device, args.baudrate, "int")
do_test(args.device, args.baudrate, "IntrusiveQueue")
do_test(args.device, args.baudrate, "List")
do_test(args.device, args.baudrate, "mathlib")
do_test(args.device, args.baudrate, "matrix")
do_test(args.device, args.baudrate, "microbench_hrt")
do_test(args.device, args.baudrate, "microbench_math")
do_test(args.device, args.baudrate, "microbench_matrix")
do_test(args.device, args.baudrate, "microbench_uorb")
#do_test(args.device, args.baudrate, "mixer")
do_test(args.device, args.baudrate, "param")
do_test(args.device, args.baudrate, "parameters")
do_test(args.device, args.baudrate, "perf")
do_test(args.device, args.baudrate, "search_min")
do_test(args.device, args.baudrate, "sleep")
do_test(args.device, args.baudrate, "smoothz")
do_test(args.device, args.baudrate, "time")
do_test(args.device, args.baudrate, "uorb")
do_test(args.device, args.baudrate, "versioning")
unittest.main(__name__, argv=['main'])

if __name__ == "__main__":
main()

0 comments on commit 27471d9

Please sign in to comment.