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 os.path import splitext, basename, join
|
||||||
from random import randint
|
from random import randint
|
||||||
from tools.utils import mkdir
|
from tools.utils import mkdir
|
||||||
from targets import Target
|
|
||||||
|
|
||||||
|
|
||||||
class Sw4STM32(Exporter):
|
class Sw4STM32(Exporter):
|
||||||
|
@ -80,7 +79,7 @@ class Sw4STM32(Exporter):
|
||||||
def generate(self):
|
def generate(self):
|
||||||
fp_hardware = "no"
|
fp_hardware = "no"
|
||||||
fp_abi = "soft"
|
fp_abi = "soft"
|
||||||
core = Target.get_target(self.target).core
|
core = self.target.core
|
||||||
if core == "Cortex-M4F" or core == "Cortex-M7F":
|
if core == "Cortex-M4F" or core == "Cortex-M7F":
|
||||||
fp_hardware = "fpv4-sp-d16"
|
fp_hardware = "fpv4-sp-d16"
|
||||||
fp_abi = "soft-fp"
|
fp_abi = "soft-fp"
|
||||||
|
|
|
@ -19,6 +19,7 @@ from project_generator_definitions.definitions import ProGenDef
|
||||||
|
|
||||||
from tools.export.exporters import Exporter, ExporterTargetsProperty
|
from tools.export.exporters import Exporter, ExporterTargetsProperty
|
||||||
from tools.targets import TARGET_MAP, TARGET_NAMES
|
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
|
# 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' ``)
|
# 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['c_flags']
|
||||||
+ self.flags['cxx_flags']))
|
+ self.flags['cxx_flags']))
|
||||||
# not compatible with c99 flag set in the template
|
# 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
|
# 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
|
# 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['misc']['ld_flags'] = self.flags['ld_flags']
|
||||||
|
|
||||||
project_data['build_dir'] = project_data['build_dir'] + '\\' + 'uvision4'
|
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.export.exporters import Exporter, ExporterTargetsProperty
|
||||||
from tools.targets import TARGET_MAP, TARGET_NAMES
|
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
|
# 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' ``)
|
# 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['c_flags']
|
||||||
+ self.flags['cxx_flags']))
|
+ self.flags['cxx_flags']))
|
||||||
# not compatible with c99 flag set in the template
|
# 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
|
# 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
|
# 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']
|
project_data['misc']['ld_flags'] = self.flags['ld_flags']
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
|
|
|
@ -10,7 +10,7 @@ from shutil import move, rmtree
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from os.path import normpath, realpath
|
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.export import EXPORTERS, mcu_ide_matrix
|
||||||
from tools.tests import TESTS, TEST_MAP
|
from tools.tests import TESTS, TEST_MAP
|
||||||
from tools.tests import test_known, test_name_known, Test
|
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_filestring_type, argparse_many, args_error
|
||||||
from tools.utils import argparse_force_lowercase_type
|
from tools.utils import argparse_force_lowercase_type
|
||||||
from tools.utils import argparse_force_uppercase_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
|
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
|
# Substitute the mbed library builds with their sources
|
||||||
if MBED_LIBRARIES in test.dependencies:
|
if MBED_LIBRARIES in test.dependencies:
|
||||||
test.dependencies.remove(MBED_LIBRARIES)
|
test.dependencies.remove(MBED_LIBRARIES)
|
||||||
test.dependencies.append(MBED_BASE)
|
test.dependencies.append(MBED_HAL)
|
||||||
|
|
||||||
|
|
||||||
src_paths = [test.source_dir]
|
src_paths = [test.source_dir]
|
||||||
lib_paths = test.dependencies
|
lib_paths = test.dependencies
|
||||||
|
|
|
@ -36,12 +36,14 @@ from tools.test_api import find_tests
|
||||||
from tools.project import export
|
from tools.project import export
|
||||||
from Queue import Queue
|
from Queue import Queue
|
||||||
from threading import Thread, Lock
|
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.tests import test_name_known, test_known, Test
|
||||||
from tools.export.exporters import FailedBuildException, \
|
from tools.export.exporters import FailedBuildException, \
|
||||||
TargetNotSupportedException
|
TargetNotSupportedException
|
||||||
from tools.utils import argparse_force_lowercase_type, \
|
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()
|
print_lock = Lock()
|
||||||
|
|
||||||
|
@ -72,13 +74,15 @@ class Reader (Thread) :
|
||||||
|
|
||||||
class ExportBuildTest(object):
|
class ExportBuildTest(object):
|
||||||
"""Object to encapsulate logic for progen build testing"""
|
"""Object to encapsulate logic for progen build testing"""
|
||||||
def __init__(self, tests):
|
def __init__(self, tests, parser, options):
|
||||||
"""
|
"""
|
||||||
Initialize an instance of class ProgenBuildTest
|
Initialize an instance of class ProgenBuildTest
|
||||||
Args:
|
Args:
|
||||||
tests: array of TestCase instances
|
tests: array of TestCase instances
|
||||||
"""
|
"""
|
||||||
self.total = len(tests)
|
self.total = len(tests)
|
||||||
|
self.parser = parser
|
||||||
|
self.options = options
|
||||||
self.counter = 0
|
self.counter = 0
|
||||||
self.successes = []
|
self.successes = []
|
||||||
self.failures = []
|
self.failures = []
|
||||||
|
@ -155,11 +159,13 @@ class ExportBuildTest(object):
|
||||||
test_case.name))
|
test_case.name))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
_, toolchain = get_exporter_toolchain(test_case.ide)
|
||||||
|
profile = extract_profile(self.parser, self.options, toolchain)
|
||||||
exporter = export(test_case.mcu, test_case.ide,
|
exporter = export(test_case.mcu, test_case.ide,
|
||||||
project_id=test_case.id, zip_proj=None,
|
project_id=test_case.id, zip_proj=None,
|
||||||
clean=True, src=test_case.src,
|
clean=True, src=test_case.src,
|
||||||
export_path=join(EXPORT_DIR,name_str),
|
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))
|
exporter.generated_files.append(join(EXPORT_DIR,name_str,test_case.log))
|
||||||
self.build_queue.put((exporter,test_case))
|
self.build_queue.put((exporter,test_case))
|
||||||
except TargetNotSupportedException:
|
except TargetNotSupportedException:
|
||||||
|
@ -243,6 +249,12 @@ def main():
|
||||||
help="Which version of mbed to test",
|
help="Which version of mbed to test",
|
||||||
default=RELEASE_VERSIONS[-1])
|
default=RELEASE_VERSIONS[-1])
|
||||||
|
|
||||||
|
parser.add_argument("--profile",
|
||||||
|
dest="profile",
|
||||||
|
action="append",
|
||||||
|
type=argparse_filestring_type,
|
||||||
|
default=[])
|
||||||
|
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
# targets in chosen release
|
# targets in chosen release
|
||||||
targetnames = [target[0] for target in
|
targetnames = [target[0] for target in
|
||||||
|
@ -273,7 +285,7 @@ def main():
|
||||||
for test in v5_tests:
|
for test in v5_tests:
|
||||||
default_test.update({'name':test[0],'src':[test[1],ROOT]})
|
default_test.update({'name':test[0],'src':[test[1],ROOT]})
|
||||||
tests.append(copy(default_test))
|
tests.append(copy(default_test))
|
||||||
test = ExportBuildTest(tests)
|
test = ExportBuildTest(tests, parser, options)
|
||||||
test.batch_tests(clean=options.clean)
|
test.batch_tests(clean=options.clean)
|
||||||
print_results(test.successes, test.failures, test.skips)
|
print_results(test.successes, test.failures, test.skips)
|
||||||
sys.exit(len(test.failures))
|
sys.exit(len(test.failures))
|
||||||
|
|
|
@ -28,6 +28,10 @@ import json
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
def remove_if_in(lst, thing):
|
||||||
|
if thing in lst:
|
||||||
|
lst.remove(thing)
|
||||||
|
|
||||||
def compile_worker(job):
|
def compile_worker(job):
|
||||||
"""Standard task runner used for compiling
|
"""Standard task runner used for compiling
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue