mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +00:00
Test restoring zeroed data (#9011)
* Test restoring zeroed data * Change to u64
This commit is contained in:
@@ -39,6 +39,14 @@ extern "C" {
|
||||
/// the initialized value at the start of a runtime call.
|
||||
static mut MUTABLE_STATIC: u64 = 32;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
/// This is similar to `MUTABLE_STATIC`. The tests need `MUTABLE_STATIC` for testing that
|
||||
/// non-null initialization data is properly restored during instance reusing.
|
||||
///
|
||||
/// `MUTABLE_STATIC_BSS` on the other hand focuses on the zeroed data. This is important since there
|
||||
/// may be differences in handling zeroed and non-zeroed data.
|
||||
static mut MUTABLE_STATIC_BSS: u64 = 0;
|
||||
|
||||
sp_core::wasm_export_functions! {
|
||||
fn test_calling_missing_external() {
|
||||
unsafe { missing_external() }
|
||||
@@ -309,6 +317,13 @@ sp_core::wasm_export_functions! {
|
||||
}
|
||||
}
|
||||
|
||||
fn returns_mutable_static_bss() -> u64 {
|
||||
unsafe {
|
||||
MUTABLE_STATIC_BSS += 1;
|
||||
MUTABLE_STATIC_BSS
|
||||
}
|
||||
}
|
||||
|
||||
fn allocates_huge_stack_array(trap: bool) -> Vec<u8> {
|
||||
// Allocate a stack frame that is approx. 75% of the stack (assuming it is 1MB).
|
||||
// This will just decrease (stacks in wasm32-u-u grow downwards) the stack
|
||||
|
||||
Reference in New Issue
Block a user