8
8
9
9
from mbed_tools .project import MbedProgram
10
10
from mbed_tools .build import generate_config
11
+ from mbed_tools .build .config import CMAKE_CONFIG_FILE
11
12
from mbed_tools .lib .exceptions import ToolsError
12
13
13
14
@@ -84,7 +85,7 @@ def test_target_and_toolchain_collected(program):
84
85
85
86
generate_config (target , toolchain , program )
86
87
87
- config_text = program .files .cmake_config_file .read_text ()
88
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
88
89
89
90
assert target in config_text
90
91
assert toolchain in config_text
@@ -97,7 +98,7 @@ def test_custom_targets_data_found(program):
97
98
98
99
generate_config (target , toolchain , program )
99
100
100
- config_text = program .files .cmake_config_file .read_text ()
101
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
101
102
102
103
assert target in config_text
103
104
@@ -125,7 +126,7 @@ def test_config_param_from_lib_processed_with_default_name_mangling(program):
125
126
126
127
generate_config ("K64F" , "GCC_ARM" , program )
127
128
128
- config_text = program .files .cmake_config_file .read_text ()
129
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
129
130
130
131
assert "MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES" in config_text
131
132
@@ -145,7 +146,7 @@ def test_config_param_from_lib_processed_with_user_set_name(program):
145
146
146
147
generate_config ("K64F" , "GCC_ARM" , program )
147
148
148
- config_text = program .files .cmake_config_file .read_text ()
149
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
149
150
150
151
assert "ENABLE_NEWLINES" in config_text
151
152
@@ -163,15 +164,15 @@ def test_config_param_from_app_processed_with_default_name_mangling(program):
163
164
164
165
generate_config ("K64F" , "GCC_ARM" , program )
165
166
166
- config_text = program .files .cmake_config_file .read_text ()
167
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
167
168
168
169
assert "MBED_CONF_APP_STDIO_CONVERT_NEWLINES" in config_text
169
170
170
171
171
172
def test_config_param_from_target_processed_with_default_name_mangling (program ):
172
173
generate_config ("K64F" , "GCC_ARM" , program )
173
174
174
- config_text = program .files .cmake_config_file .read_text ()
175
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
175
176
176
177
assert "MBED_CONF_TARGET_XIP_ENABLE=0" in config_text
177
178
@@ -186,7 +187,7 @@ def test_macros_from_lib_collected(macros, program):
186
187
187
188
generate_config ("K64F" , "GCC_ARM" , program )
188
189
189
- config_text = program .files .cmake_config_file .read_text ()
190
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
190
191
191
192
for macro in macros :
192
193
assert macro in config_text
@@ -202,7 +203,7 @@ def test_macros_from_app_collected(macros, program):
202
203
203
204
generate_config ("K64F" , "GCC_ARM" , program )
204
205
205
- config_text = program .files .cmake_config_file .read_text ()
206
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
206
207
207
208
for macro in macros :
208
209
assert macro in config_text
@@ -211,7 +212,7 @@ def test_macros_from_app_collected(macros, program):
211
212
def test_macros_from_target_collected (program ):
212
213
generate_config ("K64F" , "GCC_ARM" , program )
213
214
214
- config_text = program .files .cmake_config_file .read_text ()
215
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
215
216
216
217
for macro in TARGET_DATA ["macros" ]:
217
218
assert macro in config_text
@@ -220,7 +221,7 @@ def test_macros_from_target_collected(program):
220
221
def test_target_labels_collected_as_defines (program ):
221
222
generate_config ("K64F" , "GCC_ARM" , program )
222
223
223
- config_text = program .files .cmake_config_file .read_text ()
224
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
224
225
225
226
for label in TARGET_DATA ["labels" ] + TARGET_DATA ["extra_labels" ]:
226
227
assert f"TARGET_{ label } " in config_text
@@ -247,7 +248,7 @@ def test_overrides_lib_config_param_from_app(matching_target_and_filter, program
247
248
create_mbed_app_json (program .root , target_overrides = {target_filter : {"platform.stdio-baud-rate" : 115200 }})
248
249
generate_config (target , "GCC_ARM" , program )
249
250
250
- config_text = program .files .cmake_config_file .read_text ()
251
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
251
252
252
253
assert "MBED_CONF_PLATFORM_STDIO_BAUD_RATE=115200" in config_text
253
254
@@ -258,7 +259,7 @@ def test_overrides_target_config_param_from_app(matching_target_and_filter, prog
258
259
259
260
generate_config (target , "GCC_ARM" , program )
260
261
261
- config_text = program .files .cmake_config_file .read_text ()
262
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
262
263
263
264
assert "MBED_CONF_TARGET_XIP_ENABLE=1" in config_text
264
265
@@ -284,7 +285,7 @@ def test_overrides_target_non_config_params_from_app(
284
285
285
286
generate_config (target , "GCC_ARM" , program )
286
287
287
- config_text = program .files .cmake_config_file .read_text ()
288
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
288
289
289
290
assert expected_output in config_text
290
291
@@ -299,7 +300,7 @@ def test_overrides_target_config_param_from_lib(matching_target_and_filter, prog
299
300
300
301
generate_config (target , "GCC_ARM" , program )
301
302
302
- config_text = program .files .cmake_config_file .read_text ()
303
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
303
304
304
305
assert "MBED_CONF_TARGET_XIP_ENABLE=1" in config_text
305
306
@@ -315,7 +316,7 @@ def test_overrides_lib_config_param_from_same_lib(matching_target_and_filter, pr
315
316
316
317
generate_config (target , "GCC_ARM" , program )
317
318
318
- config_text = program .files .cmake_config_file .read_text ()
319
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
319
320
320
321
assert "MBED_CONF_PLATFORM_STDIO_BAUD_RATE=115200" in config_text
321
322
@@ -354,7 +355,7 @@ def test_target_list_params_can_be_added_to(
354
355
355
356
generate_config (target , "GCC_ARM" , program )
356
357
357
- config_text = program .files .cmake_config_file .read_text ()
358
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
358
359
359
360
for expected in expected_output :
360
361
assert expected in config_text
@@ -379,7 +380,7 @@ def test_target_list_params_can_be_removed(
379
380
380
381
generate_config (target , "GCC_ARM" , program )
381
382
382
- config_text = program .files .cmake_config_file .read_text ()
383
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
383
384
384
385
assert expected_output not in config_text
385
386
@@ -407,7 +408,7 @@ def test_settings_from_multiple_libs_included(matching_target_and_filter, progra
407
408
408
409
generate_config (target , "GCC_ARM" , program )
409
410
410
- config_text = program .files .cmake_config_file .read_text ()
411
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
411
412
412
413
assert "MBED_CONF_PLATFORM_STDIO_BAUD_RATE=9600" in config_text
413
414
assert "MBED_LFS_READ_SIZE=64" in config_text
@@ -427,7 +428,7 @@ def test_requires_config_option(program):
427
428
428
429
generate_config ("K64F" , "GCC_ARM" , program )
429
430
430
- config_text = program .files .cmake_config_file .read_text ()
431
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
431
432
432
433
assert "MBED_CONF_PLATFORM_STDIO_BAUD_RATE=9600" in config_text
433
434
assert "MBED_LFS_READ_SIZE=64" not in config_text
@@ -451,7 +452,7 @@ def test_target_requires_config_option(program):
451
452
452
453
generate_config ("K64F" , "GCC_ARM" , program )
453
454
454
- config_text = program .files .cmake_config_file .read_text ()
455
+ config_text = ( program .files .cmake_build_dir / CMAKE_CONFIG_FILE ) .read_text ()
455
456
456
457
assert "MBED_CONF_PLATFORM_STDIO_BAUD_RATE=9600" in config_text
457
458
assert "MBED_LFS_READ_SIZE=64" not in config_text
0 commit comments