-
Notifications
You must be signed in to change notification settings - Fork 12
/
setup.sh
107 lines (92 loc) · 2.18 KB
/
setup.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
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 [[ -f .localconf ]]; then
source .localconf
else
TESTARCH="arm"
HOST="arndale"
GUEST1="guest1"
WEBHOST="webserver"
POWERHOST="powerhost"
REPTS="10"
echo -n "What's the architecture? [$TESTARCH]:"
read _TESTARCH
if [[ -n "$_TESTARCH" ]]; then
TESTARCH="$_TESTARCH"
fi
echo -n "What's the DNS/IP of the host? [$HOST]:"
read _HOST
if [[ -n "$_HOST" ]]; then
echo $_HOST
HOST="$_HOST"
else
echo $_HOST
fi
echo -n "What's the DNS/IP of the guest? [$GUEST1]:"
read _GUEST1
if [[ -n "$_GUEST1" ]]; then
GUEST1="$_GUEST1"
fi
echo -n "What's the DNS/IP of the web server? [$WEBHOST]:"
read _WEBHOST
if [[ -n "$_WEBHOST" ]]; then
WEBHOST="$_WEBHOST"
fi
echo -n "What's the DNS/IP of the power measurement host? [$POWERHOST]:"
read _POWERHOST
if [[ -n "$_POWERHOST" ]]; then
POWERHOST="$_POWERHOST"
fi
echo -n "How many repititions of each test do you want? [$REPTS]:"
read _REPTS
if [[ -n "$_REPTS" ]]; then
REPTS="$_REPTS"
fi
echo "TESTARCH=\"$TESTARCH\"" > .localconf
echo "HOST=\"$HOST\"" >> .localconf
echo "GUEST1=\"$GUEST1\"" >> .localconf
echo "WEBHOST=\"$WEBHOST\"" >> .localconf
echo "POWERHOST=\"$POWERHOST\"" >> .localconf
echo "REPTS=\"$REPTS\"" >> .localconf
fi
echo ""
# Commands
if [[ "$TESTARCH" == "x86" ]]; then
#START_VM_COMMAND="virsh start guest1"
#SHUTDOWN_VM_COMMAND="virsh -q destroy guest1"
START_VM_COMMAND="/home/christoffer/bin/run-guest.sh"
SHUTDOWN_VM_COMMAND="pkill kvm"
TOOLS=tools_x86
VM_CONSOLE=""
else
TESTARCH="arm"
VM_CONSOLE=/tmp/ubuntu.console
START_VM_COMMAND="cd /root && ./run-guest.sh --serial $VM_CONSOLE -m 1536"
SHUTDOWN_VM_COMMAND="pkill -9 qemu-system-arm"
TOOLS=tools
fi
# Environment
IFS=$(echo -en "\n\t ")
LOGFILE=/tmp/kvmperf.log
# Select a good results file name
_OFN=1
if [[ -z "$OUTFILE" ]]; then
echo -n "Test name?: "
read OUTFILE
if [[ -z "$OUTFILE" ]]; then
exit 1
fi
OUTFILE=`basename $OUTFILE .txt`.txt
fi
_OF="$OUTFILE"
while [[ -e results/$_OF ]]; do
_OF=`basename $OUTFILE .txt`-$_OFN.txt
_OFN=$(( $_OFN + 1 ))
done
mkdir -p results
OUTFILE=results/"$_OF"
# Silent SCP command
SSCP="scp -q"
SCP="$SSCP"
# Silent SSH command
SSH="ssh"
SSSH="ssh -q 1>/dev/null 2>/dev/null"