Skip to content

Commit bf47d92

Browse files
authored
Merge pull request #311 from bridadan/adding-build-options-to-test
Adding -o option to 'mbed test'
2 parents ce67993 + 1001513 commit bf47d92

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,8 @@ The arguments to `test` are:
482482
* `--run` to only run the tests. For example, `$ mbed test -m K64F -t GCC_ARM --run`.
483483
* `-n <TESTS_BY_NAME>` to limit the tests built or run to those listed (by name) in a comma separated list. For example, `$ mbed test -m K64F -t GCC_ARM -n TESTS-functional-test1,TESTS-functional-test2`.
484484
* `--source <SOURCE>` to select the source directory. The default is `.` (the current directory). You can specify multiple source locations, even outside the program tree.
485-
* `--build <BUILD>` to select the build directory. Default: `.build/ inside your program.
485+
* `--build <BUILD>` to select the build directory. Default: `.build/` inside your program.
486+
* `--options <OPTIONS>` to select compile options. Examples: "debug-info": will generate debugging information; "small-build" will use microlib/nanolib, but limit RTOS to single thread; "save-asm": will save the asm generated by the compiler
486487
* `-c or --clean` to clean the build directory before compiling,
487488
* `--test-spec <TEST_SPEC>` to set the path for the test spec file used when building and running tests (the default path is the build directory).
488489
* `-v` or `--verbose` for verbose diagnostic output.

mbed/mbed.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2018,11 +2018,12 @@ def compile_(toolchain=None, mcu=None, source=False, build=False, compile_librar
20182018
dict(name=['-n', '--tests-by-name'], dest='tests_by_name', help='Limit the tests to a list (ex. test1,test2,test3)'),
20192019
dict(name='--source', action='append', help='Source directory. Default: . (current dir)'),
20202020
dict(name='--build', help='Build directory. Default: .build/'),
2021+
dict(name=['-o', '--options'], action='append', help='Compile options. Examples: "debug-info": generate debugging information; "small-build" to use microlib/nanolib, but limit RTOS to single thread; "save-asm": save the asm generated by the compiler'),
20212022
dict(name=['-c', '--clean'], action='store_true', help='Clean the build directory before compiling'),
20222023
dict(name='--test-spec', dest="test_spec", help="Path used for the test spec file used when building and running tests (the default path is the build directory)"),
20232024
help='Find, build and run tests',
20242025
description=("Find, build, and run tests in a program and libraries"))
2025-
def test_(toolchain=None, mcu=None, compile_list=False, run_list=False, compile_only=False, run_only=False, tests_by_name=None, source=False, build=False, clean=False, test_spec=None):
2026+
def test_(toolchain=None, mcu=None, compile_list=False, run_list=False, compile_only=False, run_only=False, tests_by_name=None, source=False, options=False, build=False, clean=False, test_spec=None):
20262027
# Gather remaining arguments
20272028
args = remainder
20282029
# Find the root of the program
@@ -2058,7 +2059,9 @@ def test_(toolchain=None, mcu=None, compile_list=False, run_list=False, compile_
20582059

20592060
if compile_list:
20602061
popen(['python', '-u', os.path.join(tools_dir, 'test.py'), '--list']
2062+
+ list(chain.from_iterable(izip(repeat('-o'), options or [])))
20612063
+ ['-t', tchain, '-m', target]
2064+
+ list(chain.from_iterable(izip(repeat('--source'), source)))
20622065
+ (['-n', tests_by_name] if tests_by_name else [])
20632066
+ (['-v'] if verbose else [])
20642067
+ args,
@@ -2067,6 +2070,7 @@ def test_(toolchain=None, mcu=None, compile_list=False, run_list=False, compile_
20672070
if compile_only or build_and_run_tests:
20682071
popen(['python', '-u', os.path.join(tools_dir, 'test.py')]
20692072
+ list(chain.from_iterable(izip(repeat('-D'), macros)))
2073+
+ list(chain.from_iterable(izip(repeat('-o'), options or [])))
20702074
+ ['-t', tchain, '-m', target]
20712075
+ (['-c'] if clean else [])
20722076
+ list(chain.from_iterable(izip(repeat('--source'), source)))

0 commit comments

Comments
 (0)