Skip to content

Commit

Permalink
fix: add checks around return code 255
Browse files Browse the repository at this point in the history
Signed-off-by: Yiyang Wu <[email protected]>
  • Loading branch information
ToolmanP committed Oct 29, 2024
1 parent 3ba870f commit d22d42e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Scripts/capturer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
print(
"This script requires Python version 3.7 and later. Please upgrade your Python version to grade this lab."
)
sys.exit(0)
sys.exit(255)

try:
import psutil
Expand Down
16 changes: 16 additions & 0 deletions Scripts/extras/lab5/grader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,37 @@ 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+$?))
if [[ $score -eq 255 ]]; then
error "Something went wrong. Please check the output of your program"
exit 0
fi
# 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+$?))
if [[ $score -eq 255 ]]; then
error "Something went wrong. Please check the output of your program"
exit 0
fi
# 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+$?))
if [[ $score -eq 255 ]]; then
error "Something went wrong. Please check the output of your program"
exit 0
fi
# 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+$?))
if [[ $score -eq 255 ]]; then
error "Something went wrong. Please check the output of your program"
exit 0
fi

info "Score: $score/100"
bold "==========================================="
Expand Down
6 changes: 6 additions & 0 deletions Scripts/grader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ info "Grading lab ${LAB} ...(may take ${TIMEOUT} seconds)"
bold "==========================================="
${LABROOT}/Scripts/capturer.py $@ 2> /dev/null
score=$?

if [[ $score -eq 255 ]]; then
error "Something went wrong. Please check the output of your program"
exit 0
fi

info "Score: $score/100"
bold "==========================================="

Expand Down

0 comments on commit d22d42e

Please sign in to comment.