Skip to content

Commit 2497c8f

Browse files
committed
test.py now requires -m and -t options
1 parent d4e5f2e commit 2497c8f

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

tools/test.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from tools.build_api import build_project, build_library
3232
from tools.build_api import print_build_memory_usage_results
3333
from tools.targets import TARGET_MAP
34-
from tools.utils import mkdir, ToolException, NotSupportedException
34+
from tools.utils import mkdir, ToolException, NotSupportedException, args_error
3535
from tools.test_exporters import ReportExporter, ResultExporterType
3636
from utils import argparse_filestring_type, argparse_lowercase_type, argparse_many
3737
from tools.toolchains import mbedToolchain
@@ -95,6 +95,16 @@
9595

9696
options = parser.parse_args()
9797

98+
if not options.mcu:
99+
args_error(parser, "[ERROR] You should specify an MCU")
100+
101+
mcu = options.mcu[0]
102+
103+
if not options.tool:
104+
args_error(parser, "[ERROR] You should specify a TOOLCHAIN")
105+
106+
toolchain = options.tool[0]
107+
98108
# Filter tests by path if specified
99109
if options.paths:
100110
all_paths = options.paths
@@ -106,8 +116,8 @@
106116

107117
# Find all tests in the relevant paths
108118
for path in all_paths:
109-
all_tests.update(find_tests(path, options.mcu, options.tool, options.options))
110-
119+
all_tests.update(find_tests(path, mcu, toolchain, options.options))
120+
111121
# Filter tests by name if specified
112122
if options.names:
113123
all_names = options.names
@@ -150,16 +160,13 @@
150160
if not base_source_paths:
151161
base_source_paths = ['.']
152162

153-
154-
target = options.mcu[0]
155-
156163
build_report = {}
157164
build_properties = {}
158165

159166
library_build_success = False
160167
try:
161168
# Build sources
162-
build_library(base_source_paths, options.build_dir, target, options.tool[0],
169+
build_library(base_source_paths, options.build_dir, mcu, toolchain,
163170
options=options.options,
164171
jobs=options.jobs,
165172
clean=options.clean,
@@ -186,7 +193,7 @@
186193
print "Failed to build library"
187194
else:
188195
# Build all the tests
189-
test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, target, options.tool[0],
196+
test_build_success, test_build = build_tests(tests, [options.build_dir], options.build_dir, mcu, toolchain,
190197
options=options.options,
191198
clean=options.clean,
192199
report=build_report,

tools/test_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,6 @@ def get_default_test_options_parser():
19741974
help='Prints script version and exits')
19751975
return parser
19761976

1977-
19781977
def test_path_to_name(path):
19791978
"""Change all slashes in a path into hyphens
19801979
This creates a unique cross-platform test name based on the path

0 commit comments

Comments
 (0)