예제 #1
0
 def test_arm_c_lib_std_exception(self):
     """Test that an exception is raised if the std C library is not supported for a target on the ARM toolchain."""
     mock_target = mock.MagicMock()
     mock_target.core = "Cortex-M4"
     mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]
     mock_target.default_toolchain = "ARM"
     mock_target.c_lib = "std"
     del mock_target.default_lib
     mock_target.supported_c_libs = {"arm": ["small"]}
     with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
         ARM_STD(mock_target)
     with self.assertRaisesRegexp(NotSupportedException, UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
         ARMC6(mock_target)
예제 #2
0
 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)
예제 #3
0
 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))
예제 #4
0
 def test_gcc_arm_c_lib_small_exception(self):
     """Test that an exception is raised if the small and std C library are not supported for a target on the GCC_ARM 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 = {"gcc_arm": [""]}
     mock_target.default_toolchain = "GCC_ARM"
     mock_target.supported_toolchains = ["GCC_ARM"]
     with self.assertRaisesRegexp(
             NotSupportedException,
             UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib)):
         GCC_ARM(mock_target)
예제 #5
0
    def test_arm_small_c_lib_swap_std_lib(self):
        """Test that no exception is raised when small c lib is not supported but std lib is supported."""
        mock_target = mock.MagicMock()
        mock_target.core = "Cortex-M4"
        mock_target.c_lib = "small"
        del mock_target.default_lib
        mock_target.supported_c_libs = {"arm": ["std"]}
        mock_target.supported_toolchains = ["ARM", "uARM", "ARMC5"]

        mock_target.default_toolchain = "ARM"
        try:
            ARM_STD(mock_target)
        except NotSupportedException:
            self.fail(
                UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib))

        mock_target.default_toolchain = "ARMC6"
        try:
            ARMC6(mock_target)
        except NotSupportedException:
            self.fail(
                UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib))
예제 #6
0
 def test_gcc_arm_small_c_lib_swap_std_lib(self):
     """Test that no exception is raised when small c lib is not supported but std lib is supported."""
     mock_target = mock.MagicMock()
     mock_target.core = "Cortex-M4"
     mock_target.supported_c_libs = {"gcc_arm": ["std"]}
     mock_target.c_lib = "small"
     del mock_target.default_lib
     mock_target.supported_toolchains = ["GCC_ARM"]
     mock_target.is_TrustZone_secure_target = False
     mock_target.default_toolchain = "GCC_ARM"
     try:
         GCC_ARM(mock_target)
     except NotSupportedException:
         self.fail(
             UNSUPPORTED_C_LIB_EXCEPTION_STRING.format(mock_target.c_lib))