forked from KomaEc/crown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkcomparison.sh
executable file
·80 lines (65 loc) · 2.25 KB
/
mkcomparison.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
set -euf
function preprocess {
if [ -d comparison/$1/analysed ]; then
rm -r comparison/$1/analysed
fi
cp -r comparison/$1/before comparison/$1/analysed
}
preprocess laertes-crown
preprocess laertes-laertes
./preprocess.sh comparison/laertes-crown/analysed
./analyse.sh comparison/laertes-crown/analysed
./evaluate.sh comparison/laertes-crown/before comparison/laertes-crown/analysed comparison/laertes-crown/after
mv evaluation.csv comparison/laertes-crown
PROJ_DIR=$(dirname $0)
RUSTC_PATH=$(rustc --print sysroot)/lib
CROWN=$PROJ_DIR/target/release/crown
if [[ "$OSTYPE" == "darwin"* ]]; then
# add rustc lib to dyld path
export DYLD_FALLBACK_LIBRARY_PATH=$RUSTC_PATH
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
export LD_LIBRARY_PATH=$RUSTC_PATH
else
echo "platform $OSTYPE" not supported
exit 1
fi
# Preprocess
while IFS= read -r path; do
BENCH=$(echo $path | cut -d "/" -f1)
echo "preprocessing $BENCH"
ENTRY=comparison/laertes-laertes/analysed/$path
$CROWN $ENTRY preprocess in-place
$CROWN $ENTRY explicit-addr in-place
done < comparison/laertes-path
while IFS= read -r path; do
BENCH=$(echo $path | cut -d "/" -f1)
ENTRY=comparison/laertes-laertes/analysed/$path
mkdir comparison/laertes-laertes/analysed/$BENCH/analysis_results
$CROWN $ENTRY analyse comparison/laertes-laertes/analysed/$BENCH/analysis_results
done < comparison/laertes-path
EVALUATION=$PROJ_DIR/target/release/evaluation
SUMMARY=comparison/laertes-laertes/evaluation.csv
if [ -f $SUMMARY ]; then
rm $SUMMARY
fi
while IFS= read -r path; do
BENCH=$(echo $path | cut -d "/" -f1)
echo "evaluating $BENCH"
# BENCH_DIR=comparison/laertes-laertes/analysed/$BENCH
ENTRY=comparison/laertes-laertes/after/$path
ANALYSED=comparison/laertes-laertes/analysed/$BENCH/analysis_results
ORIGINAL=comparison/laertes-laertes/before/$path
TEMP=$(mktemp)
$EVALUATION $ORIGINAL $ANALYSED $ENTRY --output-csv $TEMP
(printf '%s' "$BENCH,"; cat $TEMP; printf '\n') >> $SUMMARY
rm $TEMP
done < comparison/laertes-path
CUT=""
if [[ "$OSTYPE" == "darwin"* ]]; then
CUT=gcut
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
CUT=cut
fi
TEMP=$(mktemp)
cat $SUMMARY | $CUT --complement -d, -f 2-4,8-10 > $TEMP
mv $TEMP $SUMMARY