MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / prepare

Function prepare

crates/test/src/c.rs:83–100  ·  view source on GitHub ↗
(runner: &mut Runner, compiler: PathBuf)

Source from the content-addressed store, hash-verified

81}
82
83fn prepare(runner: &mut Runner, compiler: PathBuf) -> Result<()> {
84 let cwd = env::current_dir()?;
85 let dir = cwd.join(&runner.opts.artifacts).join("c");
86
87 super::write_if_different(&dir.join("test.c"), "int main() { return 0; }")?;
88
89 println!("Testing if `{}` works...", compiler.display());
90 runner
91 .run_command(Command::new(&compiler).current_dir(&dir).arg("test.c"))
92 .inspect_err(|_| {
93 eprintln!(
94 "Error: failed to find `{}`. Hint: pass `--wasi-sdk-path` or set `WASI_SDK_PATH`",
95 compiler.display()
96 );
97 })?;
98
99 Ok(())
100}
101
102fn compile(runner: &Runner, compile: &Compile<'_>, compiler: PathBuf) -> Result<()> {
103 let config = compile.component.deserialize_lang_config::<LangConfig>()?;

Callers 2

prepareMethod · 0.85
prepare_languagesMethod · 0.85

Calls 4

write_if_differentFunction · 0.85
newFunction · 0.85
joinMethod · 0.80
run_commandMethod · 0.80

Tested by

no test coverage detected