Skip to content
Snippets Groups Projects
Commit f941957b authored by Constantin Eduard Staniloiu's avatar Constantin Eduard Staniloiu Committed by Giorgiana VLĂSCEANU
Browse files

Merged in tema1_2021_checker (pull request #1)

Tema1 2021: add timeouts per test

Approved-by: Giorgiana Vlăsceanu
parents fc02748e 51be3720
Branches t2_2022
No related tags found
No related merge requests found
#!/bin/bash
TIMEOUT_VAL=360
PYTHON_CMD=python3
SRC=tema
timeout $TIMEOUT_VAL ./run_tests.sh &> result
if [ ! $? -eq 0 ]
then
echo "TIMEOUT. Tests exceeded maximum allowed time of $TIMEOUT_VAL" >> result
fi
echo -e "\nRun pylint\n" >> result
${PYTHON_CMD} -m pylint --rcfile=./pylintrc ${SRC}/*.py &>> result
awk -f parse.awk result
echo -e "\nDetailed report\n"
cat result
/Test [1-9]0*/ {printf "%s %d:\t%d\n", $1, $2, ($3 == "PASSED") ? 100 : 0 }
/TIMEOUT/
/Your code has been rated at/
......@@ -5,26 +5,35 @@ TESTS=tests
OUT=out
PYTHON_CMD=python3
for i in {1..8}
do
TIMEOUT_VALS[$i]=30
done
for i in {9..10}
do
TIMEOUT_VALS[$i]=60
done
# Cleanup the previous run's temporary files
rm -f ${TESTS}/*.out.sorted
# Run tests
for i in {1..9}
for i in {1..10}
do
rm -f "${TESTS}/0$i".out
echo "Starting test $i"
${PYTHON_CMD} test.py "${TESTS}/0$i.in" > "${TESTS}/0$i.out"
echo "Finished test $i"
${PYTHON_CMD} check_test.py $i "${TESTS}/0$i.out" "${TESTS}/0$i.ref.out"
done
prefix=$(printf "%02d" $i)
rm -f "${TESTS}/$prefix".out
echo "Starting test $i"
rm -f "${TESTS}/10".out
echo "Starting test 10"
timeout ${TIMEOUT_VALS[i]} ${PYTHON_CMD} test.py "${TESTS}/$prefix.in" > "${TESTS}/$prefix.out"
if [ ! $? -eq 0 ]
then
echo "TIMEOUT. Test $i exceeded maximum allowed time of ${TIMEOUT_VALS[i]}"
fi
${PYTHON_CMD} test.py "${TESTS}/10.in" > "${TESTS}/10.out"
echo "Finished test 10"
${PYTHON_CMD} check_test.py 10 "${TESTS}/10.out" "${TESTS}/10.ref.out"
echo "Finished test $i"
${PYTHON_CMD} check_test.py $i "${TESTS}/$prefix.out" "${TESTS}/$prefix.ref.out"
done
# Pylint checks - the pylintrc file being in the same directory
# Uncoment the following line to check your implementation's code style :)
# ${PYTHON_CMD} -m pylint ${SRC}/*.py
\ No newline at end of file
# ${PYTHON_CMD} -m pylint ${SRC}/*.py
......@@ -3,7 +3,7 @@ This module runs the homework's solution on a given testfile
Computer Systems Architecture Course
Assignment 1
March 2021
March 2020
"""
import sys
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment