def get_test_from_name(n):
    if not n in TEST_MAP.keys():
        # Check if there is an alias for this in private_settings.py
        if getattr(ps, "test_alias", None) is not None:
            alias = ps.test_alias.get(n, "")
            if not alias in TEST_MAP.keys():
                return None
            else:
                n = alias
        else:
            return None
    return get_program(n)
Esempio n. 2
0
def get_test_from_name(n):
    if not n in TEST_MAP.keys():
        # Check if there is an alias for this in private_settings.py
        if getattr(ps, "test_alias", None) is not None:
            alias = ps.test_alias.get(n, "")
            if not alias in TEST_MAP.keys():
                return None
            else:
                n = alias
        else:
            return None
    return get_program(n)
Esempio n. 3
0
        print(json.dumps(OFFICIAL_MBED_LIBRARY_BUILD, indent=4))
        sys.exit()
    start = time()
    build_report = {}
    build_properties = {}
    platforms = None
    if options.platforms != "":
        platforms = set(options.platforms.split(","))
    status = True
    if options.build_tests:
        # Get all paths
        directories = options.build_tests.split(',')
        for i in range(len(directories)):
            directories[i] = normpath(join(TEST_DIR, directories[i]))
        test_names = []
        for test_id in list(TEST_MAP.keys()):
            # Prevents tests with multiple source dirs from being checked
            if isinstance(TEST_MAP[test_id].source_dir, basestring):
                test_path = normpath(TEST_MAP[test_id].source_dir)
                for directory in directories:
                    if directory in test_path:
                        test_names.append(test_id)
        mut_counter = 1
        mut = {}
        test_spec = {"targets": {}}

        if options.toolchains:
            print("Only building using the following toolchains: {}".format(
                options.toolchains))

        for target_name, toolchain_list in OFFICIAL_MBED_LIBRARY_BUILD:
Esempio n. 4
0
 if src is not None:
     # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file
     project_dir = options.source_dir
     project_name = n if n else "Unnamed_Project"
     project_temp = path.join(options.source_dir[0], 'projectfiles', ide)
     mkdir(project_temp)
     lib_symbols = []
     if options.macros:
         lib_symbols += options.macros
     zip = False   # don't create zip
     clean = False # don't cleanup because we use the actual source tree to generate IDE files
 else:
     if n is not None and p is not None:
         args_error(parser, "[ERROR] specify either '-n' or '-p', not both")
     if n:
         if not n in TEST_MAP.keys():
             # Check if there is an alias for this in private_settings.py
             if getattr(ps, "test_alias", None) is not None:
                 alias = ps.test_alias.get(n, "")
                 if not alias in TEST_MAP.keys():
                     args_error(parser, "[ERROR] Program with name '%s' not found" % n)
                 else:
                     n = alias
             else:
                 args_error(parser, "[ERROR] Program with name '%s' not found" % n)
         p = TEST_MAP[n].n
         
     if p is None or (p < 0) or (p > (len(TESTS)-1)):
         message = "[ERROR] You have to specify one of the following tests:\n"
         message += '\n'.join(map(str, sorted(TEST_MAP.values())))
         args_error(parser, message)
Esempio n. 5
0
    # force program to "0" if a source dir is specified
    if options.source_dir is not None:
        p = 0
        n = None
    else:
        # Program Number or name
        p, n = options.program, options.program_name

    if n is not None and p is not None:
        args_error(parser, "[ERROR] specify either '-n' or '-p', not both")
    if n:
        # We will transform 'n' to list of 'p' (integers which are test numbers)
        nlist = n.split(',')
        for test_id in nlist:
            if test_id not in TEST_MAP.keys():
                args_error(
                    parser,
                    "[ERROR] Program with name '%s' not found" % test_id)

        p = [TEST_MAP[n].n for n in nlist]
    elif p is None or (p < 0) or (p > (len(TESTS) - 1)):
        message = "[ERROR] You have to specify one of the following tests:\n"
        message += '\n'.join(map(str, sorted(TEST_MAP.values())))
        args_error(parser, message)

    # If 'p' was set via -n to list of numbers make this a single element integer list
    if type(p) != type([]):
        p = [p]

    # Target
Esempio n. 6
0
    # force program to "0" if a source dir is specified
    if options.source_dir is not None:
        p = 0
        n = None
    else:
    # Program Number or name
        p, n = options.program, options.program_name

    if n is not None and p is not None:
        args_error(parser, "[ERROR] specify either '-n' or '-p', not both")
    if n:
        # We will transform 'n' to list of 'p' (integers which are test numbers)
        nlist = n.split(',')
        for test_id in nlist:
            if test_id not in TEST_MAP.keys():
                args_error(parser, "[ERROR] Program with name '%s' not found"% test_id)

        p = [TEST_MAP[n].n for n in nlist]
    elif p is None or (p < 0) or (p > (len(TESTS)-1)):
        message = "[ERROR] You have to specify one of the following tests:\n"
        message += '\n'.join(map(str, sorted(TEST_MAP.values())))
        args_error(parser, message)

    # If 'p' was set via -n to list of numbers make this a single element integer list
    if type(p) != type([]):
        p = [p]

    # Target
    if options.mcu is None :
        args_error(parser, "[ERROR] You should specify an MCU")
Esempio n. 7
0
    build_report = {}
    build_properties = {}

    platforms = None
    if options.platforms != "":
        platforms = set(options.platforms.split(","))

    if options.build_tests:
        # Get all paths
        directories = options.build_tests.split(',')
        for i in range(len(directories)):
            directories[i] = normpath(join(TEST_DIR, directories[i]))

        test_names = []

        for test_id in TEST_MAP.keys():
            # Prevents tests with multiple source dirs from being checked
            if isinstance( TEST_MAP[test_id].source_dir, basestring):
                test_path = normpath(TEST_MAP[test_id].source_dir)
                for directory in directories:
                    if directory in test_path:
                        test_names.append(test_id)

        mut_counter = 1
        mut = {}
        test_spec = {
            "targets": {}
        }

        if options.toolchains:
            print "Only building using the following toolchains: %s" % (options.toolchains)
Esempio n. 8
0
 if src is not None:
     # --source is used to generate IDE files to toolchain directly in the source tree and doesn't generate zip file
     project_dir = options.source_dir
     project_name = n if n else "Unnamed_Project"
     project_temp = path.join(options.source_dir[0], 'projectfiles', ide)
     mkdir(project_temp)
     lib_symbols = []
     if options.macros:
         lib_symbols += options.macros
     zip = False   # don't create zip
     clean = False # don't cleanup because we use the actual source tree to generate IDE files
 else:
     if n is not None and p is not None:
         args_error(parser, "[ERROR] specify either '-n' or '-p', not both")
     if n:
         if not n in TEST_MAP.keys():
             # Check if there is an alias for this in private_settings.py
             if getattr(ps, "test_alias", None) is not None:
                 alias = ps.test_alias.get(n, "")
                 if not alias in TEST_MAP.keys():
                     args_error(parser, "[ERROR] Program with name '%s' not found" % n)
                 else:
                     n = alias
             else:
                 args_error(parser, "[ERROR] Program with name '%s' not found" % n)
         p = TEST_MAP[n].n
         
     if p is None or (p < 0) or (p > (len(TESTS)-1)):
         message = "[ERROR] You have to specify one of the following tests:\n"
         message += '\n'.join(map(str, sorted(TEST_MAP.values())))
         args_error(parser, message)
Esempio n. 9
0
    build_report = {}
    build_properties = {}

    platforms = None
    if options.platforms != "":
        platforms = set(options.platforms.split(","))

    if options.build_tests:
        # Get all paths
        directories = options.build_tests.split(',')
        for i in range(len(directories)):
            directories[i] = normpath(join(TEST_DIR, directories[i]))

        test_names = []

        for test_id in TEST_MAP.keys():
            # Prevents tests with multiple source dirs from being checked
            if isinstance(TEST_MAP[test_id].source_dir, basestring):
                test_path = normpath(TEST_MAP[test_id].source_dir)
                for directory in directories:
                    if directory in test_path:
                        test_names.append(test_id)

        mut_counter = 1
        mut = {}
        test_spec = {"targets": {}}

        for target_name, toolchain_list in OFFICIAL_MBED_LIBRARY_BUILD:
            toolchains = None
            if platforms is not None and not target_name in platforms:
                print("Excluding %s from release" % target_name)