def generate_and_build(self, tests, clean=False):

        #build results
        successes = []
        failures = []
        skips = []
        for mcu, ides in self.target_ides.items():
            for test in tests:
                #resolve name alias
                test = get_test_from_name(test)
                for ide in ides:
                    lib_symbols = get_lib_symbols(None, None, test)
                    project_dir, project_name, project_temp = setup_project(mcu, ide, test)

                    dest_dir = os.path.dirname(project_temp)
                    destination = os.path.join(dest_dir,"_".join([project_name, mcu, ide]))

                    tmp_path, report = perform_export(project_dir, project_name, ide, mcu, destination,
                                                      lib_symbols=lib_symbols, progen_build = True)

                    if report['success']:
                        successes.append("build for %s::%s\t%s" % (mcu, ide, project_name))
                    elif report['skip']:
                        skips.append("%s::%s\t%s" % (mcu, ide, project_name))
                    else:
                        failures.append("%s::%s\t%s for %s" % (mcu, ide, report['errormsg'], project_name))

                    ProgenBuildTest.handle_project_files(destination, mcu, project_name, ide, clean)
        return successes, failures, skips
示例#2
0
    def generate_and_build(self, tests, clean=False):

        #build results
        successes = []
        failures = []
        skips = []
        for mcu, ides in self.target_ides.items():
            for test in tests:
                #resolve name alias
                test = get_test_from_name(test)
                for ide in ides:
                    lib_symbols = get_lib_symbols(None, None, test)
                    project_dir, project_name, project_temp = setup_project(
                        mcu, ide, test)

                    dest_dir = os.path.dirname(project_temp)
                    destination = os.path.join(
                        dest_dir, "_".join([project_name, mcu, ide]))

                    tmp_path, report = perform_export(project_dir,
                                                      project_name,
                                                      ide,
                                                      mcu,
                                                      destination,
                                                      lib_symbols=lib_symbols,
                                                      progen_build=True)

                    if report['success']:
                        successes.append("build for %s::%s\t%s" %
                                         (mcu, ide, project_name))
                    elif report['skip']:
                        skips.append("%s::%s\t%s" % (mcu, ide, project_name))
                    else:
                        failures.append(
                            "%s::%s\t%s for %s" %
                            (mcu, ide, report['errormsg'], project_name))

                    ProgenBuildTest.handle_project_files(
                        destination, mcu, project_name, ide, clean)
        return successes, failures, skips
示例#3
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)
                      help="generate project for the given MCUs (%s)" % '\n '.join(accepted_targets),
                      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))