forked from ucsd-cse15l-w23/list-examples-grader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrade.sh
38 lines (27 loc) · 712 Bytes
/
grade.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
CPATH='.:lib/hamcrest-core-1.3.jar:lib/junit-4.13.2.jar'
rm -rf student-submission
git clone $1 student-submission
echo 'Finished cloning'
cd student-submission
if [[ -f ListExamples.java ]]
then
echo 'ListExamples.java exists'
else
echo 'ListExamples.java does not exist'
exit
fi
cp ../TestListExamples.java .
cp -r ../lib .
javac -cp $CPATH *.java
echo 'Finished compiling'
java -cp $CPATH org.junit.runner.JUnitCore TestListExamples > ../output.txt
echo 'Finished running tests'
if [[ `grep -h "OK" ../output.txt` != "" ]]
then
echo 'All tests passed'
else
TESTS=`grep -h "Tests run" ../output.txt`
echo $TESTS
fi
# rm -rf student-submission
# echo 'Finished cleaning up'