forked from aJanker/TypeChef-Sampling-Busybox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvaa.sh
executable file
·62 lines (44 loc) · 1.38 KB
/
vaa.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
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Not enough arguments!" >&2
exit 1
fi
inp=$1
shift
if [ -z "$inp" ]; then
echo "inp not defined!" >&2
exit 1
fi
outBase="$(dirname $inp)/$(basename $inp .c)"
copyBase=$(echo $outBase | sed s/local/scratch/g)
outBase="$(dirname $inp)/$(basename $inp .c)"
outDbg="$outBase.dbg"
outErr="$outBase.err"
outTime="$outBase.time"
outStmtDegree="$outBase.stmt.degree"
outErrorStmtDegree="$outBase.stmt.error.degree"
copyStmtDegree="$copyBase.stmt.degree.gz"
copyErrorStmtDegree="$copyBase.stmt.error.degree.gz"
# Beware: the embedded for loop requotes the passed argument. That's dark magic,
# don't ever try to touch it. It simplifies your life as a user of this program
# though!
echo "==Partially preprocessing $inp"
echo $partialPreprocFlags
bash -c "time ../TypeChef/typechef.sh \
$(for arg in "$@"; do echo -n "\"$arg\" "; done) \
'$inp' 2> '$outErr' |tee '$outDbg'" \
2> "$outTime" || true
cat "$outErr" 1>&2
gzip -c ${outBase}.err > ${copyBase}_vaa.err.gz
gzip -c ${outBase}.dbg > ${copyBase}_vaa.dbg.gz
gzip -c $outStmtDegree > $copyStmtDegree
gzip -c $outErrorStmtDegree > $copyErrorStmtDegree
mv ${outBase}.time ${copyBase}_vaa.time
mv ${outBase}.astimes ${copyBase}_vaa.astimes
mv ${outBase}.tunit ${copyBase}.tunit
rm ${outBase}.err
rm ${outBase}.dbg
rm ${outBase}.time
rm ${outBase}.astimes
rm $outStmtDegree
rm $outErrorStmtDegree