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

Function total_core_instances_limit

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

Source from the content-addressed store, hash-verified

405
406#[test]
407fn total_core_instances_limit() -> Result<()> {
408 const INSTANCE_LIMIT: u32 = 10;
409 let mut pool = crate::small_pool_config();
410 pool.total_core_instances(INSTANCE_LIMIT);
411 let mut config = Config::new();
412 config.allocation_strategy(pool);
413 config.memory_guard_size(0);
414 config.memory_reservation(1 << 16);
415
416 let engine = Engine::new(&config)?;
417 let module = Module::new(&engine, r#"(module)"#)?;
418
419 // Instantiate to the limit
420 {
421 let mut store = Store::new(&engine, ());
422
423 for _ in 0..INSTANCE_LIMIT {
424 Instance::new(&mut store, &module, &[])?;
425 }
426
427 match Instance::new(&mut store, &module, &[]) {
428 Ok(_) => panic!("instantiation should fail"),
429 Err(e) => assert!(e.is::<PoolConcurrencyLimitError>()),
430 }
431 }
432
433 // With the above store dropped, ensure instantiations can be made
434
435 let mut store = Store::new(&engine, ());
436
437 for _ in 0..INSTANCE_LIMIT {
438 Instance::new(&mut store, &module, &[])?;
439 }
440
441 Ok(())
442}
443
444#[test]
445#[cfg_attr(miri, ignore)]

Callers

nothing calls this directly

Calls 7

OkFunction · 0.85
allocation_strategyMethod · 0.80
small_pool_configFunction · 0.70
newFunction · 0.50
total_core_instancesMethod · 0.45
memory_guard_sizeMethod · 0.45
memory_reservationMethod · 0.45

Tested by

no test coverage detected