1
0
Fork 0
forked from koniifer/ableos

un-hard-code the tests

This commit is contained in:
Christian Westrom 2024-06-01 00:31:04 +09:00
parent b427ae1c27
commit da606facb0

View file

@ -139,10 +139,6 @@ fn get_fs() -> Result<FileSystem<impl ReadWriteSeek>, io::Error> {
let fs = FileSystem::new(img, FsOptions::new())?; let fs = FileSystem::new(img, FsOptions::new())?;
// TODO: Do not hard code these here
let p = Package::load_from_file("sysdata/programs/tests/meta.toml".to_owned());
p.build();
// Read the contents of the file using a `match` block // Read the contents of the file using a `match` block
// to return the `data: Ok(c)` as a `String` // to return the `data: Ok(c)` as a `String`
// or handle any `errors: Err(_)`. // or handle any `errors: Err(_)`.
@ -244,7 +240,26 @@ TERM_BACKDROP={}
let modules = value.get_mut("modules").unwrap().as_table_mut().unwrap(); let modules = value.get_mut("modules").unwrap().as_table_mut().unwrap();
// let mut real_modules = modules.clone(); // let mut real_modules = modules.clone();
for (key, value) in modules.into_iter() { modules.into_iter().for_each(|(key, value)| {
if value.is_table() && key == "tests" {
let path = value
.get("path")
.expect("You must have `path` as a value")
.as_str()
.unwrap()
.split("boot:///")
.last()
.unwrap()
.split(".")
.next()
.unwrap();
let p = Package::load_from_file(
format!("sysdata/programs/{}/meta.toml", path).to_owned(),
);
p.build();
}
});
modules.into_iter().for_each(|(_key, value)| {
if value.is_table() { if value.is_table() {
let path = value.get("path").expect("You must have `path` as a value"); let path = value.get("path").expect("You must have `path` as a value");
let default_value = Value::String("".into()); let default_value = Value::String("".into());
@ -258,10 +273,10 @@ TERM_BACKDROP={}
); );
limine_str.push_str(&a); limine_str.push_str(&a);
} }
} });
// Copy modules into the test_programs directory // Copy modules into the test_programs directory
modules.into_iter().for_each(|(key, value)| { modules.into_iter().for_each(|(_key, value)| {
if value.is_table() { if value.is_table() {
let path = value let path = value
.get("path") .get("path")