36
36
subprocess_output = None
37
37
subprocess_err = None
38
38
39
+ MAKE_PY_LOCATTION = os .path .join (ROOT , 'tools' , 'make.py' )
40
+ TEST_PY_LOCATTION = os .path .join (ROOT , 'tools' , 'test.py' )
39
41
TFM_MBED_APP = os .path .join (ROOT , 'tools' , 'psa' , 'tfm' , 'mbed_app.json' )
40
42
MBED_PSA_TESTS = '*psa-spm*,*psa-crypto_access_control'
41
43
TFM_TESTS = {
@@ -97,7 +99,7 @@ def _get_default_image_build_command(target, toolchain, profile):
97
99
:return: Build command in a list form.
98
100
"""
99
101
cmd = [
100
- 'mbed' , 'compile' ,
102
+ sys . executable , MAKE_PY_LOCATTION ,
101
103
'-t' , toolchain ,
102
104
'-m' , target ,
103
105
'--profile' , profile ,
@@ -154,30 +156,26 @@ def build_tests_mbed_spm_platform(target, toolchain, profile):
154
156
MBED_PSA_TESTS , target , toolchain , profile ))
155
157
156
158
subprocess .check_call ([
157
- 'mbed' , 'test' , '--compile' ,
159
+ sys .executable , TEST_PY_LOCATTION ,
160
+ '--greentea' ,
161
+ '--profile' , profile ,
158
162
'-t' , toolchain ,
159
163
'-m' , target ,
160
- '--profile' , profile ,
161
164
'--source' , ROOT ,
162
165
'--build' , os .path .join (ROOT , 'BUILD' , 'tests' , target ),
163
- '-n' , MBED_PSA_TESTS ],
164
- stdout = subprocess_output , stderr = subprocess_err )
166
+ '--test-spec' , os .path .join (ROOT , 'BUILD' , 'tests' ,
167
+ target , 'test_spec.json' ),
168
+ '--build-data' , os .path .join (ROOT , 'BUILD' , 'tests' ,
169
+ target , 'build_data.json' ),
170
+ '-n' , MBED_PSA_TESTS
171
+ ], stdout = subprocess_output , stderr = subprocess_err )
172
+
165
173
166
174
logger .info (
167
175
"Finished building tests images({}) for {} successfully" .format (
168
176
MBED_PSA_TESTS , target ))
169
177
170
178
171
- def _tfm_test_defines (test ):
172
- """
173
- Creates a define list to enable test partitions on TF-M.
174
-
175
- :param test: Test name.
176
- :return: List of defines with a leading -D.
177
- """
178
- return ['-D{}' .format (define ) for define in TFM_TESTS [test ]]
179
-
180
-
181
179
def build_tests_tfm_platform (target , toolchain , profile ):
182
180
"""
183
181
Builds Secure images for TF-M target.
@@ -190,15 +188,22 @@ def build_tests_tfm_platform(target, toolchain, profile):
190
188
logger .info (
191
189
"Building tests image({}) for {} using {} with {} profile" .format (
192
190
test , target , toolchain , profile ))
191
+
192
+ test_defines = ['-D{}' .format (define ) for define in TFM_TESTS [test ]]
193
193
subprocess .check_call ([
194
- 'mbed' , 'test' , '--compile' ,
195
- '-t' , toolchain ,
196
- '-m' , target ,
197
- '--profile' , profile ,
198
- '--source' , ROOT ,
199
- '--build' , os .path .join (ROOT , 'BUILD' , 'tests' , target ),
200
- '-n' , test ,
201
- '--app-config' , TFM_MBED_APP ] + _tfm_test_defines (test ),
194
+ sys .executable , TEST_PY_LOCATTION ,
195
+ '--greentea' ,
196
+ '--profile' , profile ,
197
+ '-t' , toolchain ,
198
+ '-m' , target ,
199
+ '--source' , ROOT ,
200
+ '--build' , os .path .join (ROOT , 'BUILD' , 'tests' , target ),
201
+ '--test-spec' , os .path .join (ROOT , 'BUILD' , 'tests' ,
202
+ target , 'test_spec.json' ),
203
+ '--build-data' , os .path .join (ROOT , 'BUILD' , 'tests' ,
204
+ target , 'build_data.json' ),
205
+ '-n' , test ,
206
+ '--app-config' , TFM_MBED_APP ] + test_defines ,
202
207
stdout = subprocess_output , stderr = subprocess_err )
203
208
204
209
logger .info (
0 commit comments