abitest: only set panic hook in outer main
When the abitest application is being run under the test Rust runtime,
don't need to log panic information.
@@ -26,7 +26,10 @@ use protobuf::ProtobufEnum;
// is what's sent back to the frontend.
#[no_mangle]
pub extern "C" fn backend_oak_main(handle: u64) -> i32 {
- std::panic::catch_unwind(|| main(handle))
+ std::panic::catch_unwind(|| {
+ oak::set_panic_hook();
+ main(handle)
+ })
.unwrap_or(Err(oak::OakStatus::ERR_INTERNAL))
.err()
.unwrap_or(oak::OakStatus::OK)
@@ -35,7 +38,6 @@ pub extern "C" fn backend_oak_main(handle: u64) -> i32 {
pub fn main(in_handle: u64) -> Result<(), oak::OakStatus> {
let _ = oak_log::init(log::Level::Debug, LOG_CONFIG_NAME);
- oak::set_panic_hook();
let in_channel = oak::ReadHandle {
handle: oak::Handle::from_raw(in_handle),
};
