Skip to content

Commit 514d0d4

Browse files
committed
feat: enhance testcases
1 parent 2129d74 commit 514d0d4

File tree

21 files changed

+173
-428
lines changed

21 files changed

+173
-428
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ logging = { path = "crates/logging" }
4949
signal = { path = "crates/signal" }
5050
sync = { path = "crates/sync" }
5151

52-
polyhal = { version = "0.2.1", features = ["logger", "trap"] }
53-
polyhal-boot = { version = "0.2.1" }
54-
polyhal-trap = { version = "0.2.1" }
52+
polyhal = { version = "0.2.3", features = ["logger", "trap"] }
53+
polyhal-boot = { version = "0.2.3" }
54+
polyhal-trap = { version = "0.2.3" }
5555
fdt-parser = { version = "0.4.12" }
5656

5757
syscalls = { git = "https://github.com/jasonwhite/syscalls.git", default-features = false }

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ FS_IMG := mount.img
3535
features:=
3636
QEMU_EXEC += -m 1G\
3737
-nographic \
38-
-smp $(SMP) \
39-
-D qemu.log -d in_asm,int,pcall,cpu_reset,guest_errors
38+
-smp $(SMP)
39+
ifeq ($(QEMU_LOG), on)
40+
QEMU_EXEC += -D qemu.log -d in_asm,int,pcall,cpu_reset,guest_errors
41+
endif
4042

4143
TESTCASE := testcase-$(ARCH)
4244
ifeq ($(NVME), on)
@@ -69,7 +71,7 @@ fs-img:
6971
@echo "TESTCASE: $(TESTCASE)"
7072
@echo "ROOT_FS: $(ROOT_FS)"
7173
rm -f $(FS_IMG)
72-
dd if=/dev/zero of=$(FS_IMG) bs=1M count=64
74+
dd if=/dev/zero of=$(FS_IMG) bs=1M count=96
7375
sync
7476
ifeq ($(ROOT_FS), fat32)
7577
mkfs.vfat -F 32 $(FS_IMG)

byteos.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ bin:
1212
riscv64-qemu:
1313
target: "riscv64gc-unknown-none-elf"
1414
configs:
15-
driver: "kvirtio,kgoldfish-rtc,ns16550a,kramdisk"
15+
driver: "kramdisk"
1616
riscv64-vf2:
1717
target: "riscv64imac-unknown-none-elf"
1818
configs:
@@ -21,15 +21,15 @@ bin:
2121
x86_64-qemu:
2222
target: "x86_64-unknown-none"
2323
configs:
24-
driver: "kvirtio,kgoldfish-rtc,ns16550a"
24+
driver: "kvirtio,kramdisk"
2525
x86_64-generic:
2626
target: "x86_64-unknown-none"
2727
configs:
28-
driver: "kramdisk,kgoldfish-rtc,ns16550a"
28+
driver: "kramdisk"
2929
aarch64-qemu:
3030
target: "aarch64-unknown-none-softfloat"
3131
configs:
32-
driver: "kvirtio,kgoldfish-rtc,ns16550a,kramdisk"
32+
driver: "kramdisk"
3333
loongarch64-qemu:
3434
target: "loongarch64-unknown-none"
3535
configs:

crates/executor/src/thread.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ use core::future::Future;
33
use alloc::{boxed::Box, sync::Arc};
44

55
use crate::{
6-
task::{AsyncTask, AsyncTaskItem, BlankKernelTask}, task_id_alloc, TASK_MAP, TASK_QUEUE
6+
task::{AsyncTask, AsyncTaskItem, BlankKernelTask},
7+
task_id_alloc, TASK_MAP, TASK_QUEUE,
78
};
89

910
#[inline]
10-
pub fn spawn(
11-
task: Arc<dyn AsyncTask>,
12-
future: impl Future<Output = ()> + Send + 'static,
13-
) {
14-
TASK_MAP.lock().insert(task.get_task_id(), Arc::downgrade(&task));
11+
pub fn spawn(task: Arc<dyn AsyncTask>, future: impl Future<Output = ()> + Send + 'static) {
12+
TASK_MAP
13+
.lock()
14+
.insert(task.get_task_id(), Arc::downgrade(&task));
1515
TASK_QUEUE.lock().push_back(AsyncTaskItem {
1616
future: Box::pin(future),
1717
task,
@@ -21,7 +21,9 @@ pub fn spawn(
2121
#[inline]
2222
pub fn spawn_blank(future: impl Future<Output = ()> + Send + 'static) {
2323
let task: Arc<dyn AsyncTask> = Arc::new(BlankKernelTask(task_id_alloc()));
24-
TASK_MAP.lock().insert(task.get_task_id(), Arc::downgrade(&task));
24+
TASK_MAP
25+
.lock()
26+
.insert(task.get_task_id(), Arc::downgrade(&task));
2527
TASK_QUEUE.lock().push_back(AsyncTaskItem {
2628
future: Box::pin(future),
2729
task,

driver/kramdisk/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ impl Driver for RamDiskBlock {
3333

3434
impl BlkDriver for RamDiskBlock {
3535
fn read_blocks(&self, sector_offset: usize, buf: &mut [u8]) {
36-
assert_eq!(buf.len(), 0x200);
37-
let rlen = buf.len();
38-
if (sector_offset * 0x200 + rlen) >= self.size {
36+
assert_eq!(buf.len() % 0x200, 0);
37+
if (sector_offset * 0x200 + buf.len()) >= self.size {
3938
panic!("can't out of ramdisk range")
4039
};
4140
unsafe {
@@ -48,9 +47,8 @@ impl BlkDriver for RamDiskBlock {
4847
}
4948

5049
fn write_blocks(&self, sector_idx: usize, buf: &[u8]) {
51-
assert_eq!(buf.len(), 0x200);
52-
let wlen = buf.len();
53-
if (sector_idx * 0x200 + wlen) >= self.size {
50+
assert_eq!(buf.len() % 0x200, 0);
51+
if (sector_idx * 0x200 + buf.len()) >= self.size {
5452
panic!("can't out of ramdisk range")
5553
};
5654
unsafe {

driver/kvirtio/src/virtio_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ unsafe impl Hal for HalImpl {
1313
let trackers = frame_alloc_much(pages).expect("can't alloc page in virtio");
1414
let paddr = trackers[0].0;
1515
let vaddr = NonNull::new(paddr.get_mut_ptr()).unwrap();
16-
trace!("alloc DMA: paddr={:#x}, pages={}", paddr.raw(), pages);
16+
trace!("alloc DMA: paddr={:#x}, pages={:?}", paddr.raw(), trackers);
1717
VIRTIO_CONTAINER.lock().extend(trackers.into_iter());
1818
(paddr.raw(), vaddr)
1919
}

0 commit comments

Comments
 (0)