mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-24 14:11:32 +00:00
test(runtime-c-api) Transforms all C/C++ warnings into errors.
This patch ensures that all our examples and tests do not generate warnings. In C, it can be catastrophic sometimes… Also, be sure that the `cmake` command doesn't emit any warnings too.
This commit is contained in:
@ -3,37 +3,47 @@ use std::process::Command;
|
||||
#[test]
|
||||
fn test_c_api() {
|
||||
let project_tests_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/tests");
|
||||
|
||||
run_command("cmake", project_tests_dir, Some("."));
|
||||
run_command("make", project_tests_dir, None);
|
||||
run_command("make", project_tests_dir, Some("-Wdev -Werror=dev"));
|
||||
run_command("make", project_tests_dir, Some("test"));
|
||||
}
|
||||
|
||||
fn run_command(command_str: &str, dir: &str, arg: Option<&str>) {
|
||||
println!("Running command: `{}` arg: {:?}", command_str, arg);
|
||||
|
||||
let mut command = Command::new(command_str);
|
||||
|
||||
if let Some(a) = arg {
|
||||
command.arg(a);
|
||||
}
|
||||
|
||||
command.current_dir(dir);
|
||||
|
||||
let result = command.output();
|
||||
|
||||
match result {
|
||||
Ok(r) => {
|
||||
println!("output:");
|
||||
|
||||
if let Some(code) = r.status.code() {
|
||||
println!("status: {}", code);
|
||||
} else {
|
||||
println!("status: None");
|
||||
}
|
||||
|
||||
println!("stdout:");
|
||||
println!("{}", String::from_utf8_lossy(&r.stdout[..]));
|
||||
println!("stderr:");
|
||||
println!("{}", String::from_utf8_lossy(&r.stderr[..]));
|
||||
|
||||
if r.status.success() {
|
||||
assert!(true)
|
||||
} else {
|
||||
panic!("Command failed with exit status: {:?}", r.status);
|
||||
}
|
||||
}
|
||||
|
||||
Err(e) => panic!("Command failed: {}", e),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user