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

Function run_much_stdout

tests/all/cli_tests.rs:2506–2531  ·  view source on GitHub ↗
(component: &str, extra_flags: &[&str])

Source from the content-addressed store, hash-verified

2504 }
2505
2506 fn run_much_stdout(component: &str, extra_flags: &[&str]) -> Result<()> {
2507 let total_write_size = 1 << 18;
2508 let expected = iter::repeat('a').take(total_write_size).collect::<String>();
2509
2510 for i in 10..15 {
2511 let string = iter::repeat('a').take(1 << i).collect::<String>();
2512 let times = (total_write_size >> i).to_string();
2513 println!("writing {} bytes {times} times", string.len());
2514
2515 let mut args = Vec::new();
2516 args.push("run");
2517 args.extend_from_slice(extra_flags);
2518 args.push(component);
2519 args.push(&string);
2520 args.push(&times);
2521 let output = run_wasmtime(&args)?;
2522 println!(
2523 "expected {} bytes, got {} bytes",
2524 expected.len(),
2525 output.len()
2526 );
2527 assert!(output == expected);
2528 }
2529
2530 Ok(())
2531 }
2532
2533 #[test]
2534 fn p1_cli_much_stdout() -> Result<()> {

Callers 3

p1_cli_much_stdoutFunction · 0.85
p2_cli_much_stdoutFunction · 0.85
p3_cli_much_stdoutFunction · 0.85

Calls 7

run_wasmtimeFunction · 0.85
OkFunction · 0.85
repeatFunction · 0.50
newFunction · 0.50
takeMethod · 0.45
to_stringMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected