Skip to content

Commit b28cffa

Browse files
committed
unittest: update arguments
1 parent aa4793e commit b28cffa

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -734,31 +734,31 @@ Use the `mbed unittest` command to build and run unit tests, or to generate file
734734

735735
Build and run unit tests with `mbed unittest`. The arguments are:
736736

737-
* `--skip-build` to skip building unit tests.
738-
* `--skip-run` to skip running unit tests.
739-
* `--clean` to clean previous build data.
737+
* `--compile` to only compile unit tests.
738+
* `--run` to only run unit tests.
739+
* `-c` or `--clean` to clean build directory.
740740
* `-d` or `--debug` to prepare debug build.
741741
* `--coverage <TYPE>` to generate code coverage report where TYPE can be "html", "xml" or "both".
742742
* `-m <NAME>` or `--make-program <NAME>` to select which make build tool to use where NAME can be "make", "gmake", "mingw32-make" or "ninja".
743743
* `-g <NAME>` or `--generator <NAME>` to select which CMake generator to use where NAME can be "Unix Makefiles", "MinGW Makefiles" or "Ninja".
744744
* `-r <EXPRESSION>` or `--regex <EXPRESSION>` to run tests matching the regular expression.
745-
* `--build-path <PATH>` to specify build path.
745+
* `--build <PATH>` to specify build directory.
746746
* `-v` or `--verbose` for verbose diagnostic output.
747747

748748
Generate files for a new unit test with `mbed unittest --new <FILE>`.
749749

750750
### Building and running unit tests
751751

752-
You can specify to only **build** the unit tests by using the `--skip-run` option:
752+
You can specify to only **build** the unit tests by using the `--compile option:
753753

754754
```
755-
$ mbed unittest --skip-run
755+
$ mbed unittest --compile
756756
```
757757

758-
You can specify to only **run** the unit tests by using the `--skip-build` option:
758+
You can specify to only **run** the unit tests by using the `--run` option:
759759

760760
```
761-
$ mbed unittest --skip-build
761+
$ mbed unittest --run
762762
```
763763

764764
If you do not specify any of these, `mbed unittest` will build all available unit tests and run them.

mbed/mbed.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3012,18 +3012,18 @@ def help_():
30123012

30133013

30143014
@subcommand('unittest',
3015-
dict(name='--skip-build', action='store_true', help='skip build step'),
3016-
dict(name='--skip-run', action='store_true', help='skip run step'),
3017-
dict(name='--clean', action='store_true', help='clean build data'),
3018-
dict(name=['-d', '--debug'], action='store_true', help='enable debug build'),
3019-
dict(name='--coverage', choices=['html', 'xml', 'both'], help='generate code coverage report'),
3020-
dict(name=['-m', '--make-program'], choices=['gmake', 'make', 'mingw32-make', 'ninja'], help='which make program to use'),
3021-
dict(name=['-g', '--generator'], choices=['Unix Makefiles', 'MinGW Makefiles', 'Ninja'], help='which CMake generator to use'),
3022-
dict(name=['-r', '--regex'], help='run tests matching regular expression'),
3023-
dict(name='--build-path', help='specify build path'),
3015+
dict(name='--compile', action='store_true', dest="compile_only", help='Only compile unit tests'),
3016+
dict(name='--run', action='store_true', dest="run_only", help='Only run unit tests'),
3017+
dict(name=['-c', '--clean'], action='store_true', help='Clean the build directory'),
3018+
dict(name=['-d', '--debug'], action='store_true', help='Enable debug build'),
3019+
dict(name='--coverage', choices=['html', 'xml', 'both'], help='Generate code coverage report'),
3020+
dict(name=['-m', '--make-program'], choices=['gmake', 'make', 'mingw32-make', 'ninja'], help='Which make program to use'),
3021+
dict(name=['-g', '--generator'], choices=['Unix Makefiles', 'MinGW Makefiles', 'Ninja'], help='Which CMake generator to use'),
3022+
dict(name=['-r', '--regex'], help='Run tests matching regular expression'),
3023+
dict(name='--build', help='Build directory. Default: mbed-os/UNITTESTS/build/'),
30243024
dict(name='--new', help='generate files for a new unit test', metavar="FILEPATH"),
30253025
help='Create, build and run unit tests')
3026-
def unittest_(skip_build=False, skip_run=False, clean=False, debug=False, coverage=None, make_program=None, generator=None, regex=None, build_path=None, new=None):
3026+
def unittest_(compile_only=False, run_only=False, clean=False, debug=False, coverage=None, make_program=None, generator=None, regex=None, build=None, new=None):
30273027
program = Program(getcwd(), False)
30283028
program.check_requirements(True)
30293029

@@ -3039,15 +3039,15 @@ def unittest_(skip_build=False, skip_run=False, clean=False, debug=False, covera
30393039

30403040
if os.path.exists(tool):
30413041
popen([python_cmd, tool]
3042-
+ (["--skip-build"] if skip_build else [])
3043-
+ (["--skip-run"] if skip_run else [])
3042+
+ (["--compile"] if compile_only else [])
3043+
+ (["--run"] if run_only else [])
30443044
+ (["--clean"] if clean else [])
30453045
+ (["--debug"] if debug else [])
30463046
+ (["--coverage", coverage] if coverage else [])
30473047
+ (["--make-program", make_program] if make_program else [])
30483048
+ (["--generator", generator] if generator else [])
30493049
+ (["--regex", regex] if regex else [])
3050-
+ (["--build-path", build_path] if build_path else [])
3050+
+ (["--build", build] if build else [])
30513051
+ (["--new", new] if new else [])
30523052
+ (["--verbose"] if verbose else [])
30533053
+ remainder,

0 commit comments

Comments
 (0)