Skip to content

Commit 93e9b48

Browse files
authored
Merge pull request #2712 from bridadan/test-building-and-config
Fixing constant cleaning when compiling tests
2 parents 157fa65 + aeca796 commit 93e9b48

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

docs/testing_mbed_OS_5.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The way tests are run and compiled in mbed OS 5 is substantially different from
1010
- [Test names](#test-names)
1111
- [Building tests](#building-tests)
1212
- [Building process](#building-process)
13+
- [App config](#app-config)
1314
- [Running tests](#running-tests)
1415
- [Writing tests](#writing-tests)
1516
- [Debugging tests](#debugging-tests)
@@ -73,6 +74,12 @@ The full build process is:
7374
1. For each discovered test, build all of its source files and link it with the non-test code that was built in step 1.
7475
1. If specified, create a test specification file and place it in the given directory for use by testing tools. This is placed in the build directory by default when using mbed CLI.
7576

77+
#### App config
78+
79+
When building an mbed application, the presence of a `mbed_app.json` file allows you to set or override different config settings from libraries and targets. However, because the tests share a common build, this can cause issues when tests have different configurations that affect the OS.
80+
81+
If you need to use app config, this must be set via the `--app-config` option when calling `mbed test`. **If this option is not specified, the build system will ignore all `mbed_app.json` files and use the default config values.**
82+
7683
### Running tests
7784

7885
Automated tests can be run easily through mbed CLI. For information on using mbed CLI, please see its documentation.

tools/test.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@
121121
"Currently set search path: %s"
122122
% (toolchain, search_path))
123123

124+
# App config
125+
# Disable finding `mbed_app.json` files in the source tree if not
126+
# explicitly defined on the command line. Config system searches for
127+
# `mbed_app.json` files if `app_config` is None, but will set the
128+
# app config data to an empty dictionary if the path value is another
129+
# falsey value besides None.
130+
if options.app_config is None:
131+
options.app_config = ''
132+
124133
# Find all tests in the relevant paths
125134
for path in all_paths:
126135
all_tests.update(find_tests(path, mcu, toolchain, options.options,
@@ -184,7 +193,6 @@
184193
verbose=options.verbose,
185194
notify=notify,
186195
archive=False,
187-
remove_config_header_file=True,
188196
app_config=options.app_config)
189197

190198
library_build_success = True

0 commit comments

Comments
 (0)