firmware: remove the duplicate test_exception_id_sync

This commit is contained in:
abdul124 2024-08-30 16:54:07 +08:00 committed by Sébastien Bourdeauducq
parent 99f76a7595
commit 2b3cfa9f8d

View File

@ -388,29 +388,3 @@ pub extern "C-unwind" fn test_exception_id_sync(exn_id: u32) {
}; };
unsafe { raise(&exn) }; unsafe { raise(&exn) };
} }
/// Takes as input exception id from host
/// Generates a new exception with:
/// * `id` set to `exn_id`
/// * `message` set to corresponding exception name from `EXCEPTION_ID_LOOKUP`
///
/// The message is matched on host to ensure correct exception is being referred
/// This test checks the synchronization of exception ids for runtime errors
#[no_mangle]
pub extern "C-unwind" fn test_exception_id_sync(exn_id: u32) {
let message = EXCEPTION_ID_LOOKUP
.iter()
.find_map(|&(name, id)| if id == exn_id { Some(name) } else { None })
.unwrap_or("unallocated internal exception id");
let exn = Exception {
id: exn_id,
file: file!().as_c_slice(),
line: 0,
column: 0,
function: "test_exception_id_sync".as_c_slice(),
message: message.as_c_slice(),
param: [0, 0, 0]
};
unsafe { raise(&exn) };
}