mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-30 09:53:29 +00:00
Implement OSDK functionalities and opt-in OSDK for asterinas
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
bc9bce9dea
commit
f97d0f1260
@ -21,8 +21,8 @@
|
||||
//! module, e.g.:
|
||||
//!
|
||||
//! ```rust
|
||||
//! use ktest::{ktest, if_cfg_ktest};
|
||||
//! #[if_cfg_ktest]
|
||||
//! use ktest::ktest;
|
||||
//! #[cfg(ktest)]
|
||||
//! mod test {
|
||||
//! #[ktest]
|
||||
//! fn trivial_assertion() {
|
||||
@ -97,7 +97,7 @@ extern crate alloc;
|
||||
use alloc::{boxed::Box, string::String};
|
||||
use core::result::Result;
|
||||
|
||||
pub use ktest_proc_macro::{if_cfg_ktest, ktest};
|
||||
pub use ktest_proc_macro::ktest;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PanicInfo {
|
||||
|
@ -3,7 +3,7 @@
|
||||
//! Test runner enabling control over the tests.
|
||||
//!
|
||||
|
||||
use alloc::{string::String, vec::Vec};
|
||||
use alloc::{string::String, vec::Vec, collections::BTreeSet};
|
||||
use core::format_args;
|
||||
|
||||
use owo_colors::OwoColorize;
|
||||
@ -35,7 +35,8 @@ pub enum KtestResult {
|
||||
pub fn run_ktests<PrintFn, PathsIter>(
|
||||
print: &PrintFn,
|
||||
catch_unwind: &CatchUnwindImpl,
|
||||
whitelist: Option<PathsIter>,
|
||||
test_whitelist: Option<PathsIter>,
|
||||
crate_whitelist: Option<&[&str]>,
|
||||
) -> KtestResult
|
||||
where
|
||||
PrintFn: Fn(core::fmt::Arguments),
|
||||
@ -48,7 +49,7 @@ where
|
||||
}
|
||||
|
||||
let whitelist_trie =
|
||||
whitelist.map(|paths| SuffixTrie::from_paths(paths.map(|p| KtestPath::from(&p))));
|
||||
test_whitelist.map(|paths| SuffixTrie::from_paths(paths.map(|p| KtestPath::from(&p))));
|
||||
|
||||
let tree = KtestTree::from_iter(KtestIter::new());
|
||||
print!(
|
||||
@ -56,7 +57,15 @@ where
|
||||
tree.nr_tot_tests(),
|
||||
tree.nr_tot_crates()
|
||||
);
|
||||
let crate_set =
|
||||
crate_whitelist.map(|crates| crates.iter().copied().collect::<BTreeSet<&str>>());
|
||||
for crate_ in tree.iter() {
|
||||
if let Some(crate_set) = &crate_set {
|
||||
if !crate_set.contains(crate_.name()) {
|
||||
print!("\n[ktest runner] skipping crate \"{}\".\n", crate_.name());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
match run_crate_ktests(crate_, print, catch_unwind, &whitelist_trie) {
|
||||
KtestResult::Ok => {}
|
||||
KtestResult::Failed => return KtestResult::Failed,
|
||||
|
Reference in New Issue
Block a user