blob: 755712a9b54f5d5a69751be060a24797476ed1fd (
plain)
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
#!/bin/bash
# Usage ./invoke_session <gateway>
set -u
set -o pipefail
error=1
trap "rm -rf ~/*; sleep infinity; exit \${error}" EXIT
# Hack for now until lava-test-shell is smart enough to know it's dispatcher ip
gateway=$1
abe_branch="$2"
#these parameters used by Benchmark.job
export benchmark="$3"
export toolchain="$4"
if test x"$5" = xNone; then
export run_flags=
else
export run_flags="$5"
fi
if test x"$6" = xNone; then
export compiler_flags=
else
export compiler_flags="$6"
fi
echo "Target's Gateway: $gateway"
env
if ! grep 'invoke_session' /etc/rc.local
then
sed -i '/bin/a invoke_session &' /etc/rc.local
fi
# Obtain target IP and Hostname
ip_addr=$(ifconfig `ip route get $gateway | cut -d ' ' -f3` | grep 'inet addr' |awk -F: '{split($2,a," "); print a[1] }')
hostname=$(cat /etc/hostname)
echo ${ip_addr}
export LAVA_MULTI_NODE_DEBUG=1
if ! lava-group; then
echo "lava-group FAILED"
exit 1
else
echo "lava-group WORKED"
fi
if ! lava-send test; then
echo "lava-send test FAILED"
exit 1
else
echo "lava-send test WORKED"
fi
if ! lava-wait-all test; then
echo "lava-wait-all test FAILED"
exit 1
else
echo "lava-wait-all test WORKED"
fi
if ! lava-send answer; then
echo "lava-send answer FAILED"
exit 1
else
echo "lava-send answer WORKED"
fi
# Set the PATH to use the LAVA api
echo "export PATH=/lava/bin/:$PATH" > ~/.bashrc
#Create directory to store src
if ! (mkdir ~/benchsrc && chmod 700 ~/benchsrc); then
echo "Failed to create directory for source" >&2
exit 1
fi
#Initialize git-new-workdir - sadly not just an apt-get call
ln /usr/share/doc/git/contrib/workdir/git-new-workdir /usr/local/bin
chmod 755 /usr/local/bin/git-new-workdir
#Get abe
export ABE_DIR=~/src/abe
mkdir -p "${ABE_DIR}" || exit 1
if ! git clone ${abe_branch:+-b ${abe_branch}} http://git.linaro.org/toolchain/abe "${ABE_DIR}"; then
rm -rf "${ABE_DIR}"
exit 1
fi
#Expect local sources
sed -i 's#ssh://git@dev-private\.git\.linaro\.org#ssh://localhost/~/benchsrc/#' "${ABE_DIR}"/config/sources.conf || exit 1
#Generate one-time key
mkdir ~/data || exit 1
if ! ssh-keygen -P '' -f ~/data/onetime > /dev/null < /dev/null; then
rm -rf ~/data
exit 1
fi
export LAVA_SSH_KEYFILE=${HOME}/data/onetime
#Need to be able to ssh to self to get local sources
#Can reuse the onetime key for this
cat ~/data/onetime.pub >> ~/.ssh/authorized_keys
if ! ssh -i ~/data/onetime -o StrictHostKeyChecking=no localhost true; then
echo "Failed to ssh to self" >&2
exit 1
fi
echo "*** WAITING FOR SOURCE: ${ip_addr}"
#while ! test -e /tmp/benchsrc_ready; do inotifywait -e create /tmp; done
echo ""
mkdir -p /run
mkdir -p /run/hacking
echo $$ > /run/hacking/hacking.pid
#Generate config file for each target in multinode job
lava-send ip
lava-wait-all ip
lava-network broadcast eth0
lava-network collect eth0
echo WAITED > /dev/console
cat /tmp/lava_multi_node_cache.txt
declare -A targets
for lava_name in `lava-group | grep '[[:blank:]]*target$' | awk '{print $1}'`; do
echo "NAME ${lava_name}" > /dev/console
target_ip="$(lava-network query ${lava_name} ipv4)"
if test $? -ne 0; then echo "Failed to find IP for ${lava_name}"; sleep infinity; exit 1; fi
if test -z "${target_ip}"; then echo "Failed to find IP for ${lava_name}"; sleep infinity; exit 1; fi
echo "IP ${target_ip}"
target_base="$(echo ${lava_name} | sed 's/[[:digit:]]*$//')" #TODO: HACK
if test $? -ne 0; then echo "Failed to find target type from ${lava_name}"; exit 1; fi
echo "TYPE ${target_base}"
sed "s/^ip=.*/ip=${target_ip}/" "${ABE_DIR}/config/boards/bench/${target_base}.json" > "${ABE_DIR}/config/boards/bench/${lava_name}.json"
if test $? -ne 0; then echo "Failed to generate config file for target ${lava_name}"; exit 1; fi
targets=("${targets[@]}" "${lava_name}")
done
export targets
echo "Running benchmark... I may be some time"
export LAVA_IN_LAB=1
"${ABE_DIR}"/scripts/Benchmark.job
echo "All done, waiting user"
sleep infinity
echo "Benchmarking session ended..."
echo "<LAVA_TEST_RUNNER>: exiting"
error=0
|