-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.sh
executable file
·61 lines (55 loc) · 2.19 KB
/
runtests.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
#!/bin/bash
set -- "my"
#changes $1
mkdir $1.report
if [ $? -ne 0 ]; then
echo "Cancellare la directory $1.report"
exit 1
fi
RESULT=0
OUTPUTDIR="test_files/c_out"
mkdir -p $OUTPUTDIR
for TESTDIR in tests/*
do
TESTNAME=$(basename -- "$TESTDIR")
TESTFILE=$TESTDIR/$TESTNAME.txt
echo "" >> $1.report.txt
echo "" >> $1.report.txt
echo Test name: $TESTDIR >> $1.report.txt
echo mvn --batch-mode -q exec:java -Dexec.args="$TESTFILE" >> $1.report.txt
mvn --batch-mode -q exec:java -Dexec.args="$TESTFILE" >> $1.report.txt 2>&1
if [ -s "$OUTPUTDIR/$TESTNAME.c" ]; then
EXEFILE=$OUTPUTDIR/$TESTNAME.out
echo "" >> $1.report.txt
echo gcc $OUTPUTDIR/$TESTNAME.c -o $EXEFILE -lm -w >> $1.report.txt
gcc $OUTPUTDIR/$TESTNAME.c -o $EXEFILE -lm -w >> $1.report.txt 2>&1
for TESTIN in "$TESTDIR/$TESTNAME"_in*
do
TESTINNAME=$(basename -- "$TESTIN")
TESTOUT=$OUTPUTDIR/"${TESTINNAME/_in/_out}"
if [ -s "$EXEFILE" ]; then
$EXEFILE < $TESTIN &> $TESTOUT
else
RESULT=1
fi
echo "" >> $1.report.txt
echo diff -w "${TESTIN/_in/_out}" $TESTOUT >> $1.report.txt
diff -w "${TESTIN/_in/_out}" $TESTOUT >> $1.report.txt
done
else
echo "$OUTPUTDIR/$TESTNAME.c non esiste" >> $1.report.txt
if [[ $TESTNAME != *invalid* ]]; then
RESULT=1
fi
fi
done
mkdir $1.report/$(dirname "$OUTPUTDIR")
mv "$OUTPUTDIR" $1.report/$(dirname "$OUTPUTDIR")
mv $1.report.txt $1.report
echo 'WARNING: An illegal reflective access operation has occurred' > $1.report/skip.txt
echo 'WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)' >> $1.report/skip.txt
echo 'WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1' >> $1.report/skip.txt >> $1.report/skip.txt
echo 'WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations' >> $1.report/skip.txt
echo 'WARNING: All illegal access operations will be denied in a future release' >> $1.report/skip.txt
grep -v -x -F -f $1.report/skip.txt $1.report/$1.report.txt
exit $RESULT