1
0
forked from Rativel/BurritOS

Fixed tests failing because of a too small memory

This commit is contained in:
François Autin
2023-05-09 20:52:00 +02:00
parent 86113da9d3
commit 15a04fb9da
2 changed files with 30 additions and 18 deletions

View File

@@ -93,25 +93,29 @@ pub fn read_settings() -> Result<Settings, Error> {
}
/// Returns a mock configuration for Machine unit testing
///
/// FIXME: Does not cover the whole configuration yet
pub fn get_debug_configuration() -> Settings {
let mut settings_map = Settings::new();
settings_map.insert(MachineSettingKey::PageSize, 128);
settings_map.insert(MachineSettingKey::NumPhysPages, 400);
settings_map.insert(MachineSettingKey::PageSize, 2048);
settings_map.insert(MachineSettingKey::NumPhysPages, 8192);
settings_map.insert(MachineSettingKey::UserStackSize, 4096);
settings_map
}
/// Removes comments and empty lines
fn filter_garbage<R: std::io::Read>(reader: BufReader<R>) -> Vec<String> {
reader.lines()
.map(|l| l.unwrap())
.filter(|l| !l.is_empty() && !l.starts_with("#"))
.filter(|l| !l.is_empty() && !l.starts_with('#'))
.collect()
}
/// Inserts user settings into setting map
fn update_settings_map(mut settings_map: Settings, key: &str, setting: &str) -> Settings {
let key = MachineSettingKey::from(key);
let setting = u64::from_str_radix(setting, 10).unwrap_or(0);
let setting = setting.parse::<u64>().unwrap_or(0);
settings_map.insert(key, setting);
settings_map
}