41
41
42
42
ALPHABET = [char for char in printable if char not in [u'.' , u'/' , u'\\ ' ]]
43
43
44
+ #Create a global test target
45
+ test_target_map = TARGET_MAP ["K64F" ]
46
+ #We have to add ARMC5,UARM here to supported_toolchains, otherwise the creation of ARM class would fail as it won't find ARMC5 entry in supported_toolchains
47
+ #We also have to add uARM, cause, ARM_MICRO class would check for both uARM and ARMC5 in supported_toolchains(as ARM_MICRO represents ARMC5+Micro).
48
+ #And do this globally here so all tests can use this
49
+ test_target_map .supported_toolchains .append ("ARMC5" )
50
+ test_target_map .supported_toolchains .append ("uARM" )
51
+
44
52
45
53
@patch ('tools.toolchains.arm.run_cmd' )
46
- def test_arm_version_check (_run_cmd ):
54
+ def test_armc5_version_check (_run_cmd ):
47
55
set_targets_json_location ()
48
56
_run_cmd .return_value = ("""
49
57
Product: ARM Compiler 5.06
50
58
Component: ARM Compiler 5.06 update 5 (build 528)
51
59
Tool: armcc [4d3621]
52
60
""" , "" , 0 )
53
61
notifier = MockNotifier ()
54
- toolchain = TOOLCHAIN_CLASSES ["ARM" ](TARGET_MAP ["K64F" ], notify = notifier )
62
+ target_map = TARGET_MAP ["K64F" ]
63
+ #We have to add ARMC5 here to supported_toolchains, otherwise the creation of ARM class would fail as it wont find ARMC5 entry in supported_toolchains
64
+ target_map .supported_toolchains .append ("ARMC5" )
65
+ toolchain = TOOLCHAIN_CLASSES ["ARM" ](target_map , notify = notifier )
55
66
toolchain .version_check ()
56
67
assert notifier .messages == []
57
68
_run_cmd .return_value = ("""
@@ -69,6 +80,20 @@ def test_arm_version_check(_run_cmd):
69
80
toolchain .version_check ()
70
81
assert len (notifier .messages ) == 1
71
82
83
+ @patch ('tools.toolchains.arm.run_cmd' )
84
+ def test_armc6_version_check (_run_cmd ):
85
+ set_targets_json_location ()
86
+ notifier = MockNotifier ()
87
+ print (TARGET_MAP ["K64F" ])
88
+ toolchain = TOOLCHAIN_CLASSES ["ARMC6" ](TARGET_MAP ["K64F" ], notify = notifier )
89
+ print (toolchain )
90
+ _run_cmd .return_value = ("""
91
+ Product: ARM Compiler 6.11 Professional
92
+ Component: ARM Compiler 6.11
93
+ Tool: armclang [5d3b4200]
94
+ """ , "" , 0 )
95
+ toolchain .version_check ()
96
+ assert notifier .messages == []
72
97
73
98
@patch ('tools.toolchains.iar.run_cmd' )
74
99
def test_iar_version_check (_run_cmd ):
@@ -141,7 +166,7 @@ def test_toolchain_profile_c(profile, source_file):
141
166
set_targets_json_location ()
142
167
with patch ('os.mkdir' ) as _mkdir :
143
168
for _ , tc_class in TOOLCHAIN_CLASSES .items ():
144
- toolchain = tc_class (TARGET_MAP [ "K64F" ] , build_profile = profile ,
169
+ toolchain = tc_class (test_target_map , build_profile = profile ,
145
170
notify = MockNotifier ())
146
171
toolchain .inc_md5 = ""
147
172
toolchain .build_dir = ""
@@ -173,7 +198,7 @@ def test_toolchain_profile_cpp(profile, source_file):
173
198
to_compile = os .path .join (* filename )
174
199
with patch ('os.mkdir' ) as _mkdir :
175
200
for _ , tc_class in TOOLCHAIN_CLASSES .items ():
176
- toolchain = tc_class (TARGET_MAP [ "K64F" ] , build_profile = profile ,
201
+ toolchain = tc_class (test_target_map , build_profile = profile ,
177
202
notify = MockNotifier ())
178
203
toolchain .inc_md5 = ""
179
204
toolchain .build_dir = ""
@@ -205,7 +230,7 @@ def test_toolchain_profile_asm(profile, source_file):
205
230
to_compile = os .path .join (* filename )
206
231
with patch ('os.mkdir' ) as _mkdir :
207
232
for _ , tc_class in TOOLCHAIN_CLASSES .items ():
208
- toolchain = tc_class (TARGET_MAP [ "K64F" ] , build_profile = profile ,
233
+ toolchain = tc_class (test_target_map , build_profile = profile ,
209
234
notify = MockNotifier ())
210
235
toolchain .inc_md5 = ""
211
236
toolchain .build_dir = ""
@@ -225,7 +250,7 @@ def test_toolchain_profile_asm(profile, source_file):
225
250
parameter )
226
251
227
252
for name , Class in TOOLCHAIN_CLASSES .items ():
228
- CLS = Class (TARGET_MAP [ "K64F" ] , notify = MockNotifier ())
253
+ CLS = Class (test_target_map , notify = MockNotifier ())
229
254
assert name == CLS .name or name == LEGACY_TOOLCHAIN_NAMES [CLS .name ]
230
255
231
256
@given (fixed_dictionaries ({
@@ -245,7 +270,7 @@ def test_toolchain_profile_ld(profile, source_file):
245
270
with patch ('os.mkdir' ) as _mkdir ,\
246
271
patch ('tools.toolchains.mbedToolchain.default_cmd' ) as _dflt_cmd :
247
272
for _ , tc_class in TOOLCHAIN_CLASSES .items ():
248
- toolchain = tc_class (TARGET_MAP [ "K64F" ] , build_profile = profile ,
273
+ toolchain = tc_class (test_target_map , build_profile = profile ,
249
274
notify = MockNotifier ())
250
275
toolchain .RESPONSE_FILES = False
251
276
toolchain .inc_md5 = ""
@@ -264,7 +289,7 @@ def test_toolchain_profile_ld(profile, source_file):
264
289
parameter )
265
290
266
291
for name , Class in TOOLCHAIN_CLASSES .items ():
267
- CLS = Class (TARGET_MAP [ "K64F" ] , notify = MockNotifier ())
292
+ CLS = Class (test_target_map , notify = MockNotifier ())
268
293
assert name == CLS .name or name == LEGACY_TOOLCHAIN_NAMES [CLS .name ]
269
294
270
295
0 commit comments