-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrunTests
executable file
·107 lines (94 loc) · 3.46 KB
/
runTests
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
if [[ "$#" -lt 3 || ("$3" != "rb" && "$3" != "rg" && "$3" != "rh") ]]
then
echo "Usage: "$0" <Tools> <Tools_Path> <Result Type> <Num Trials> <Target Base Path>"
echo "Result Type:"
echo "rb: benchmark only"
echo "rg: benchmark and generalized foreground and background graph only"
echo "rh: html page displaying benchmark and generalied foreground and background graph"
exit 1
fi
sudo mkdir finalResult > /dev/null 2>&1
row=""
if [[ "$#" -eq 5 ]]
then
basepath="$5"
else
basepath="baseSyscall"
fi
for i in `ls benchmarkProgram/$basepath`
do
for j in `ls benchmarkProgram/$basepath/$i`
do
syscall=${j:3}
syscall=${syscall,,}
if [ -e finalResult/$syscall ]
then
sudo rm -f finalResult/$syscall/*
else
sudo mkdir finalResult/$syscall > /dev/null 2>&1
fi
echo "Generating provenance benchmark for $syscall in group $i using $1 settings..."
sudo ./ProvMark bg $1 $2 benchmarkProgram/$basepath/$i/$j $4
unset benchmark
for result in `ls result/result-*.clingo`
do
fingerprint=`echo $result | cut -d- -f2 | cut -d. -f1`
sudo cp $result "finalResult/$syscall/benchmark-$fingerprint.clingo"
sudo genClingoGraph/clingo2Dot.py $result $fingerprint.dot
sudo dot -Tsvg -o "finalResult/$syscall/benchmark-$fingerprint.svg" $fingerprint.dot
sudo rm -f $fingerprint.dot
if [ ! -z $benchmark ]
then
benchmark=$benchmark"<br/><hr/><br/>"
fi
benchmark=$benchmark$(cat template/element.html | sed "s|@@@ELEMENT@@@|benchmark-${fingerprint}|g")
done
if [ "$3" != "rb" ]
then
unset background
for result in `ls result/general.clingo-control-*`
do
fingerprint=`echo $result | cut -d- -f3`
sudo cp $result "finalResult/$syscall/background-$fingerprint.clingo"
sudo genClingoGraph/clingo2Dot.py $result $fingerprint.dot
sudo dot -Tsvg -o "finalResult/$syscall/background-$fingerprint.svg" $fingerprint.dot
sudo rm -f $fingerprint.dot
if [ ! -z $background ]
then
background=$background"<br/><hr/><br/>"
fi
background=$background$(cat template/element.html | sed "s|@@@ELEMENT@@@|background-${fingerprint}|g")
done
unset foreground
for result in `ls result/general.clingo-program-*`
do
fingerprint=`echo $result | cut -d- -f3`
sudo cp $result "finalResult/$syscall/foreground-$fingerprint.clingo"
sudo genClingoGraph/clingo2Dot.py $result $fingerprint.dot
sudo dot -Tsvg -o "finalResult/$syscall/foreground-$fingerprint.svg" $fingerprint.dot
sudo rm -f $fingerprint.dot
if [ ! -z $foreground ]
then
foreground=$foreground"<br/><hr/><br/>"
fi
foreground=$foreground$(cat template/element.html | sed "s|@@@ELEMENT@@@|foreground-${fingerprint}|g")
done
if [ "$3" = "rh" ]
then
newrow=$(cat template/row.html | sed "s|@@@BACKGROUND@@@|${background}|g")
newrow=$(echo $newrow | sed "s|@@@FOREGROUND@@@|${foreground}|g")
newrow=$(echo $newrow | sed "s|@@@BENCHMARK@@@|${benchmark}|g")
newrow=$(echo $newrow | sed "s|@@@SYSCALL@@@|${syscall}|g")
row=$row$newrow
fi
fi
echo "Process complete for $syscall."
done
done
if [ "$3" = "rh" ]
then
html=$(sudo cat template/base.html)
echo "${html%@@@TABLEROW@@@*} $row ${html##*@@@TABLEROW@@@}" | sudo tee finalResult/index.html > /dev/null
fi
echo "Process done. Result in finalResult directory."