-
Notifications
You must be signed in to change notification settings - Fork 0
/
checker.sh
91 lines (67 loc) · 1.57 KB
/
checker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
echo "Start time: $(date)"
FOLDERS=../tests/*
HW_PATH=com/apd/tema2/Main
ROOT=./src
ERR=./err
OUT=./out
echo -e "Show CPU info (lscpu)\n\n"
lscpu
echo -e "\n\nShow memory info (free -m)\n\n"
free -m
echo -e "\n\n"
echo -e "Unzip tests and student solution\n\n"
unzip artifact.zip
unzip archive.zip
echo -e "\n\nRunning the checker\n\n"
if [ -d "$ROOT" ]; then
rm -rf out err src/bin
mkdir out err
cd src
javac -g $HW_PATH.java -d bin
for d in $FOLDERS
do
for f in $d/*
do
echo "Processing $f file..."
fullpath=`echo "${f%.*}"`
filename="${fullpath##*/}"
timeout 180 java -cp bin/ $HW_PATH $f > ../out/$filename.out
x=0
while [ $x -le 4 ] && [[ $filename =~ ^complex_maintenance_[0-9]$ ]] && [ ! -s ../out/$filename.out ]
do
timeout 180 java -cp bin/ $HW_PATH $f > ../out/$filename.out
x=$(( $x + 1))
if [ -s ../out/$filename.out ]
then
echo $filename filled after $x attempts
fi
done
if [ ! -s ../out/$filename.out ]
then
echo $filename filled after $x attempts
fi
if [ $? != 0 ]
then
echo "Timer exceeded"
fi
done
done
cd ..
timeout 180 java -jar ./Tema2Checker_J8.jar
for f in $ERR/*
do
if [[ -s $f ]]
then
echo "Contents of the err file $f"
cat $f
fullpath=`echo "${f%.*}"`
filename="${fullpath##*/}"
echo "Contents of the out file $filename.out"
head --lines=150 $OUT/$filename.out
fi
done
else
echo "src not found"
fi
echo "End time: $(date)"