forked from williamfiset/DEPRECATED-data-structures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestall
executable file
·62 lines (44 loc) · 1.3 KB
/
testall
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
#!/bin/bash
for DIR in */
do
cd $DIR
echo "In directory: " $DIR
if [ -d "tests" ]; then
foundFiles="$(find ./tests -name '*Test.java')"
test_files=($foundFiles)
numTestFiles=${#test_files[@]}
# Found some java test files :)
if [ $numTestFiles -ne 0 ]; then
# Oops not able to compile java scripts
if ! javac -cp .:../junit-4.12.jar *.java tests/*Test.java -d .; then
exit 1
fi
for (( i=0; i<${numTestFiles}; i++ ));
do
class_test_file=${test_files[$i]}
echo "Executing: " $class_test_file
# Trim .java to remove leading "./" and ending ".java" characters
test_file=${class_test_file::${#class_test_file}-5}
test_file=${test_file:8}
if ! java -cp .:../junit-4.12.jar:../hamcrest-core-1.3.jar org.junit.runner.JUnitCore $test_file; then
exit 1
fi
done
rm *.class 2> /dev/null
fi
# for javaTestFile in tests/*Test.java
# do
# [ -e "$javaTestFile" ] || continue
#
# done
for pythonTestFile in tests/*.py
do
[ -e "$pythonTestFile" ] || continue
echo "Executing: python3" $pythonTestFile
if ! python3 $pythonTestFile; then
exit 1
fi
done
fi
cd ..
done