Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vinc committed Oct 20, 2024
1 parent 9dc1001 commit 56737cb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sys/fs/block_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl BlockDeviceIO for MemBlockDevice {
}

pub fn mount_mem() {
let mem = sys::mem::memory_size() / 2; // Half the allocatable memory
let mem = sys::mem::memory_free() / 2;
let len = mem / super::BLOCK_SIZE; // TODO: take a size argument
let dev = MemBlockDevice::new(len);
*BLOCK_DEVICE.lock() = Some(BlockDevice::Mem(dev));
Expand Down
2 changes: 2 additions & 0 deletions src/sys/mem/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ fn many_boxes() {

#[test_case]
fn large_vec() {
use alloc::vec::Vec;

let n = 1000;
let mut vec = Vec::new();
for i in 0..n {
Expand Down
2 changes: 1 addition & 1 deletion src/sys/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn memory_used() -> usize {
}

pub fn memory_free() -> usize {
(memory_size() - heap::heap_size()) + heap::heap_free()
heap::heap_free()
}

pub fn phys_to_virt(addr: PhysAddr) -> VirtAddr {
Expand Down

0 comments on commit 56737cb

Please sign in to comment.