-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yiyang Wu <[email protected]>
- Loading branch information
Showing
14 changed files
with
251 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
LAB := 5 | ||
TIMEOUT := 120 | ||
|
||
include $(CURDIR)/../Scripts/lab.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"capture": "All fs tests passed", | ||
"msg": "FSM", | ||
"proposed": 20, | ||
"userland": true | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"capture": "All fs tests passed", | ||
"msg": "FS_Base Vnode", | ||
"proposed": 15, | ||
"userland": true | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
{ | ||
"capture": "All fs tests passed", | ||
"msg": "FS Server Entry", | ||
"proposed": 15, | ||
"userland": true | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/urandom | head -c 13; echo) | ||
|
||
export LABROOT LABDIR SCRIPTS LAB TIMEOUT | ||
|
||
all: build | ||
|
||
defconfig: | ||
$(Q)$(CHBUILD) defconfig | ||
|
||
build: | ||
$(Q)test -f $(LABDIR)/.config || $(CHBUILD) defconfig | ||
$(Q)$(CHBUILD) build | ||
$(Q)find $(LABDIR) -path */compile_commands.json \ | ||
! -path $(LABDIR)/compile_commands.json -print \ | ||
| $(SCRIPTS)/merge_compile_commands.py | ||
|
||
clean: | ||
$(Q)$(CHBUILD) clean | ||
|
||
distclean: | ||
$(Q)$(CHBUILD) distclean | ||
|
||
qemu: build | ||
$(Q)$(_QEMU) $(QEMU_OPTS) | ||
|
||
qemu-grade: | ||
$(Q)$(CHBUILD) clean | ||
$(MAKE) build | ||
$(Q)$(_QEMU) $(QEMU_OPTS) | ||
|
||
qemu-gdb: build | ||
$(Q)echo "[QEMU] Waiting for GDB Connection" | ||
$(Q)$(_QEMU) -S -gdb tcp::$(QEMU_GDB_PORT) $(QEMU_OPTS) | ||
|
||
gdb: | ||
$(Q)$(GDB) --nx -x $(SCRIPTS)/gdb/gdbinit | ||
|
||
grade: | ||
$(MAKE) distclean | ||
$(Q)$(GRADER) | ||
|
||
.PHONY: qemu qemu-gdb gdb defconfig build clean distclean grade all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) | ||
# Licensed under the Mulan PSL v2. | ||
# You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
# You may obtain a copy of Mulan PSL v2 at: | ||
# http://license.coscl.org.cn/MulanPSL2 | ||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR | ||
# PURPOSE. | ||
# See the Mulan PSL v2 for more details. | ||
|
||
add_library(fs_base STATIC fs_page_cache.c fs_page_fault.c fs_vnode.c | ||
fs_wrapper_ops.c fs_wrapper.c) | ||
target_include_directories(fs_base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
chcore_copy_all_targets_to_ramdisk() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) | ||
# Licensed under the Mulan PSL v2. | ||
# You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
# You may obtain a copy of Mulan PSL v2 at: | ||
# http://license.coscl.org.cn/MulanPSL2 | ||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR | ||
# PURPOSE. | ||
# See the Mulan PSL v2 for more details. | ||
|
||
add_library(fs_base STATIC fs_page_cache.c fs_page_fault.c fs_wrapper.c.obj | ||
fs_wrapper_ops.c.obj fs_vnode.c.obj) | ||
target_include_directories(fs_base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
chcore_copy_all_targets_to_ramdisk() |
14 changes: 14 additions & 0 deletions
14
Scripts/extras/lab5/cmake/cmake-fs_base-part2-server_entry.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) | ||
# Licensed under the Mulan PSL v2. | ||
# You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
# You may obtain a copy of Mulan PSL v2 at: | ||
# http://license.coscl.org.cn/MulanPSL2 | ||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR | ||
# PURPOSE. | ||
# See the Mulan PSL v2 for more details. | ||
|
||
add_library(fs_base STATIC fs_page_cache.c fs_page_fault.c fs_wrapper.c | ||
fs_wrapper_ops.c.obj fs_vnode.c) | ||
target_include_directories(fs_base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
chcore_copy_all_targets_to_ramdisk() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) | ||
# Licensed under the Mulan PSL v2. | ||
# You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
# You may obtain a copy of Mulan PSL v2 at: | ||
# http://license.coscl.org.cn/MulanPSL2 | ||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR | ||
# PURPOSE. | ||
# See the Mulan PSL v2 for more details. | ||
|
||
add_library(fs_base STATIC fs_page_cache.c fs_page_fault.c fs_wrapper.c.obj | ||
fs_wrapper_ops.c.obj fs_vnode.c) | ||
target_include_directories(fs_base PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
chcore_copy_all_targets_to_ramdisk() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) | ||
# Licensed under the Mulan PSL v2. | ||
# You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
# You may obtain a copy of Mulan PSL v2 at: | ||
# http://license.coscl.org.cn/MulanPSL2 | ||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR | ||
# PURPOSE. | ||
# See the Mulan PSL v2 for more details. | ||
|
||
add_executable(fsm.srv device.c fsm.c fsm_client_cap.c mount_disk_fs.c mount_info.c) | ||
add_library(yaml STATIC IMPORTED) | ||
set_target_properties(yaml PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/libs/libyaml.a") | ||
target_link_libraries(fsm.srv PRIVATE yaml) | ||
target_include_directories(fsm.srv PRIVATE .) | ||
chcore_all_force_static_linked() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) | ||
# Licensed under the Mulan PSL v2. | ||
# You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
# You may obtain a copy of Mulan PSL v2 at: | ||
# http://license.coscl.org.cn/MulanPSL2 | ||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR | ||
# PURPOSE. | ||
# See the Mulan PSL v2 for more details. | ||
|
||
add_executable(fsm.srv device.c fsm.c.obj fsm_client_cap.c.obj mount_disk_fs.c mount_info.c) | ||
add_library(yaml STATIC IMPORTED) | ||
set_target_properties(yaml PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/libs/libyaml.a") | ||
target_link_libraries(fsm.srv PRIVATE yaml) | ||
target_include_directories(fsm.srv PRIVATE .) | ||
chcore_all_force_static_linked() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
CMAKE_EXTRA_DIR="${LABROOT}/Scripts/extras/lab5/cmake" | ||
SYSTEM_SERVER_DIR="${LABDIR}/user/system-services/system-servers" | ||
FSM_DIR="${SYSTEM_SERVER_DIR}/fsm" | ||
FS_BASE_DIR="${SYSTEM_SERVER_DIR}/fs_base" | ||
|
||
test -f ${LABDIR}/.config && cp ${LABDIR}/.config ${LABDIR}/.config.bak | ||
|
||
if [[ -z $LABROOT ]]; then | ||
echo "Please set the LABROOT environment variable to the root directory of your project. (Makefile)" | ||
exit 1 | ||
fi | ||
|
||
. ${LABROOT}/Scripts/shellenv.sh | ||
|
||
cp "${FSM_DIR}/CMakeLists.txt" "${FSM_DIR}/CMakeLists.txt.bak" | ||
cp "${FS_BASE_DIR}/CMakeLists.txt" "${FS_BASE_DIR}/CMakeLists.txt.bak" | ||
|
||
info "Grading lab ${LAB} ...(may take ${TIMEOUT} seconds)" | ||
bold "===========================================" | ||
score=0 | ||
# Part1 FSM | ||
cp "${CMAKE_EXTRA_DIR}/cmake-fsm-full.txt" "${FSM_DIR}/CMakeLists.txt" | ||
cp "${CMAKE_EXTRA_DIR}/cmake-fs_base-part1.txt" "${FS_BASE_DIR}/CMakeLists.txt" | ||
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part1.json -t 30 make qemu-grade 2> /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters