Skip to content

Commit

Permalink
Start to write initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
AlixANNERAUD committed Jul 12, 2024
1 parent 3fd0bc2 commit bcf7c37
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Modules/Initialize/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ version = "0.1.0"
edition = "2021"

[dependencies]
Drivers = { version = "0.1.0", path = "../Drivers" }
File_system = { version = "0.1.0", path = "../File_system" }
Task = { version = "0.1.0", path = "../Task" }
Users = { version = "0.1.0", path = "../Users" }
Virtual_machine = { version = "0.1.0", path = "../Virtual_machine" }
log = "0.4.22"
40 changes: 30 additions & 10 deletions Modules/Initialize/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]

use log::{error, info};

pub fn Initialize() {
info!("Initializing...");

info!("Initialize task module");

if let Err(Error) = Task::Initialize() {
error!("Failed to initialize the task module: {:?}", Error);
std::process::exit(1);
}

#[cfg(test)]
mod tests {
use super::*;
info!("Initialization user module");

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
if let Err(Error) = Users::Initialize() {
error!("Failed to initialize the user module: {:?}", Error);
std::process::exit(1);
}

info!("Initialize file system module");

if let Err(Error) = File_system::Initialize() {
error!("Failed to initialize the file system module: {:?}", Error);
std::process::exit(1);
}

info!("Initialize virtual machine module");

info!("Initialization complete");
}

0 comments on commit bcf7c37

Please sign in to comment.