forked from ucsd-cse15l-s23/list-examples-grader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grade.sh
57 lines (47 loc) · 1.15 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
CPATH='.:lib/hamcrest-core-1.3.jar:lib/junit-4.13.2.jar'
rm -rf student-submission
rm -rf grading-area
# step 1 - clone relevant to specific directory
mkdir grading-area
git clone $1 student-submission
echo 'Finished cloning'
# step 2 - check for relevant files
## check for occurences
find student-submission > find_results.txt
GREP=`grep -c "ListExamples.java" find_results.txt`
if ! [[ $GREP == 0 ]]
then
echo 'ListExamples.java found'
else
echo 'ListExamples.java not found'
fi
# step 3
find student-submission -name \*.java -exec cp {} grading-area \;
cp TestListExamples.java grading-area
cp -r lib grading-area
# step 4
cd grading-area
javac -cp $CPATH *.java > javac_output.txt
if [[ $? -eq 0 ]]
then
echo 'code successfully compiles'
else
cat javac_output.txt
exit
fi
# step 5
pwd
ls
java -cp $CPATH org.junit.runner.JUnitCore TestListExamples > test_output.txt
if [[ $? -eq 0 ]]
then
echo 'good job :)'
else
cat test_output.txt
exit
fi
cd ..
# Draw a picture/take notes on the directory structure that's set up after
# getting to this point
# Then, add here code to compile and run, and do any post-processing of the
# tests