mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #2895 from bridadan/build-test-fix
[Exporters] Resolving Python errors and uVision build issuespull/2899/head
commit
5713435d02
|
@ -18,7 +18,6 @@ from exporters import Exporter
|
|||
from os.path import splitext, basename, join
|
||||
from random import randint
|
||||
from tools.utils import mkdir
|
||||
from targets import Target
|
||||
|
||||
|
||||
class Sw4STM32(Exporter):
|
||||
|
@ -80,7 +79,7 @@ class Sw4STM32(Exporter):
|
|||
def generate(self):
|
||||
fp_hardware = "no"
|
||||
fp_abi = "soft"
|
||||
core = Target.get_target(self.target).core
|
||||
core = self.target.core
|
||||
if core == "Cortex-M4F" or core == "Cortex-M7F":
|
||||
fp_hardware = "fpv4-sp-d16"
|
||||
fp_abi = "soft-fp"
|
||||
|
|
|
@ -19,6 +19,7 @@ from project_generator_definitions.definitions import ProGenDef
|
|||
|
||||
from tools.export.exporters import Exporter, ExporterTargetsProperty
|
||||
from tools.targets import TARGET_MAP, TARGET_NAMES
|
||||
from tools.utils import remove_if_in
|
||||
|
||||
# If you wish to add a new target, add it to project_generator_definitions, and then
|
||||
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
|
||||
|
@ -87,11 +88,11 @@ class Uvision4(Exporter):
|
|||
+ self.flags['c_flags']
|
||||
+ self.flags['cxx_flags']))
|
||||
# not compatible with c99 flag set in the template
|
||||
project_data['misc']['c_flags'].remove("--c99")
|
||||
remove_if_in(project_data['misc']['c_flags'], "--c99")
|
||||
# cpp is not required as it's implicit for cpp files
|
||||
project_data['misc']['c_flags'].remove("--cpp")
|
||||
remove_if_in(project_data['misc']['c_flags'], "--cpp")
|
||||
# we want no-vla for only cxx, but it's also applied for C in IDE, thus we remove it
|
||||
project_data['misc']['c_flags'].remove("--no_vla")
|
||||
remove_if_in(project_data['misc']['c_flags'], "--no_vla")
|
||||
project_data['misc']['ld_flags'] = self.flags['ld_flags']
|
||||
|
||||
project_data['build_dir'] = project_data['build_dir'] + '\\' + 'uvision4'
|
||||
|
|
|
@ -19,6 +19,7 @@ from project_generator_definitions.definitions import ProGenDef
|
|||
|
||||
from tools.export.exporters import Exporter, ExporterTargetsProperty
|
||||
from tools.targets import TARGET_MAP, TARGET_NAMES
|
||||
from tools.utils import remove_if_in
|
||||
|
||||
# If you wish to add a new target, add it to project_generator_definitions, and then
|
||||
# define progen_target name in the target class (`` self.progen_target = 'my_target_name' ``)
|
||||
|
@ -83,11 +84,12 @@ class Uvision5(Exporter):
|
|||
+ self.flags['c_flags']
|
||||
+ self.flags['cxx_flags']))
|
||||
# not compatible with c99 flag set in the template
|
||||
project_data['misc']['c_flags'].remove("--c99")
|
||||
remove_if_in(project_data['misc']['c_flags'], "--c99")
|
||||
# cpp is not required as it's implicit for cpp files
|
||||
project_data['misc']['c_flags'].remove("--cpp")
|
||||
remove_if_in(project_data['misc']['c_flags'], "--cpp")
|
||||
# we want no-vla for only cxx, but it's also applied for C in IDE, thus we remove it
|
||||
project_data['misc']['c_flags'].remove("--no_vla")
|
||||
remove_if_in(project_data['misc']['c_flags'], "--no_vla")
|
||||
# not compatible with c99 flag set in the template
|
||||
project_data['misc']['ld_flags'] = self.flags['ld_flags']
|
||||
|
||||
i = 0
|
||||
|
|
|
@ -10,7 +10,7 @@ from shutil import move, rmtree
|
|||
from argparse import ArgumentParser
|
||||
from os.path import normpath, realpath
|
||||
|
||||
from tools.paths import EXPORT_DIR, MBED_BASE, MBED_LIBRARIES
|
||||
from tools.paths import EXPORT_DIR, MBED_HAL, MBED_LIBRARIES
|
||||
from tools.export import EXPORTERS, mcu_ide_matrix
|
||||
from tools.tests import TESTS, TEST_MAP
|
||||
from tools.tests import test_known, test_name_known, Test
|
||||
|
@ -18,7 +18,7 @@ from tools.targets import TARGET_NAMES
|
|||
from tools.utils import argparse_filestring_type, argparse_many, args_error
|
||||
from tools.utils import argparse_force_lowercase_type
|
||||
from tools.utils import argparse_force_uppercase_type
|
||||
from tools.project_api import export_project
|
||||
from tools.project_api import export_project, get_exporter_toolchain
|
||||
from tools.options import extract_profile
|
||||
|
||||
|
||||
|
@ -53,7 +53,8 @@ def setup_project(ide, target, program=None, source_dir=None, build=None, export
|
|||
# Substitute the mbed library builds with their sources
|
||||
if MBED_LIBRARIES in test.dependencies:
|
||||
test.dependencies.remove(MBED_LIBRARIES)
|
||||
test.dependencies.append(MBED_BASE)
|
||||
test.dependencies.append(MBED_HAL)
|
||||
|
||||
|
||||
src_paths = [test.source_dir]
|
||||
lib_paths = test.dependencies
|
||||
|
|
|
@ -36,12 +36,14 @@ from tools.test_api import find_tests
|
|||
from tools.project import export
|
||||
from Queue import Queue
|
||||
from threading import Thread, Lock
|
||||
from tools.project_api import print_results
|
||||
from tools.project_api import print_results, get_exporter_toolchain
|
||||
from tools.tests import test_name_known, test_known, Test
|
||||
from tools.export.exporters import FailedBuildException, \
|
||||
TargetNotSupportedException
|
||||
from tools.utils import argparse_force_lowercase_type, \
|
||||
argparse_many, columnate, args_error
|
||||
argparse_many, columnate, args_error, \
|
||||
argparse_filestring_type
|
||||
from tools.options import extract_profile
|
||||
|
||||
print_lock = Lock()
|
||||
|
||||
|
@ -72,13 +74,15 @@ class Reader (Thread) :
|
|||
|
||||
class ExportBuildTest(object):
|
||||
"""Object to encapsulate logic for progen build testing"""
|
||||
def __init__(self, tests):
|
||||
def __init__(self, tests, parser, options):
|
||||
"""
|
||||
Initialize an instance of class ProgenBuildTest
|
||||
Args:
|
||||
tests: array of TestCase instances
|
||||
"""
|
||||
self.total = len(tests)
|
||||
self.parser = parser
|
||||
self.options = options
|
||||
self.counter = 0
|
||||
self.successes = []
|
||||
self.failures = []
|
||||
|
@ -155,11 +159,13 @@ class ExportBuildTest(object):
|
|||
test_case.name))
|
||||
|
||||
try:
|
||||
_, toolchain = get_exporter_toolchain(test_case.ide)
|
||||
profile = extract_profile(self.parser, self.options, toolchain)
|
||||
exporter = export(test_case.mcu, test_case.ide,
|
||||
project_id=test_case.id, zip_proj=None,
|
||||
clean=True, src=test_case.src,
|
||||
export_path=join(EXPORT_DIR,name_str),
|
||||
silent=True)
|
||||
silent=True, build_profile=profile)
|
||||
exporter.generated_files.append(join(EXPORT_DIR,name_str,test_case.log))
|
||||
self.build_queue.put((exporter,test_case))
|
||||
except TargetNotSupportedException:
|
||||
|
@ -243,6 +249,12 @@ def main():
|
|||
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
|
||||
|
@ -273,7 +285,7 @@ def main():
|
|||
for test in v5_tests:
|
||||
default_test.update({'name':test[0],'src':[test[1],ROOT]})
|
||||
tests.append(copy(default_test))
|
||||
test = ExportBuildTest(tests)
|
||||
test = ExportBuildTest(tests, parser, options)
|
||||
test.batch_tests(clean=options.clean)
|
||||
print_results(test.successes, test.failures, test.skips)
|
||||
sys.exit(len(test.failures))
|
||||
|
|
|
@ -28,6 +28,10 @@ import json
|
|||
from collections import OrderedDict
|
||||
import logging
|
||||
|
||||
def remove_if_in(lst, thing):
|
||||
if thing in lst:
|
||||
lst.remove(thing)
|
||||
|
||||
def compile_worker(job):
|
||||
"""Standard task runner used for compiling
|
||||
|
||||
|
|
Loading…
Reference in New Issue