mirror of
https://github.com/fluencelabs/wasmer
synced 2025-07-19 17:41:56 +00:00
.azure
.github
docs
examples
fuzz
integration_tests
lib
clif-backend
dev-utils
emscripten
emscripten-tests
kernel-loader
kernel-net
llvm-backend
llvm-backend-tests
middleware-common
middleware-common-tests
runtime
runtime-c-api
doc
src
tests
assets
.gitignore
CMakeLists.txt
runtime_c_api_tests.rs
test-context.c
test-emscripten-import-object.c
test-exported-memory.c
test-exports.c
test-globals.c
test-import-function-callinfo.c
test-import-function.c
test-import-object
test-import-object.c
test-import-trap.c
test-imports.c
test-instantiate.c
test-memory.c
test-module-exports.c
test-module-import-instantiate.c
test-module-imports.c
test-module-serialize.c
test-module.c
test-tables.c
test-validate.c
test-wasi-import-object.c
.gitignore
Cargo.toml
README.md
build.rs
doxyfile
wasmer.h
wasmer.hh
runtime-core
runtime-core-tests
singlepass-backend
spectests
wasi
wasi-experimental-io-devices
wasi-tests
win-exception-handler
.gitignore
README.md
scripts
src
wapm-cli
.dockerignore
.gitattributes
.gitignore
.gitmodules
.travis.yml
ATTRIBUTIONS.md
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Cargo.lock
Cargo.toml
Dockerfile
Dockerfile.build
LICENSE
Makefile
README.md
SECURITY.md
azure-pipelines.yml
bors.toml
build
index.html
install.sh
logo.png
rustfmt.toml
57 lines
1.6 KiB
Rust
57 lines
1.6 KiB
Rust
use std::process::Command;
|
|
|
|
#[test]
|
|
fn test_c_api() {
|
|
let project_tests_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/tests");
|
|
|
|
let cmake_args = vec![
|
|
".",
|
|
#[cfg(feature = "wasi")]
|
|
"-DWASI_TESTS=ON",
|
|
#[cfg(feature = "emscripten")]
|
|
"-DEMSCRIPTEN_TESTS=ON",
|
|
];
|
|
// we use -f so it doesn't fail if the file doesn't exist
|
|
run_command("rm", project_tests_dir, vec!["-f", "CMakeCache.txt"]);
|
|
run_command("cmake", project_tests_dir, cmake_args);
|
|
run_command("make", project_tests_dir, vec!["-Wdev", "-Werror=dev"]);
|
|
run_command("make", project_tests_dir, vec!["test", "ARGS=\"-V\""]);
|
|
}
|
|
|
|
fn run_command(command_str: &str, dir: &str, args: Vec<&str>) {
|
|
println!("Running command: `{}` args: {:?}", command_str, args);
|
|
|
|
let mut command = Command::new(command_str);
|
|
|
|
command.args(&args);
|
|
|
|
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),
|
|
}
|
|
}
|