MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / component_tables_limit

Function component_tables_limit

tests/all/pooling_allocator.rs:1101–1139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1099#[test]
1100#[cfg(feature = "component-model")]
1101fn component_tables_limit() -> Result<()> {
1102 let mut pool = crate::small_pool_config();
1103 pool.max_tables_per_component(1).total_tables(2);
1104 let mut config = Config::new();
1105 config.wasm_component_model(true);
1106 config.allocation_strategy(pool);
1107 let engine = Engine::new(&config)?;
1108
1109 // One table works.
1110 wasmtime::component::Component::new(
1111 &engine,
1112 r#"
1113 (component
1114 (core module $m (table 1 1 funcref))
1115 (core instance $a (instantiate $m))
1116 )
1117 "#,
1118 )?;
1119
1120 // Two tables doesn't.
1121 match wasmtime::component::Component::new(
1122 &engine,
1123 r#"
1124 (component
1125 (core module $m (table 1 1 funcref))
1126 (core instance $a (instantiate $m))
1127 (core instance $b (instantiate $m))
1128 )
1129 "#,
1130 ) {
1131 Ok(_) => panic!("should have hit limit"),
1132 Err(e) => e.assert_contains(
1133 "The component transitively contains 2 tables, which exceeds the \
1134 configured maximum of 1",
1135 ),
1136 }
1137
1138 Ok(())
1139}
1140
1141#[test]
1142#[cfg(feature = "component-model")]

Callers

nothing calls this directly

Calls 8

OkFunction · 0.85
allocation_strategyMethod · 0.80
assert_containsMethod · 0.80
small_pool_configFunction · 0.70
newFunction · 0.50
total_tablesMethod · 0.45
wasm_component_modelMethod · 0.45

Tested by

no test coverage detected