Remove the wasmtime feature flag (#12684)

* Remove the `wasmtime` feature flag

* rustfmt
This commit is contained in:
Koute
2022-11-18 22:21:44 +09:00
committed by GitHub
parent 970354cecc
commit 4214bc527c
17 changed files with 20 additions and 126 deletions
@@ -18,11 +18,6 @@
//! Tests that are only relevant for Linux.
// Constrain this only to wasmtime for the time being. Without this rustc will complain on unused
// imports and items. The alternative is to plop `cfg(feature = wasmtime)` everywhere which seems
// borthersome.
#![cfg(feature = "wasmtime")]
use super::mk_test_runtime;
use crate::WasmExecutionMethod;
use codec::Encode as _;
@@ -52,7 +52,6 @@ macro_rules! test_wasm_execution {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_recreate_instance_cow>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::RecreateInstanceCopyOnWrite
@@ -60,7 +59,6 @@ macro_rules! test_wasm_execution {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_recreate_instance_vanilla>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::RecreateInstance
@@ -68,7 +66,6 @@ macro_rules! test_wasm_execution {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_pooling_cow>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::PoolingCopyOnWrite
@@ -76,7 +73,6 @@ macro_rules! test_wasm_execution {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_pooling_vanilla>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::Pooling
@@ -84,7 +80,6 @@ macro_rules! test_wasm_execution {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_legacy_instance_reuse>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::LegacyInstanceReuse
@@ -120,7 +115,6 @@ macro_rules! test_wasm_execution_sandbox {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_pooling_cow_host_executor>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::PoolingCopyOnWrite
@@ -128,7 +122,6 @@ macro_rules! test_wasm_execution_sandbox {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_pooling_cow_embedded_executor>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::PoolingCopyOnWrite
@@ -136,7 +129,6 @@ macro_rules! test_wasm_execution_sandbox {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_pooling_vanilla_host_executor>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::Pooling
@@ -144,7 +136,6 @@ macro_rules! test_wasm_execution_sandbox {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_pooling_vanilla_embedded_executor>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::Pooling
@@ -152,7 +143,6 @@ macro_rules! test_wasm_execution_sandbox {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_recreate_instance_cow_host_executor>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::RecreateInstanceCopyOnWrite
@@ -160,7 +150,6 @@ macro_rules! test_wasm_execution_sandbox {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_recreate_instance_cow_embedded_executor>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::RecreateInstanceCopyOnWrite
@@ -168,7 +157,6 @@ macro_rules! test_wasm_execution_sandbox {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_recreate_instance_vanilla_host_executor>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::RecreateInstance
@@ -176,7 +164,6 @@ macro_rules! test_wasm_execution_sandbox {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_recreate_instance_vanilla_embedded_executor>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::RecreateInstance
@@ -184,7 +171,6 @@ macro_rules! test_wasm_execution_sandbox {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_legacy_instance_reuse_host_executor>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::LegacyInstanceReuse
@@ -192,7 +178,6 @@ macro_rules! test_wasm_execution_sandbox {
}
#[test]
#[cfg(feature = "wasmtime")]
fn [<$method_name _compiled_legacy_instance_reuse_embedded_executor>]() {
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::LegacyInstanceReuse
@@ -253,7 +238,6 @@ fn call_not_existing_function(wasm_method: WasmExecutionMethod) {
Error::AbortedDueToTrap(error) => {
let expected = match wasm_method {
WasmExecutionMethod::Interpreted => "Other: Function `missing_external` is only a stub. Calling a stub is not allowed.",
#[cfg(feature = "wasmtime")]
WasmExecutionMethod::Compiled { .. } => "call to a missing function env:missing_external"
};
assert_eq!(error.message, expected);
@@ -273,7 +257,6 @@ fn call_yet_another_not_existing_function(wasm_method: WasmExecutionMethod) {
Error::AbortedDueToTrap(error) => {
let expected = match wasm_method {
WasmExecutionMethod::Interpreted => "Other: Function `yet_another_missing_external` is only a stub. Calling a stub is not allowed.",
#[cfg(feature = "wasmtime")]
WasmExecutionMethod::Compiled { .. } => "call to a missing function env:yet_another_missing_external"
};
assert_eq!(error.message, expected);
@@ -577,7 +560,6 @@ fn should_trap_when_heap_exhausted(wasm_method: WasmExecutionMethod) {
.unwrap_err();
match err {
#[cfg(feature = "wasmtime")]
Error::AbortedDueToTrap(error)
if matches!(wasm_method, WasmExecutionMethod::Compiled { .. }) =>
{
@@ -886,8 +868,8 @@ fn unreachable_intrinsic(wasm_method: WasmExecutionMethod) {
Error::AbortedDueToTrap(error) => {
let expected = match wasm_method {
WasmExecutionMethod::Interpreted => "unreachable",
#[cfg(feature = "wasmtime")]
WasmExecutionMethod::Compiled { .. } => "wasm trap: wasm `unreachable` instruction executed",
WasmExecutionMethod::Compiled { .. } =>
"wasm trap: wasm `unreachable` instruction executed",
};
assert_eq!(error.message, expected);
},
-2
View File
@@ -50,8 +50,6 @@ pub use wasm_runtime::{read_embedded_version, WasmExecutionMethod};
pub use wasmi;
pub use sc_executor_common::{error, sandbox};
#[cfg(feature = "wasmtime")]
pub use sc_executor_wasmtime::InstantiationStrategy as WasmtimeInstantiationStrategy;
/// Extracts the runtime version of a given runtime code.
@@ -46,7 +46,6 @@ pub enum WasmExecutionMethod {
/// Uses the Wasmi interpreter.
Interpreted,
/// Uses the Wasmtime compiled runtime.
#[cfg(feature = "wasmtime")]
Compiled {
/// The instantiation strategy to use.
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy,
@@ -314,7 +313,6 @@ where
)
.map(|runtime| -> Arc<dyn WasmModule> { Arc::new(runtime) })
},
#[cfg(feature = "wasmtime")]
WasmExecutionMethod::Compiled { instantiation_strategy } =>
sc_executor_wasmtime::create_runtime::<H>(
blob,