Skip to content

Commit 19bfb0e

Browse files
committed
Added new feature: Now user can change default global name of project (test) binary to other name or by default use name chosen by the suite which is test folder name
1 parent 2031512 commit 19bfb0e

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

workspace_tools/build_api.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,15 @@ def build_project(src_path, build_path, target, toolchain_name,
4242
# multiple compilations and linking with the same objects
4343
src_paths = [src_paths[0]] + list(set(src_paths[1:]))
4444

45+
PROJECT_BASENAME = basename(src_paths[0])
46+
4547
if name is None:
46-
name = basename(src_paths[0])
47-
toolchain.info("Building project %s (%s, %s)" % (name.upper(), target.name, toolchain_name))
48+
# We will use default project name based on project folder name
49+
name = PROJECT_BASENAME
50+
toolchain.info("Building project %s (%s, %s)" % (PROJECT_BASENAME.upper(), target.name, toolchain_name))
51+
else:
52+
# User used custom global project name to have the same name for the
53+
toolchain.info("Building project %s to %s (%s, %s)" % (PROJECT_BASENAME.upper(), name, target.name, toolchain_name))
4854

4955
# Scan src_path and libraries_paths for resources
5056
resources = toolchain.scan_resources(src_paths[0])

workspace_tools/singletest.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,10 @@ def generate_test_summary(test_summary):
823823
dest='test_global_loops_value',
824824
help='Set global number of test loops per test. Default value is set 1')
825825

826+
parser.add_option('', '--firmware-name',
827+
dest='firmware_global_name',
828+
help='Set global name for all produced projects. E.g. you can call all test binaries firmware.bin')
829+
826830
parser.add_option('-v', '--verbose',
827831
dest='verbose',
828832
default=False,
@@ -964,9 +968,13 @@ def generate_test_summary(test_summary):
964968
if 'macros' in LIBRARY_MAP[lib_id] and LIBRARY_MAP[lib_id]['macros']:
965969
MACROS.extend(LIBRARY_MAP[lib_id]['macros'])
966970

971+
project_name = opts.firmware_global_name if opts.firmware_global_name else None
967972
path = build_project(test.source_dir, join(build_dir, test_id),
968-
T, toolchain, test.dependencies, options=build_project_options,
969-
clean=clean, verbose=opts.verbose,
973+
T, toolchain, test.dependencies,
974+
options=build_project_options,
975+
clean=clean,
976+
verbose=opts.verbose,
977+
name=project_name,
970978
macros=MACROS,
971979
inc_dirs=INC_DIRS)
972980

0 commit comments

Comments
 (0)