Skip to content

Commit a45e870

Browse files
wutianxing0626ToolmanP
authored andcommitted
fix(lab5): flexible timeout settings
Reviewed-by: Yiyang Wu <toolmanp@tlmp.cc>
1 parent 9302eb0 commit a45e870

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Lab5/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
LAB := 5
2-
TIMEOUT := 120
2+
TIMEOUT := 480 120 120 120 120
33

44
include $(CURDIR)/../Scripts/lab.mk

Scripts/extras/lab5/grader.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ fi
1616
cp "${FSM_DIR}/CMakeLists.txt" "${FSM_DIR}/CMakeLists.txt.bak"
1717
cp "${FS_BASE_DIR}/CMakeLists.txt" "${FS_BASE_DIR}/CMakeLists.txt.bak"
1818

19-
info "Grading lab ${LAB} ...(may take ${TIMEOUT} seconds)"
19+
read -r var1 var2 var3 var4 var5 <<< "${TIMEOUT}"
20+
info "Grading lab ${LAB} ...(may take $var1 seconds)"
21+
#info "Grading lab ${LAB} ...(may take ${TIMEOUT} seconds)"
2022
bold "==========================================="
2123
score=0
2224
# Part1 FSM
2325
cp "${CMAKE_EXTRA_DIR}/cmake-fsm-full.txt" "${FSM_DIR}/CMakeLists.txt"
2426
cp "${CMAKE_EXTRA_DIR}/cmake-fs_base-part1.txt" "${FS_BASE_DIR}/CMakeLists.txt"
2527
make distclean &> /dev/null
2628
make build &> /dev/null
27-
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part1.json -t 30 make qemu-grade 2> /dev/null
29+
info "Grading part 1 ...(may take $var2 seconds)"
30+
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part1.json -t $var2 make qemu-grade 2> /dev/null
31+
#${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part1.json -t 60 make qemu-grade 2> /dev/null
2832
score=$(($score+$?))
2933
if [[ $score -eq 255 ]]; then
3034
error "Something went wrong. Please check the output of your program"
@@ -35,7 +39,9 @@ cp "${CMAKE_EXTRA_DIR}/cmake-fsm-part2.txt" "${FSM_DIR}/CMakeLists.txt"
3539
cp "${CMAKE_EXTRA_DIR}/cmake-fs_base-part2-vnode.txt" "${FS_BASE_DIR}/CMakeLists.txt"
3640
make distclean &> /dev/null
3741
make build &> /dev/null
38-
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part2.json -t 30 make qemu-grade 2> /dev/null
42+
info "Grading part 2 ...(may take $var3 seconds)"
43+
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part2.json -t $var3 make qemu-grade 2> /dev/null
44+
#${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part2.json -t 60 make qemu-grade 2> /dev/null
3945
score=$(($score+$?))
4046
if [[ $score -eq 255 ]]; then
4147
error "Something went wrong. Please check the output of your program"
@@ -48,7 +54,9 @@ cp "${CMAKE_EXTRA_DIR}/cmake-fsm-part2.txt" "${FSM_DIR}/CMakeLists.txt"
4854
cp "${CMAKE_EXTRA_DIR}/cmake-fs_base-part2-server_entry.txt" "${FS_BASE_DIR}/CMakeLists.txt"
4955
make distclean &> /dev/null
5056
make build &> /dev/null
51-
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part3.json -t 30 make qemu-grade 2> /dev/null
57+
info "Grading part 3 ...(may take $var4 seconds)"
58+
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part3.json -t $var4 make qemu-grade 2> /dev/null
59+
#${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part3.json -t 60 make qemu-grade 2> /dev/null
5260
score=$(($score+$?))
5361
if [[ $score -eq 255 ]]; then
5462
error "Something went wrong. Please check the output of your program"
@@ -60,7 +68,9 @@ mv "${FSM_DIR}/CMakeLists.txt.bak" "${FSM_DIR}/CMakeLists.txt"
6068
mv "${FS_BASE_DIR}/CMakeLists.txt.bak" "${FS_BASE_DIR}/CMakeLists.txt"
6169
make distclean &> /dev/null
6270
make build &> /dev/null
63-
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part4.json -t 30 make qemu-grade 2> /dev/null
71+
info "Grading part 4 ...(may take $var5 seconds)"
72+
${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part4.json -t $var5 make qemu-grade 2> /dev/null
73+
#${SCRIPTS}/capturer.py -f ${LABDIR}/scores-part4.json -t 60 make qemu-grade 2> /dev/null
6474
score=$(($score+$?))
6575
if [[ $score -eq 255 ]]; then
6676
error "Something went wrong. Please check the output of your program"

0 commit comments

Comments
 (0)