@@ -83,12 +83,12 @@ def test_arm_c_lib_std_exception(self):
83
83
84
84
85
85
def test_arm_c_lib_small_exception (self ):
86
- """Test that an exception is raised if the small C library is not supported for a target on the ARM toolchain."""
86
+ """Test that an exception is raised if the small and std C library are not supported for a target on the ARM toolchain."""
87
87
mock_target = mock .MagicMock ()
88
88
mock_target .core = "Cortex-M4"
89
89
mock_target .c_lib = "small"
90
90
del mock_target .default_lib
91
- mock_target .supported_c_libs = {"arm" : ["std " ]}
91
+ mock_target .supported_c_libs = {"arm" : ["" ]}
92
92
mock_target .default_toolchain = "ARM"
93
93
mock_target .supported_toolchains = ["ARM" , "uARM" , "ARMC5" ]
94
94
with self .assertRaisesRegexp (NotSupportedException , UNSUPPORTED_C_LIB_EXCEPTION_STRING .format (mock_target .c_lib )):
@@ -97,6 +97,27 @@ def test_arm_c_lib_small_exception(self):
97
97
with self .assertRaisesRegexp (NotSupportedException , UNSUPPORTED_C_LIB_EXCEPTION_STRING .format (mock_target .c_lib )):
98
98
ARMC6 (mock_target )
99
99
100
+ def test_arm_small_c_lib_swap_std_lib (self ):
101
+ """Test that no exception is raised when small c lib is not supported but std lib is supported."""
102
+ mock_target = mock .MagicMock ()
103
+ mock_target .core = "Cortex-M4"
104
+ mock_target .c_lib = "small"
105
+ del mock_target .default_lib
106
+ mock_target .supported_c_libs = {"arm" : ["std" ]}
107
+ mock_target .supported_toolchains = ["ARM" , "uARM" , "ARMC5" ]
108
+
109
+ mock_target .default_toolchain = "ARM"
110
+ try :
111
+ ARM_STD (mock_target )
112
+ except NotSupportedException :
113
+ self .fail (UNSUPPORTED_C_LIB_EXCEPTION_STRING .format (mock_target .c_lib ))
114
+
115
+ mock_target .default_toolchain = "ARMC6"
116
+ try :
117
+ ARMC6 (mock_target )
118
+ except NotSupportedException :
119
+ self .fail (UNSUPPORTED_C_LIB_EXCEPTION_STRING .format (mock_target .c_lib ))
120
+
100
121
class TestGccToolchain (TestCase ):
101
122
"""Test the GCC class."""
102
123
@@ -147,25 +168,39 @@ def test_gcc_arm_c_lib_std_exception(self):
147
168
"""Test that an exception is raised if the std C library is not supported for a target on the GCC_ARM toolchain."""
148
169
mock_target = mock .MagicMock ()
149
170
mock_target .core = "Cortex-M4"
150
- mock_target .default_toolchain = "ARM "
171
+ mock_target .default_toolchain = "GCC_ARM "
151
172
mock_target .c_lib = "std"
152
173
del mock_target .default_lib
153
- mock_target .supported_c_libs = {"arm " : ["small" ]}
174
+ mock_target .supported_c_libs = {"gcc_arm " : ["small" ]}
154
175
with self .assertRaisesRegexp (NotSupportedException , UNSUPPORTED_C_LIB_EXCEPTION_STRING .format (mock_target .c_lib )):
155
176
GCC_ARM (mock_target )
156
177
157
178
def test_gcc_arm_c_lib_small_exception (self ):
158
- """Test that an exception is raised if the small C library is not supported for a target on the GCC_ARM toolchain."""
179
+ """Test that an exception is raised if the small and std C library are not supported for a target on the GCC_ARM toolchain."""
159
180
mock_target = mock .MagicMock ()
160
181
mock_target .core = "Cortex-M4"
161
182
mock_target .c_lib = "small"
162
183
del mock_target .default_lib
163
- mock_target .supported_c_libs = {"arm " : ["std " ]}
164
- mock_target .default_toolchain = "ARM "
165
- mock_target .supported_toolchains = ["ARM" , "uARM" , "ARMC5 " ]
184
+ mock_target .supported_c_libs = {"gcc_arm " : ["" ]}
185
+ mock_target .default_toolchain = "GCC_ARM "
186
+ mock_target .supported_toolchains = ["GCC_ARM " ]
166
187
with self .assertRaisesRegexp (NotSupportedException , UNSUPPORTED_C_LIB_EXCEPTION_STRING .format (mock_target .c_lib )):
167
188
GCC_ARM (mock_target )
168
189
190
+ def test_gcc_arm_small_c_lib_swap_std_lib (self ):
191
+ """Test that no exception is raised when small c lib is not supported but std lib is supported."""
192
+ mock_target = mock .MagicMock ()
193
+ mock_target .core = "Cortex-M4"
194
+ mock_target .supported_c_libs = {"gcc_arm" : ["std" ]}
195
+ mock_target .c_lib = "small"
196
+ del mock_target .default_lib
197
+ mock_target .supported_toolchains = ["GCC_ARM" ]
198
+ mock_target .is_TrustZone_secure_target = False
199
+ mock_target .default_toolchain = "GCC_ARM"
200
+ try :
201
+ GCC_ARM (mock_target )
202
+ except NotSupportedException :
203
+ self .fail (UNSUPPORTED_C_LIB_EXCEPTION_STRING .format (mock_target .c_lib ))
169
204
class TestIarToolchain (TestCase ):
170
205
"""Test the IAR class."""
171
206
@@ -210,12 +245,26 @@ def test_iar_c_lib_std_exception(self):
210
245
IAR (mock_target )
211
246
212
247
def test_iar_c_lib_small_exception (self ):
213
- """Test that an exception is raised if the small C library is not supported for a target on the IAR toolchain."""
248
+ """Test that an exception is raised if the small and std C library are not supported for a target on the IAR toolchain."""
214
249
mock_target = mock .MagicMock ()
215
250
mock_target .core = "Cortex-M4"
216
251
mock_target .c_lib = "small"
217
252
del mock_target .default_lib
218
- mock_target .supported_c_libs = {"iar" : ["std " ]}
253
+ mock_target .supported_c_libs = {"iar" : ["" ]}
219
254
mock_target .supported_toolchains = ["IAR" ]
220
255
with self .assertRaisesRegexp (NotSupportedException , UNSUPPORTED_C_LIB_EXCEPTION_STRING .format (mock_target .c_lib )):
221
256
IAR (mock_target )
257
+
258
+ def test_iar_small_c_lib_swap_std_lib (self ):
259
+ """Test that no exception is raised when small c lib is not supported but std lib is supported."""
260
+ mock_target = mock .MagicMock ()
261
+ mock_target .core = "Cortex-M4"
262
+ mock_target .supported_c_libs = {"iar" : ["std" ]}
263
+ mock_target .c_lib = "small"
264
+ del mock_target .default_lib
265
+ mock_target .supported_toolchains = ["IAR" ]
266
+ mock_target .is_TrustZone_secure_target = False
267
+ try :
268
+ IAR (mock_target )
269
+ except NotSupportedException :
270
+ self .fail (UNSUPPORTED_C_LIB_EXCEPTION_STRING .format (mock_target .c_lib ))
0 commit comments