Beispiel #1
0
def run_step(step):
    """Run one step."""

    # remove old logs
    util.run_cmd('/bin/rm -f logs/*.BIN logs/LASTLOG.TXT')

    if step == "prerequisites":
        return test_prerequisites()

    build_opts = {
        "j": opts.j,
        "debug": opts.debug,
        "clean": not opts.no_clean,
        "configure": not opts.no_configure,
        "extra_configure_args": opts.waf_configure_args,
    }

    vehicle_binary = None
    if step == 'build.ArduPlane':
        vehicle_binary = 'bin/arduplane'

    if step == 'build.APMrover2':
        vehicle_binary = 'bin/ardurover'

    if step == 'build.ArduCopter':
        vehicle_binary = 'bin/arducopter'

    if step == 'build.AntennaTracker':
        vehicle_binary = 'bin/antennatracker'

    if step == 'build.Helicopter':
        vehicle_binary = 'bin/arducopter-heli'

    if step == 'build.ArduSub':
        vehicle_binary = 'bin/ardusub'

    if vehicle_binary is not None:
        return util.build_SITL(vehicle_binary, **build_opts)

    binary = binary_path(step, debug=opts.debug)

    if step.startswith("defaults"):
        vehicle = step[9:]
        return get_default_params(vehicle, binary)

    fly_opts = {
        "viewerip": opts.viewerip,
        "use_map": opts.map,
        "valgrind": opts.valgrind,
        "gdb": opts.gdb,
        "gdbserver": opts.gdbserver,
        "breakpoints": opts.breakpoint,
        "frame": opts.frame,
    }
    if opts.speedup is not None:
        fly_opts["speedup"] = opts.speedup

    if step == 'fly.ArduCopter':
        tester = arducopter.AutoTestCopter(binary, **fly_opts)
        return tester.autotest()

    if step == 'fly.CopterAVC':
        tester = arducopter.AutoTestHeli(binary, **fly_opts)
        return tester.autotest()

    if step == 'fly.ArduPlane':
        tester = arduplane.AutoTestPlane(binary, **fly_opts)
        return tester.autotest()

    if step == 'fly.QuadPlane':
        tester = quadplane.AutoTestQuadPlane(binary, **fly_opts)
        return tester.autotest()

    if step == 'drive.APMrover2':
        tester = apmrover2.AutoTestRover(binary, **fly_opts)
        return tester.autotest()

    if step == 'drive.balancebot':
        tester = balancebot.AutoTestBalanceBot(binary, **fly_opts)
        return tester.autotest()

    if step == 'dive.ArduSub':
        tester = ardusub.AutoTestSub(binary, **fly_opts)
        return tester.autotest()

    specific_test_to_run = find_specific_test_to_run(step)
    if specific_test_to_run is not None:
        return run_specific_test(specific_test_to_run, binary, **fly_opts)

    if step == 'build.All':
        return build_all()

    if step == 'build.Binaries':
        return build_binaries()

    if step == 'build.examples':
        return build_examples()

    if step == 'run.examples':
        return examples.run_examples(debug=opts.debug,
                                     valgrind=False,
                                     gdb=False)

    if step == 'build.Parameters':
        return build_parameters()

    if step == 'convertgpx':
        return convert_gpx()

    if step == 'build.unit_tests':
        return build_unit_tests()

    if step == 'run.unit_tests':
        return run_unit_tests()

    raise RuntimeError("Unknown step %s" % step)
Beispiel #2
0
def run_step(step):
    """Run one step."""

    # remove old logs
    util.run_cmd('/bin/rm -f logs/*.BIN logs/LASTLOG.TXT')

    if step == "prerequisites":
        return test_prerequisites()

    build_opts = {
        "j": opts.j,
        "debug": opts.debug,
        "clean": not opts.no_clean,
        "configure": not opts.no_configure,
    }

    vehicle_binary = None
    if step == 'build.ArduPlane':
        vehicle_binary = 'bin/arduplane'

    if step == 'build.APMrover2':
        vehicle_binary = 'bin/ardurover'

    if step == 'build.ArduCopter':
        vehicle_binary = 'bin/arducopter'

    if step == 'build.AntennaTracker':
        vehicle_binary = 'bin/antennatracker'

    if step == 'build.Helicopter':
        vehicle_binary = 'bin/arducopter-heli'

    if step == 'build.ArduSub':
        vehicle_binary = 'bin/ardusub'

    if vehicle_binary is not None:
        return util.build_SITL(vehicle_binary, **build_opts)

    binary = binary_path(step, debug=opts.debug)

    if step.startswith("defaults"):
        vehicle = step[9:]
        return get_default_params(vehicle, binary)

    fly_opts = {
        "viewerip": opts.viewerip,
        "use_map": opts.map,
        "valgrind": opts.valgrind,
        "gdb": opts.gdb,
        "gdbserver": opts.gdbserver,
    }
    if opts.speedup is not None:
        fly_opts["speedup"] = opts.speedup

    if step == 'fly.ArduCopter':
        tester = arducopter.AutoTestCopter(binary,
                                           frame=opts.frame,
                                           **fly_opts)
        return tester.autotest()

    if step == 'fly.CopterAVC':
        tester = arducopter.AutoTestCopter(binary, **fly_opts)
        return tester.autotest_heli()

    if step == 'fly.ArduPlane':
        tester = arduplane.AutoTestPlane(binary, **fly_opts)
        return tester.autotest()

    if step == 'fly.QuadPlane':
        tester = quadplane.AutoTestQuadPlane(binary, **fly_opts)
        return tester.autotest()

    if step == 'drive.APMrover2':
        tester = apmrover2.AutoTestRover(binary, frame=opts.frame, **fly_opts)
        return tester.autotest()

    if step == 'dive.ArduSub':
        tester = ardusub.AutoTestSub(binary, **fly_opts)
        return tester.autotest()

    if step == 'build.All':
        return build_all()

    if step == 'build.Binaries':
        return build_binaries()

    if step == 'build.DevRelease':
        return build_devrelease()

    if step == 'build.Examples':
        return build_examples()

    if step == 'build.Parameters':
        return build_parameters()

    if step == 'convertgpx':
        return convert_gpx()

    raise RuntimeError("Unknown step %s" % step)