mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-27 19:51:09 +00:00
Refactor sp-sandbox; make sure both sandbox executors are always tested (#10173)
* sp-sandbox: convert executors into normal `mod`s instead of using `include!` * sp-sandbox: run `cargo fmt` on `host_executor.rs` * sp-sandbox: abstract away the executors behind traits * sp_sandbox: always compile both executors when possible * sc-executor: make sure all sandbox tests run on both sandbox executors * sc-executor: fix brainfart: actually call into the sandbox through the trait * sc-runtime-test: fix cargo fmt * sc-runtime-test: deduplicate executor-specific sandbox test entrypoints * sc-executor: test each sandbox executor in a separate test * cargo fmt (Github's conflict resolving thingy broke indentation)
This commit is contained in:
@@ -71,6 +71,53 @@ macro_rules! test_wasm_execution {
|
||||
};
|
||||
}
|
||||
|
||||
/// A macro to run a given test for each available WASM execution method *and* for each
|
||||
/// sandbox execution method.
|
||||
#[macro_export]
|
||||
macro_rules! test_wasm_execution_sandbox {
|
||||
($method_name:ident) => {
|
||||
paste::item! {
|
||||
#[test]
|
||||
fn [<$method_name _interpreted_host_executor>]() {
|
||||
$method_name(WasmExecutionMethod::Interpreted, "_host");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn [<$method_name _interpreted_embedded_executor>]() {
|
||||
$method_name(WasmExecutionMethod::Interpreted, "_embedded");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "wasmtime")]
|
||||
fn [<$method_name _compiled_host_executor>]() {
|
||||
$method_name(WasmExecutionMethod::Compiled, "_host");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "wasmtime")]
|
||||
fn [<$method_name _compiled_embedded_executor>]() {
|
||||
$method_name(WasmExecutionMethod::Compiled, "_embedded");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
(interpreted_only $method_name:ident) => {
|
||||
paste::item! {
|
||||
#[test]
|
||||
fn [<$method_name _interpreted_host_executor>]() {
|
||||
$method_name(WasmExecutionMethod::Interpreted, "_host");
|
||||
}
|
||||
}
|
||||
|
||||
paste::item! {
|
||||
#[test]
|
||||
fn [<$method_name _interpreted_embedded_executor>]() {
|
||||
$method_name(WasmExecutionMethod::Interpreted, "_embedded");
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn call_in_wasm<E: Externalities>(
|
||||
function: &str,
|
||||
call_data: &[u8],
|
||||
|
||||
Reference in New Issue
Block a user