You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*`-m <MCU>` to select a target for the compilation.
498
497
*`-t <TOOLCHAIN>` to select a toolchain (of those defined in `mbed_settings.py`, see above), where `toolchain` can be either `ARM` (ARM Compiler 5), `GCC_ARM` (GNU ARM Embedded), or `IAR` (IAR Embedded Workbench for ARM).
499
-
*`--compile-list` to list all the tests that can be built. For example:
500
-
```
501
-
$ mbed test --compile-list
502
-
Test Case:
503
-
Name: TESTS-functional-test1
504
-
Path: .\TESTS\functional\test1
505
-
Test Case:
506
-
Name: TESTS-functional-test2
507
-
Path: .\TESTS\functional\test2
508
-
Test Case:
509
-
Name: TESTS-functional-test3
510
-
Path: .\TESTS\functional\test3
511
-
```
512
-
*`--run-list` to list all the tests that can be run (they must be built first). For example:
513
-
```
514
-
$ mbed test --run-list
515
-
mbedgt: test specification file '.\.build/tests\K64F\ARM\test_spec.json' (specified with --test-spec option)
516
-
mbedgt: using '.\.build/tests\K64F\ARM\test_spec.json' from current directory!
517
-
mbedgt: available tests for built 'K64F-ARM', location '.\.build/tests\K64F\ARM'
518
-
test 'TESTS-functional-test1'
519
-
test 'TESTS-functional-test2'
520
-
test 'TESTS-functional-test3'
521
-
```
522
-
*`--compile` to only compile the tests. For example, `$ mbed test -m K64F -t GCC_ARM --compile`.
523
-
*`--run` to only run the tests. For example, `$ mbed test -m K64F -t GCC_ARM --run`.
524
-
*`-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`.
525
-
*`--source <SOURCE>` to select the source directory. The default is `.` (the current directory). You can specify multiple source locations, even outside the program tree.
498
+
*`--compile-list` to list all the tests that can be built
499
+
*`--run-list` to list all the tests that can be ran (they must be built first)
500
+
*`--compile` to only compile the tests
501
+
*`--run` to only run the tests
502
+
*`-n <TESTS_BY_NAME>` to limit the tests built or ran to a comma separated list (ex. test1,test2,test3)
503
+
*`--source <SOURCE>` to select the source directory. Default is `.` (the current dir). You can specify multiple source locations, even outside the program tree.
526
504
*`--build <BUILD>` to select the build directory. Default: `.build/` inside your program.
527
505
*`--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
528
506
*`-c or --clean` to clean the build directory before compiling,
@@ -532,6 +510,59 @@ The arguments to `test` are:
532
510
533
511
The compiled binaries and test artifacts can be found in the `.build/tests/<TARGET>/<TOOLCHAIN>` directory of your program.
534
512
513
+
#### Finding available tests
514
+
515
+
You can find the tests that are available for **building** by using the `--compile-list` option:
516
+
517
+
```
518
+
$ mbed test --compile-list
519
+
Test Case:
520
+
Name: TESTS-functional-test1
521
+
Path: .\TESTS\functional\test1
522
+
Test Case:
523
+
Name: TESTS-functional-test2
524
+
Path: .\TESTS\functional\test2
525
+
Test Case:
526
+
Name: TESTS-functional-test3
527
+
Path: .\TESTS\functional\test3
528
+
```
529
+
530
+
You can find the tests that are available for **running** by using the `--run-list` option:
531
+
532
+
```
533
+
$ mbed test --run-list
534
+
mbedgt: test specification file '.\.build/tests\K64F\ARM\test_spec.json' (specified with --test-spec option)
535
+
mbedgt: using '.\.build/tests\K64F\ARM\test_spec.json' from current directory!
536
+
mbedgt: available tests for built 'K64F-ARM', location '.\.build/tests\K64F\ARM'
537
+
test 'TESTS-functional-test1'
538
+
test 'TESTS-functional-test2'
539
+
test 'TESTS-functional-test3'
540
+
```
541
+
542
+
#### Compiling and running tests
543
+
544
+
You can specify to only **build** the tests by using the `--compile` option:
545
+
546
+
```
547
+
$ mbed test -m K64F -t GCC_ARM --compile
548
+
```
549
+
550
+
You can specify to only **run** the tests by using the `--run` option:
551
+
552
+
```
553
+
$ mbed test -m K64F -t GCC_ARM --run
554
+
```
555
+
556
+
If you don't specify any of these `mbed test` will first compile all available tests and then run them.
557
+
558
+
#### Limiting the test scope
559
+
560
+
You can limit the scope of the tests built and ran by using the `-n` option. This takes a comma separated list of test names as an argument:
561
+
562
+
```
563
+
$ mbed test -m K64F -t GCC_ARM -n TESTS-functional-test1,TESTS-functional-test2
564
+
```
565
+
535
566
### Test directory structure
536
567
537
568
Test code exists in the following directory structure:
0 commit comments