Skip to content

Commit

Permalink
feat: add test img
Browse files Browse the repository at this point in the history
  • Loading branch information
Yttehs-HDX committed Dec 2, 2024
1 parent 0a562bb commit 52deef8
Show file tree
Hide file tree
Showing 39 changed files with 20 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY : all build clean setup
.PHONY : all build test clean setup

all:
@cd user && make -s all
Expand All @@ -8,6 +8,10 @@ build:
@cd user && make -s all
@cd kernel && make -s build

test:
@cd user && make -s build
@cd kernel && make -s test

clean:
@cd user && make -s clean
@cd kernel && make -s clean
Expand Down
13 changes: 12 additions & 1 deletion kernel/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.PHONY : all build run debug connect fmt clean
.PHONY : all build run test debug connect fmt clean

ARCH := riscv64gc-unknown-none-elf
BUILD_TYPE := release
BIOS := rustsbi.bin
KERNEL := kernel
TARGET := target/$(ARCH)/$(BUILD_TYPE)/$(KERNEL)
FS_IMG := ../user/target/${ARCH}/${BUILD_TYPE}/sdcard.img
TEST_IMG := ../test/test.img

CARGO := cargo
CARGO_FLAGS := --$(BUILD_TYPE)
Expand All @@ -18,6 +19,13 @@ QEMU_FLAGS := -machine virt \
-device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0 \
-nographic

TEST_FLAGS := -machine virt \
-bios ../bootloader/$(BIOS) \
-kernel $(TARGET) \
-drive file=$(TEST_IMG),if=none,format=raw,id=x0 \
-device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0 \
-nographic

GDB := riscv64-elf-gdb
GDB_FLAGS := -ex "file $(TARGET)" \
-ex "target remote :1234" \
Expand All @@ -31,6 +39,9 @@ build:
run: build
@$(QEMU) $(QEMU_FLAGS)

test: build
@$(QEMU) $(TEST_FLAGS)

debug:
@echo -e "\033[33m[+] Run 'make connect' in another terminal at the same dir\033[0m"
@$(QEMU) $(QEMU_FLAGS) -S -s
Expand Down
Binary file added test/cases/brk
Binary file not shown.
Binary file added test/cases/chdir
Binary file not shown.
Binary file added test/cases/clone
Binary file not shown.
Binary file added test/cases/close
Binary file not shown.
Binary file added test/cases/dup
Binary file not shown.
Binary file added test/cases/dup2
Binary file not shown.
Binary file added test/cases/execve
Binary file not shown.
Binary file added test/cases/exit
Binary file not shown.
Binary file added test/cases/fork
Binary file not shown.
Binary file added test/cases/fstat
Binary file not shown.
Binary file added test/cases/getcwd
Binary file not shown.
Binary file added test/cases/getdents
Binary file not shown.
Binary file added test/cases/getpid
Binary file not shown.
Binary file added test/cases/getppid
Binary file not shown.
Binary file added test/cases/gettimeofday
Binary file not shown.
Binary file added test/cases/mkdir_
Binary file not shown.
Binary file added test/cases/mmap
Binary file not shown.
Empty file added test/cases/mnt/test_mount
Empty file.
Binary file added test/cases/mount
Binary file not shown.
Binary file added test/cases/munmap
Binary file not shown.
Binary file added test/cases/open
Binary file not shown.
Binary file added test/cases/openat
Binary file not shown.
Binary file added test/cases/pipe
Binary file not shown.
Binary file added test/cases/read
Binary file not shown.
Binary file added test/cases/sleep
Binary file not shown.
Binary file added test/cases/test_echo
Binary file not shown.
3 changes: 3 additions & 0 deletions test/cases/text.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Hi, this is a text file.
syscalls testing success!

Binary file added test/cases/times
Binary file not shown.
Binary file added test/cases/umount
Binary file not shown.
Binary file added test/cases/uname
Binary file not shown.
Binary file added test/cases/unlink
Binary file not shown.
Binary file added test/cases/wait
Binary file not shown.
Binary file added test/cases/waitpid
Binary file not shown.
Binary file added test/cases/write
Binary file not shown.
Binary file added test/cases/yield
Binary file not shown.
Binary file added test/raw/sdcard.img
Binary file not shown.
Binary file added test/test.img
Binary file not shown.

0 comments on commit 52deef8

Please sign in to comment.