Skip to content

Commit

Permalink
fix(lab5): flexible timeout settings
Browse files Browse the repository at this point in the history
Reviewed-by: Yiyang Wu <[email protected]>
  • Loading branch information
Birdman0626 authored and ToolmanP committed Jan 16, 2025
1 parent 9302eb0 commit a45e870
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Lab5/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LAB := 5
TIMEOUT := 120
TIMEOUT := 480 120 120 120 120

include $(CURDIR)/../Scripts/lab.mk
20 changes: 15 additions & 5 deletions Scripts/extras/lab5/grader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ fi
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)"
read -r var1 var2 var3 var4 var5 <<< "${TIMEOUT}"
info "Grading lab ${LAB} ...(may take $var1 seconds)"
#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"
make distclean &> /dev/null
make build &> /dev/null
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part1.json -t 30 make qemu-grade 2> /dev/null
info "Grading part 1 ...(may take $var2 seconds)"
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part1.json -t $var2 make qemu-grade 2> /dev/null
#${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part1.json -t 60 make qemu-grade 2> /dev/null
score=$(($score+$?))
if [[ $score -eq 255 ]]; then
error "Something went wrong. Please check the output of your program"
Expand All @@ -35,7 +39,9 @@ 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"
make distclean &> /dev/null
make build &> /dev/null
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part2.json -t 30 make qemu-grade 2> /dev/null
info "Grading part 2 ...(may take $var3 seconds)"
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part2.json -t $var3 make qemu-grade 2> /dev/null
#${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part2.json -t 60 make qemu-grade 2> /dev/null
score=$(($score+$?))
if [[ $score -eq 255 ]]; then
error "Something went wrong. Please check the output of your program"
Expand All @@ -48,7 +54,9 @@ 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"
make distclean &> /dev/null
make build &> /dev/null
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part3.json -t 30 make qemu-grade 2> /dev/null
info "Grading part 3 ...(may take $var4 seconds)"
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part3.json -t $var4 make qemu-grade 2> /dev/null
#${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part3.json -t 60 make qemu-grade 2> /dev/null
score=$(($score+$?))
if [[ $score -eq 255 ]]; then
error "Something went wrong. Please check the output of your program"
Expand All @@ -60,7 +68,9 @@ mv "${FSM_DIR}/CMakeLists.txt.bak" "${FSM_DIR}/CMakeLists.txt"
mv "${FS_BASE_DIR}/CMakeLists.txt.bak" "${FS_BASE_DIR}/CMakeLists.txt"
make distclean &> /dev/null
make build &> /dev/null
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part4.json -t 30 make qemu-grade 2> /dev/null
info "Grading part 4 ...(may take $var5 seconds)"
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part4.json -t $var5 make qemu-grade 2> /dev/null
#${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part4.json -t 60 make qemu-grade 2> /dev/null
score=$(($score+$?))
if [[ $score -eq 255 ]]; then
error "Something went wrong. Please check the output of your program"
Expand Down

0 comments on commit a45e870

Please sign in to comment.