def test_iar_c_lib_small_exception(self): """Test that an exception is raised if the small C library is not supported for a target on the IAR toolchain.""" mock_target = mock.MagicMock() mock_target.core = "Cortex-M4" mock_target.c_lib = "small" del mock_target.default_lib mock_target.supported_c_libs = {"iar": ["std"]} mock_target.supported_toolchains = ["IAR"] with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)): IAR(mock_target)
def test_iar_minimal_printf(self): """Test that linker flags are correctly added to an instance of GCC_ARM.""" mock_target = mock.MagicMock() mock_target.core = "Cortex-M4" mock_target.printf_lib = "minimal-printf" mock_target.supported_toolchains = ["IAR"] mock_target.is_TrustZone_secure_target = False iar_obj = IAR(mock_target) var = "-DMBED_MINIMAL_PRINTF" self.assertIn("-DMBED_MINIMAL_PRINTF", iar_obj.flags["common"])
def test_iar_c_lib(self): """Test that no exception is raised when a supported c library is specified.""" mock_target = mock.MagicMock() mock_target.core = "Cortex-M4" mock_target.supported_c_libs = {"iar": ["std"]} mock_target.c_lib = "sTD" del mock_target.default_lib mock_target.supported_toolchains = ["IAR"] mock_target.is_TrustZone_secure_target = False try: IAR(mock_target) except NotSupportedException: self.fail(UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib))
def test_iar_minimal_printf(self): """Test that linker flags are correctly added to an instance of IAR.""" mock_target = mock.MagicMock() mock_target.core = "Cortex-M4" mock_target.printf_lib = "minimal-printf" mock_target.supported_toolchains = ["IAR"] del mock_target.default_lib mock_target.c_lib = "std" mock_target.supported_c_libs = {"iar": ["std"]} iar_obj = IAR(mock_target) var = "-DMBED_MINIMAL_PRINTF" self.assertIn("-DMBED_MINIMAL_PRINTF", iar_obj.flags["common"])