Ejemplo n.º 1
0
def main():
    """Entry point"""
    toolchainlist = ["iar", "uvision", "uvision5"]
    default_tests = [test_name_known("MBED_BLINKY")]
    targetnames = TARGET_NAMES
    targetnames.sort()

    parser = argparse.ArgumentParser(
        description="Test progen builders. Leave any flag off"
        " to run with all possible options.")
    parser.add_argument("-i",
                        dest="ides",
                        default=toolchainlist,
                        type=argparse_many(
                            argparse_force_lowercase_type(
                                toolchainlist, "toolchain")),
                        help="The target IDE: %s" % str(toolchainlist))

    parser.add_argument("-p",
                        type=argparse_many(test_name_known),
                        dest="programs",
                        help="The index of the desired test program: [0-%d]" %
                        (len(TESTS) - 1),
                        default=default_tests)

    parser.add_argument("-n",
                        type=argparse_many(test_name_known),
                        dest="programs",
                        help="The name of the desired test program",
                        default=default_tests)

    parser.add_argument("-m",
                        "--mcu",
                        metavar="MCU",
                        default='LPC1768',
                        nargs="+",
                        type=argparse_force_uppercase_type(targetnames, "MCU"),
                        help="generate project for the given MCU (%s)" %
                        ', '.join(targetnames))

    parser.add_argument("-c",
                        "--clean",
                        dest="clean",
                        action="store_true",
                        help="clean up the exported project files",
                        default=False)

    options = parser.parse_args()
    test = ProgenBuildTest(options.ides, options.mcu, options.programs)
    successes, failures, skips = test.generate_and_build(clean=options.clean)
    print_results(successes, failures, skips)
    sys.exit(len(failures))
Ejemplo n.º 2
0
def main():
    """Entry point"""

    ide_list = ["iar", "uvision"]

    default_v2 = [test_name_known("MBED_BLINKY")]
    default_v5 = [check_valid_mbed_os('tests-mbedmicro-rtos-mbed-basic')]

    parser = argparse.ArgumentParser(
        description="Test progen builders. Leave any flag off"
        " to run with all possible options.")
    parser.add_argument("-i",
                        dest="ides",
                        default=ide_list,
                        type=argparse_many(
                            argparse_force_lowercase_type(
                                ide_list, "toolchain")),
                        help="The target IDE: %s" % str(ide_list))

    parser.add_argument("-p",
                        type=argparse_many(test_known),
                        dest="programs",
                        help="The index of the desired test program: [0-%d]" %
                        (len(TESTS) - 1))

    parser.add_argument("-n",
                        type=argparse_many(test_name_known),
                        dest="programs",
                        help="The name of the desired test program")

    parser.add_argument("-m",
                        "--mcu",
                        help=("Generate projects for the given MCUs"),
                        metavar="MCU",
                        type=argparse_many(str.upper))

    parser.add_argument("-os-tests",
                        type=argparse_many(check_valid_mbed_os),
                        dest="os_tests",
                        help="Mbed-os tests")

    parser.add_argument("-c",
                        "--clean",
                        dest="clean",
                        action="store_true",
                        help="clean up the exported project files",
                        default=False)

    parser.add_argument("--release",
                        dest="release",
                        type=check_version,
                        help="Which version of mbed to test",
                        default=RELEASE_VERSIONS[-1])

    parser.add_argument("--profile",
                        dest="profile",
                        action="append",
                        type=argparse_filestring_type,
                        default=[])

    options = parser.parse_args()
    # targets in chosen release
    targetnames = [
        target[0] for target in get_mbed_official_release(options.release)
    ]
    # all targets in release are default
    test_targets = options.mcu or targetnames
    if not all([t in targetnames for t in test_targets]):
        args_error(
            parser, "Only specify targets in release %s:\n%s" %
            (options.release, columnate(sorted(targetnames))))

    v2_tests, v5_tests = [], []
    if options.release == '5':
        v5_tests = options.os_tests or default_v5
    elif options.release == '2':
        v2_tests = options.programs or default_v2

    tests = []
    default_test = {
        key: None
        for key in ['ide', 'mcu', 'name', 'id', 'src', 'log']
    }
    for mcu in test_targets:
        for ide in options.ides:
            log = "build_log.txt" if ide == 'iar' \
                else join('build', 'build_log.txt')
            # add each test case to the tests array
            default_test.update({'mcu': mcu, 'ide': ide, 'log': log})
            for test in v2_tests:
                default_test.update({'name': TESTS[test]["id"], 'id': test})
                tests.append(copy(default_test))
            for test in v5_tests:
                default_test.update({'name': test[0], 'src': [test[1], ROOT]})
                tests.append(copy(default_test))
    test = ExportBuildTest(tests, parser, options)
    test.batch_tests(clean=options.clean)
    print_results(test.successes, test.failures, test.skips)
    sys.exit(len(test.failures))
Ejemplo n.º 3
0
    parser.add_argument("-c",
                        "--clean",
                        dest="clean",
                        action="store_true",
                        help="clean up the exported project files",
                        default=False)

    options = parser.parse_args()

    tests = options.tests
    ides = [ide.lower() for ide in options.ides]
    targets = [target.upper() for target in options.targets]

    if any(get_test_from_name(test) is None for test in tests):
        args_error(parser, "[ERROR] test name not recognized")

    if any(target not in accepted_targets for target in targets):
        args_error(
            parser, "[ERROR] mcu must be one of the following:\n %s" %
            '\n '.join(accepted_targets))

    if any(ide not in accepted_ides for ide in ides):
        args_error(parser,
                   "[ERROR] ide must be in %s" % ', '.join(accepted_ides))

    build_test = ProgenBuildTest(ides, targets)
    successes, failures, skips = build_test.generate_and_build(
        tests, options.clean)
    print_results(successes, failures, skips)
    sys.exit(len(failures))
def main():
    """Entry point"""

    ide_list = ["iar", "uvision"]

    default_v2 = [test_name_known("MBED_BLINKY")]
    default_v5 = [check_valid_mbed_os('tests-mbedmicro-rtos-mbed-basic')]

    parser = argparse.ArgumentParser(description=
                                     "Test progen builders. Leave any flag off"
                                     " to run with all possible options.")
    parser.add_argument("-i",
                        dest="ides",
                        default=ide_list,
                        type=argparse_many(argparse_force_lowercase_type(
                            ide_list, "toolchain")),
                        help="The target IDE: %s"% str(ide_list))

    parser.add_argument( "-p",
                        type=argparse_many(test_known),
                        dest="programs",
                        help="The index of the desired test program: [0-%d]"
                             % (len(TESTS) - 1))

    parser.add_argument("-n",
                        type=argparse_many(test_name_known),
                        dest="programs",
                        help="The name of the desired test program")

    parser.add_argument("-m", "--mcu",
                        help=("Generate projects for the given MCUs"),
                        metavar="MCU",
                        type=argparse_many(str.upper))

    parser.add_argument("-os-tests",
                        type=argparse_many(check_valid_mbed_os),
                        dest="os_tests",
                        help="Mbed-os tests")

    parser.add_argument("-c", "--clean",
                        dest="clean",
                        action="store_true",
                        help="clean up the exported project files",
                        default=False)

    parser.add_argument("--release",
                        dest="release",
                        type=check_version,
                        help="Which version of mbed to test",
                        default=RELEASE_VERSIONS[-1])

    parser.add_argument("--profile",
                        dest="profile",
                        action="append",
                        type=argparse_filestring_type,
                        default=[])

    options = parser.parse_args()
    # targets in chosen release
    targetnames = [target[0] for target in
                   get_mbed_official_release(options.release)]
    # all targets in release are default
    test_targets = options.mcu or targetnames
    if not all([t in targetnames for t in test_targets]):
        args_error(parser, "Only specify targets in release %s:\n%s"
                   %(options.release, columnate(sorted(targetnames))))

    v2_tests, v5_tests = [],[]
    if options.release == '5':
        v5_tests = options.os_tests or default_v5
    elif options.release == '2':
        v2_tests = options.programs or default_v2

    tests = []
    default_test = {key:None for key in ['ide', 'mcu', 'name', 'id', 'src', 'log']}
    for mcu in test_targets:
        for ide in options.ides:
            log = "build_log.txt" if ide == 'iar' \
                else join('build', 'build_log.txt')
            # add each test case to the tests array
            default_test.update({'mcu': mcu, 'ide': ide, 'log':log})
            for test in v2_tests:
                default_test.update({'name':TESTS[test]["id"], 'id':test})
                tests.append(copy(default_test))
            for test in v5_tests:
                default_test.update({'name':test[0],'src':[test[1],ROOT]})
                tests.append(copy(default_test))
    test = ExportBuildTest(tests, parser, options)
    test.batch_tests(clean=options.clean)
    print_results(test.successes, test.failures, test.skips)
    sys.exit(len(test.failures))
Ejemplo n.º 5
0
                      default = accepted_targets)

    parser.add_argument("-c", "--clean",
                        dest="clean",
                        action = "store_true",
                        help="clean up the exported project files",
                        default=False)

    options = parser.parse_args()

    tests = options.tests
    ides = [ide.lower() for ide in options.ides]
    targets = [target.upper() for target in options.targets]

    if any(get_test_from_name(test) is None for test in tests):
        args_error(parser, "[ERROR] test name not recognized")

    if any(target not in accepted_targets for target in targets):
        args_error(parser, "[ERROR] mcu must be one of the following:\n %s" % '\n '.join(accepted_targets))

    if any(ide not in accepted_ides for ide in ides):
        args_error(parser, "[ERROR] ide must be in %s" % ', '.join(accepted_ides))

    build_test = ProgenBuildTest(ides, targets)
    successes, failures, skips = build_test.generate_and_build(tests, options.clean)
    print_results(successes, failures, skips)
    sys.exit(len(failures))