From e432a4f7ab90021686cc56e37f1341874ad7e091 Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Mon, 14 Oct 2024 17:10:09 +0800 Subject: [PATCH] feat(lab5): specialize lab5 grader Signed-off-by: Yiyang Wu --- Lab5/Makefile | 1 + Lab5/scores-part1.json | 8 +++ Lab5/scores-part2.json | 8 +++ Lab5/scores-part3.json | 8 +++ Lab5/scores-part4.json | 26 +++++++++ Scripts/extras/lab5.mk | 56 +++++++++++++++++++ .../extras/lab5/cmake/cmake-fs_base-full.txt | 14 +++++ .../extras/lab5/cmake/cmake-fs_base-part1.txt | 14 +++++ .../cmake-fs_base-part2-server_entry.txt | 14 +++++ .../lab5/cmake/cmake-fs_base-part2-vnode.txt | 14 +++++ Scripts/extras/lab5/cmake/cmake-fsm-full.txt | 16 ++++++ Scripts/extras/lab5/cmake/cmake-fsm-part2.txt | 16 ++++++ Scripts/extras/lab5/grader.sh | 54 ++++++++++++++++++ Scripts/lab.mk | 4 +- 14 files changed, 251 insertions(+), 2 deletions(-) create mode 100644 Lab5/scores-part1.json create mode 100644 Lab5/scores-part2.json create mode 100644 Lab5/scores-part3.json create mode 100644 Lab5/scores-part4.json create mode 100644 Scripts/extras/lab5.mk create mode 100644 Scripts/extras/lab5/cmake/cmake-fs_base-full.txt create mode 100644 Scripts/extras/lab5/cmake/cmake-fs_base-part1.txt create mode 100644 Scripts/extras/lab5/cmake/cmake-fs_base-part2-server_entry.txt create mode 100644 Scripts/extras/lab5/cmake/cmake-fs_base-part2-vnode.txt create mode 100644 Scripts/extras/lab5/cmake/cmake-fsm-full.txt create mode 100644 Scripts/extras/lab5/cmake/cmake-fsm-part2.txt create mode 100755 Scripts/extras/lab5/grader.sh diff --git a/Lab5/Makefile b/Lab5/Makefile index 6ccc2007..34bdada9 100644 --- a/Lab5/Makefile +++ b/Lab5/Makefile @@ -1,3 +1,4 @@ LAB := 5 +TIMEOUT := 120 include $(CURDIR)/../Scripts/lab.mk diff --git a/Lab5/scores-part1.json b/Lab5/scores-part1.json new file mode 100644 index 00000000..b106f60c --- /dev/null +++ b/Lab5/scores-part1.json @@ -0,0 +1,8 @@ +[ + { + "capture": "All fs tests passed", + "msg": "FSM", + "proposed": 20, + "userland": true + } +] diff --git a/Lab5/scores-part2.json b/Lab5/scores-part2.json new file mode 100644 index 00000000..b65a64c8 --- /dev/null +++ b/Lab5/scores-part2.json @@ -0,0 +1,8 @@ +[ + { + "capture": "All fs tests passed", + "msg": "FS_Base Vnode", + "proposed": 15, + "userland": true + } +] diff --git a/Lab5/scores-part3.json b/Lab5/scores-part3.json new file mode 100644 index 00000000..3bcd281a --- /dev/null +++ b/Lab5/scores-part3.json @@ -0,0 +1,8 @@ +[ + { + "capture": "All fs tests passed", + "msg": "FS Server Entry", + "proposed": 15, + "userland": true + } +] diff --git a/Lab5/scores-part4.json b/Lab5/scores-part4.json new file mode 100644 index 00000000..96ca30f1 --- /dev/null +++ b/Lab5/scores-part4.json @@ -0,0 +1,26 @@ +[ + { + "capture": "test_open finished", + "msg": "wrapper open & close", + "proposed": 10, + "userland": true + }, + { + "capture": "test_content finished", + "msg": "wrapper read & write", + "proposed": 20, + "userland": true + }, + { + "capture": "test_lseek finished", + "msg": "wrapper lseek", + "proposed": 10, + "userland": true + }, + { + "capture": "test_mmap finished", + "msg": "wrapper mmap", + "proposed": 10, + "userland": true + } +] diff --git a/Scripts/extras/lab5.mk b/Scripts/extras/lab5.mk new file mode 100644 index 00000000..e134ce3e --- /dev/null +++ b/Scripts/extras/lab5.mk @@ -0,0 +1,56 @@ +V ?= 0 +Q := @ + +ifeq ($(V), 1) + Q := +endif + +GRADER := $(SCRIPTS)/extras/lab5/grader.sh +BUILDDIR := $(LABDIR)/build +KERNEL_IMG := $(BUILDDIR)/kernel.img +_QEMU := $(SCRIPTS)/qemu_wrapper.sh $(QEMU) +QEMU_GDB_PORT := 1234 +QEMU_OPTS := -machine raspi3b -nographic -serial mon:stdio -m size=1G -kernel $(KERNEL_IMG) +CHBUILD := $(SCRIPTS)/chbuild +SERIAL := $(shell tr -dc A-Za-z0-9 /dev/null +score=$(($score+$?)) +# Part2 VNode +cp "${CMAKE_EXTRA_DIR}/cmake-fsm-part2.txt" "${FSM_DIR}/CMakeLists.txt" +cp "${CMAKE_EXTRA_DIR}/cmake-fs_base-part2-vnode.txt" "${FS_BASE_DIR}/CMakeLists.txt" +${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part2.json -t 30 make qemu-grade 2> /dev/null +score=$(($score+$?)) +# Part3 Server Entry +cp "${CMAKE_EXTRA_DIR}/cmake-fsm-part2.txt" "${FSM_DIR}/CMakeLists.txt" +cp "${CMAKE_EXTRA_DIR}/cmake-fs_base-part2-server_entry.txt" "${FS_BASE_DIR}/CMakeLists.txt" +${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part3.json -t 30 make qemu-grade 2> /dev/null +score=$(($score+$?)) +# Part4 Ops +mv "${FSM_DIR}/CMakeLists.txt.bak" "${FSM_DIR}/CMakeLists.txt" +mv "${FS_BASE_DIR}/CMakeLists.txt.bak" "${FS_BASE_DIR}/CMakeLists.txt" +${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part4.json -t 30 make qemu-grade 2> /dev/null +score=$(($score+$?)) + +info "Score: $score/100" +bold "===========================================" + +test -f ${LABDIR}/.config.bak && cp ${LABDIR}/.config.bak ${LABDIR}/.config && rm .config.bak +cp "${CMAKE_EXTRA_DIR}/cmake-fsm-part2.txt" "${FSM_DIR}/CMakeLists.txt" + +if [[ $score -lt 100 ]]; then + exit $? +else + exit 0 +fi diff --git a/Scripts/lab.mk b/Scripts/lab.mk index febf8469..97e7c085 100644 --- a/Scripts/lab.mk +++ b/Scripts/lab.mk @@ -17,7 +17,7 @@ endif LABDIR := $(LABROOT)/Lab$(LAB) SCRIPTS := $(LABROOT)/Scripts -GRADER := $(SCRIPTS)/grader.sh +GRADER ?= $(SCRIPTS)/grader.sh include $(SCRIPTS)/env_generated.mk @@ -32,7 +32,7 @@ TIMEOUT ?= 10 ifeq ($(shell test $(LAB) -eq 0; echo $$?),1) QEMU := $(QEMU-SYS) - ifeq ($(shell test $(LAB) -gt 5; echo $$?),0) + ifeq ($(shell test $(LAB) -gt 4; echo $$?),0) include $(LABROOT)/Scripts/extras/lab$(LAB).mk else include $(LABROOT)/Scripts/kernel.mk