diff --git a/contracts/ckb-std-tests/src/entry.rs b/contracts/ckb-std-tests/src/entry.rs index b85dda3..ac65ac5 100644 --- a/contracts/ckb-std-tests/src/entry.rs +++ b/contracts/ckb-std-tests/src/entry.rs @@ -805,6 +805,19 @@ pub fn main() -> Result<(), Error> { test_query(); test_calc_data_hash(); + // Context should not be dropped. + #[cfg(target_arch = "riscv64")] + #[allow(deprecated)] + let mut old_context = unsafe { ContextTypeOld::new() }; + #[cfg(target_arch = "riscv64")] + test_dynamic_loading(&mut old_context); + + // Context should not be dropped. + #[cfg(target_arch = "riscv64")] + let mut context = unsafe { ContextType::new() }; + #[cfg(target_arch = "riscv64")] + test_dynamic_loading_c_impl(&mut context); + test_vm_version(); test_current_cycles(); test_since(); @@ -815,15 +828,5 @@ pub fn main() -> Result<(), Error> { test_log(); } - #[cfg(target_arch = "riscv64")] - unsafe { - let mut context = ContextType::new(); - #[allow(deprecated)] - let mut old_context = ContextTypeOld::new(); - - test_dynamic_loading(&mut old_context); - test_dynamic_loading_c_impl(&mut context); - } - Ok(()) }