1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-17 21:16:30 +02:00
youki/tests/runtimetest/src/main.rs
Yashodhan 80f1f36ae9
Refactor test dir structure (#2421)
* Move individual rust-oci-tests components in the tests dir

We can use several things from test_framework and even integration_test
for additional tests such as podman rootless and wasm tests

Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>

* fix scripts and docs for the new dir structure

Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>

---------

Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
2023-10-10 21:00:02 +09:00

39 lines
1.1 KiB
Rust

mod tests;
mod utils;
use oci_spec::runtime::Spec;
use std::env;
use std::path::PathBuf;
const SPEC_PATH: &str = "/config.json";
fn get_spec() -> Spec {
let path = PathBuf::from(SPEC_PATH);
match Spec::load(path) {
Ok(spec) => spec,
Err(e) => {
eprintln!("Error in loading spec, {e:?}");
std::process::exit(66);
}
}
}
////////// ANCHOR: example_runtimetest_main
fn main() {
let spec = get_spec();
let args: Vec<String> = env::args().collect();
let execute_test = match args.get(1) {
Some(execute_test) => execute_test.to_string(),
None => return eprintln!("error due to execute test name not found"),
};
match &*execute_test {
"hello_world" => tests::hello_world(&spec),
////////// ANCHOR_END: example_runtimetest_main
"readonly_paths" => tests::validate_readonly_paths(&spec),
"set_host_name" => tests::validate_hostname(&spec),
"mounts_recursive" => tests::validate_mounts_recursive(&spec),
_ => eprintln!("error due to unexpected execute test name: {execute_test}"),
}
}