Merge lp:~liuyq0307/lava-android-test/workload into lp:lava-android-test

Proposed by Yongqin Liu
Status: Merged
Merged at revision: 221
Proposed branch: lp:~liuyq0307/lava-android-test/workload
Merge into: lp:lava-android-test
Diff against target: 226 lines (+182/-5)
3 files modified
lava_android_test/provider.py (+1/-3)
lava_android_test/test_definitions/hostshells/workload.sh (+147/-0)
lava_android_test/testdef.py (+34/-2)
To merge this branch: bzr merge lp:~liuyq0307/lava-android-test/workload
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
vishal Pending
Review via email: mp+139262@code.launchpad.net

This proposal supersedes a proposal from 2012-12-06.

Description of the change

add test for workload on b.L system
according to the talk on IRC, change to use local git url as default, also add support for specification of git url

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote : Posted in a previous version of this proposal

Before going too far into this, I wanted to mention my general thought:

This seems to be using ADB to generate workload intensive stuff. I think
this is probably the wrong way to be doing this. I think the bigLITTLE
switcher tests is a better approach where its written entirely for the
target. This seems way better, and will ultimately better fit with our
lava-test-shell efforts.

On 12/06/2012 07:06 AM, Yongqin Liu wrote:
> + git_url="ssh://<email address hidden>/srv/linaro-private.git.linaro.org/people/bhoj/workload-automation.git"

That's not going to work for anyone but you.

Revision history for this message
Yongqin Liu (liuyq0307) wrote : Posted in a previous version of this proposal

> Before going too far into this, I wanted to mention my general thought:
>
> This seems to be using ADB to generate workload intensive stuff. I think
> this is probably the wrong way to be doing this. I think the bigLITTLE
> switcher tests is a better approach where its written entirely for the
> target. This seems way better, and will ultimately better fit with our
> lava-test-shell efforts.

not see the detail implementation of workload test, but it seems to download
the apk of nbench, and install it to device, and do other things.

and for this workload test, are all the steps need to be run on host side
able to be done with lava-test-shell?
  git clone
  update ip in config
  run python workload_setup_dependencies.py
  python workload.py ${config_file} ${outputdir}/

> On 12/06/2012 07:06 AM, Yongqin Liu wrote:
> > + git_url="ssh://<email address hidden>/srv/linaro-
> private.git.linaro.org/people/bhoj/workload-automation.git"
>
> That's not going to work for anyone but you.
Or, what you mean is to rewrite the workload test via lava-test-shell?

Revision history for this message
Andy Doan (doanac) wrote : Posted in a previous version of this proposal

On 12/06/2012 09:02 PM, Yongqin Liu wrote:
>> Before going too far into this, I wanted to mention my general thought:
>>
>> This seems to be using ADB to generate workload intensive stuff. I think
>> this is probably the wrong way to be doing this. I think the bigLITTLE
>> switcher tests is a better approach where its written entirely for the
>> target. This seems way better, and will ultimately better fit with our
>> lava-test-shell efforts.
>
> not see the detail implementation of workload test, but it seems to download
> the apk of nbench, and install it to device, and do other things.

I think this could be a quick patch to lava-test-shell. We have "deps"
support for Ubuntu. We could do similar for Android.

> and for this workload test, are all the steps need to be run on host side
> able to be done with lava-test-shell?
> git clone
> update ip in config
> run python workload_setup_dependencies.py
> python workload.py ${config_file} ${outputdir}/

We don't have to do the exact steps. git-clone is supported. not sure
about the ip update. The setup deps could be done in an equivalent
manner. Instead of thinking "how do we do this on host in python", I'm
saying ask yourself - "how could I do this as a script that ran on the
target"? I don't think it would be that hard.

If you absolutely think I'm crazy, then continue with this approach, but
doing a "workload" test and requiring ADB seems like a bad idea.

>> On 12/06/2012 07:06 AM, Yongqin Liu wrote:
>>> + git_url="ssh://<email address hidden>/srv/linaro-
>> private.git.linaro.org/people/bhoj/workload-automation.git"
>>
>> That's not going to work for anyone but you.
> Or, what you mean is to rewrite the workload test via lava-test-shell?

No - i just meant that the git url you had there will only work for you
with your ssh keys :)

Revision history for this message
vishal (vishalbhoj) wrote : Posted in a previous version of this proposal

On 7 December 2012 22:34, Andy Doan <email address hidden> wrote:

> On 12/06/2012 09:02 PM, Yongqin Liu wrote:
> >> Before going too far into this, I wanted to mention my general thought:
> >>
> >> This seems to be using ADB to generate workload intensive stuff. I think
> >> this is probably the wrong way to be doing this. I think the bigLITTLE
> >> switcher tests is a better approach where its written entirely for the
> >> target. This seems way better, and will ultimately better fit with our
> >> lava-test-shell efforts.
> >
> > not see the detail implementation of workload test, but it seems to
> download
> > the apk of nbench, and install it to device, and do other things.
>
> I think this could be a quick patch to lava-test-shell. We have "deps"
> support for Ubuntu. We could do similar for Android.
>
> > and for this workload test, are all the steps need to be run on host side
> > able to be done with lava-test-shell?
> > git clone
> > update ip in config
> > run python workload_setup_dependencies.py
> > python workload.py ${config_file} ${outputdir}/
>
> We don't have to do the exact steps. git-clone is supported. not sure
> about the ip update. The setup deps could be done in an equivalent
> manner. Instead of thinking "how do we do this on host in python", I'm
> saying ask yourself - "how could I do this as a script that ran on the
> target"? I don't think it would be that hard.
>

I get your point here. But the whole benchmark is written by ARM to run
over adb + they even take control of serial terminal similar to LAVA( we
don't execute that path but rely on LAVA to reboot etc).

>
> If you absolutely think I'm crazy, then continue with this approach, but
> doing a "workload" test and requiring ADB seems like a bad idea.
>

adb is used only to transfer the files before and after the benchmark is
run and not while the benchmark is running.

>
> >> On 12/06/2012 07:06 AM, Yongqin Liu wrote:
> >>> + git_url="ssh://
> <email address hidden>/srv/linaro-
> >> private.git.linaro.org/people/bhoj/workload-automation.git"
> >>
> >> That's not going to work for anyone but you.
> > Or, what you mean is to rewrite the workload test via lava-test-shell?
>
> No - i just meant that the git url you had there will only work for you
> with your ssh keys :)
>
>
> --
>
> https://code.launchpad.net/~liuyq0307/lava-android-test/workload/+merge/138448
> You are requested to review the proposed merge of
> lp:~liuyq0307/lava-android-test/workload into lp:lava-android-test.
>

Revision history for this message
Andy Doan (doanac) wrote : Posted in a previous version of this proposal

On 12/07/2012 11:13 AM, vishal wrote:
> I get your point here. But the whole benchmark is written by ARM to run
> over adb + they even take control of serial terminal similar to LAVA( we
> don't execute that path but rely on LAVA to reboot etc).

So use lava-android-test.

Its a little frustrating though:

* Android guys complained for over a year about "no blackbox testing".

* Benchmark guys complained about all Android results being invalid
because of the same basic thing.

We now have a solution in place, and you guys don't seem to be
interested in using it.

>> >
>> >If you absolutely think I'm crazy, then continue with this approach, but
>> >doing a "workload" test and requiring ADB seems like a bad idea.
>> >
> adb is used only to transfer the files before and after the benchmark is
> run and not while the benchmark is running.

So that could be done in lava-test-shell :)

Revision history for this message
Yongqin Liu (liuyq0307) wrote : Posted in a previous version of this proposal

> On 12/07/2012 11:13 AM, vishal wrote:
> > I get your point here. But the whole benchmark is written by ARM to run
> > over adb + they even take control of serial terminal similar to LAVA( we
> > don't execute that path but rely on LAVA to reboot etc).
>
> So use lava-android-test.
If this means you aggree this branch for now, please approve this MP.
>
> Its a little frustrating though:
>
> * Android guys complained for over a year about "no blackbox testing".
>
what I know about this is for the network test problem which the adb connection that lava-android-test relies on.
> * Benchmark guys complained about all Android results being invalid
> because of the same basic thing.
not know the details, but from the what I can guess it's not a problem lava can resolve,
normally benchmark tools only displayed the result with GUI where command tools are not able to get.
I don't think lava-test-shell can help on this, if it can do, I am glad to know how it implemented.

> We now have a solution in place, and you guys don't seem to be
> interested in using it.
Actually at least I am interesting in it,
but if you ask me to reimplement an existing tool which works well with adb connection,
then I will want to know why, and know how much time it will take to reimplement.

> >> >If you absolutely think I'm crazy, then continue with this approach, but
> >> >doing a "workload" test and requiring ADB seems like a bad idea.
> >> >
> > adb is used only to transfer the files before and after the benchmark is
> > run and not while the benchmark is running.
>
> So that could be done in lava-test-shell :)

Revision history for this message
Andy Doan (doanac) wrote : Posted in a previous version of this proposal

On 12/10/2012 08:18 AM, Yongqin Liu wrote:
>> On 12/07/2012 11:13 AM, vishal wrote:
>>> I get your point here. But the whole benchmark is written by ARM to run
>>> over adb + they even take control of serial terminal similar to LAVA( we
>>> don't execute that path but rely on LAVA to reboot etc).
>>
>> So use lava-android-test.
> If this means you aggree this branch for now, please approve this MP.

yes. it seems fine.

NOTE: we still have to iron out the private git access part of this issue.

Revision history for this message
Andy Doan (doanac) wrote : Posted in a previous version of this proposal

Actually wait a bit. I think your git url still won't work

Revision history for this message
Yongqin Liu (liuyq0307) wrote : Posted in a previous version of this proposal

> Actually wait a bit. I think your git url still won't work
I will change it to use the local git repository tomorrow.

And BTW, I will need you to help to deploy this modification tomorrow then.
So in the design of lava-test-shell, can you make it possible that the deployment isno need when add new test?

Revision history for this message
Andy Doan (doanac) wrote : Posted in a previous version of this proposal

On 12/10/2012 09:32 AM, Yongqin Liu wrote:
>> Actually wait a bit. I think your git url still won't work
> I will change it to use the local git repository tomorrow.
>
> And BTW, I will need you to help to deploy this modification tomorrow then.
> So in the design of lava-test-shell, can you make it possible that the deployment isno need when add new test?

Yep - lava-test-shell allows you to control your own test definitions
(and even keep them in git if you'd like)

Revision history for this message
Andy Doan (doanac) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_android_test/provider.py'
2--- lava_android_test/provider.py 2012-07-10 06:34:06 +0000
3+++ lava_android_test/provider.py 2012-12-11 16:47:25 +0000
4@@ -266,15 +266,13 @@
5 test_sh_path = '%s/%s' % (mod.curdir, f_name)
6
7 HOST_SHELL_STEPS = ['bash %s -s $(SERIAL) $(OPTIONS)' % test_sh_path]
8- PATTERN = ("^\s*(?P<test_case_id>\S+)="
9- "(?P<result>(pass|fail|ok|ng|true|false|skip|done))\s*$")
10
11 testobj = self.gen_testobj(
12 testname=test_name,
13 installer=testdef.AndroidTestInstaller(),
14 runner=testdef.AndroidTestRunner(
15 steps_host_pre=HOST_SHELL_STEPS),
16- parser=testdef.AndroidTestParser(PATTERN),
17+ parser=testdef.AndroidSimpleTestParser(),
18 adb=ADB(serial))
19 return testobj
20
21
22=== added file 'lava_android_test/test_definitions/hostshells/workload.sh'
23--- lava_android_test/test_definitions/hostshells/workload.sh 1970-01-01 00:00:00 +0000
24+++ lava_android_test/test_definitions/hostshells/workload.sh 2012-12-11 16:47:25 +0000
25@@ -0,0 +1,147 @@
26+#!/bin/bash
27+# Copyright (c) 2012 Linaro
28+
29+# Author: Linaro Validation Team <linaro-dev@lists.linaro.org>
30+#
31+# This file is part of LAVA Android Test.
32+#
33+# This program is free software: you can redistribute it and/or modify
34+# it under the terms of the GNU General Public License as published by
35+# the Free Software Foundation, either version 3 of the License, or
36+# (at your option) any later version.
37+#
38+# This program is distributed in the hope that it will be useful,
39+# but WITHOUT ANY WARRANTY; without even the implied warranty of
40+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41+# GNU General Public License for more details.
42+#
43+# You should have received a copy of the GNU General Public License
44+# along with this program. If not, see <http://www.gnu.org/licenses/>.
45+
46+function parse_argv() {
47+ # Parse command line arguments
48+ while test -n "$1"; do
49+ case "$1" in
50+ --serial|-s)
51+ SERIAL="$2"
52+ if [ -n "${SERIAL}" ]; then
53+ shift 2
54+ else
55+ show_usage
56+ exit 1
57+ fi
58+ ;;
59+ --config|-c)
60+ CONFIG="$2"
61+ if [ -n "${CONFIG}" ]; then
62+ shift 2
63+ else
64+ show_usage
65+ exit 1
66+ fi
67+ ;;
68+ --git|-g)
69+ GIT_URL="$2"
70+ if [ -n "${GIT_URL}" ]; then
71+ shift 2
72+ else
73+ show_usage
74+ exit 1
75+ fi
76+ ;;
77+ --help|-h)
78+ show_usage
79+ exit 1
80+ ;;
81+ *)
82+ if [ -n "${OPTIONS}" ]; then
83+ OPTIONS="${OPTIONS} $1"
84+ else
85+ OPTIONS="$1"
86+ fi
87+ shift
88+ ;;
89+ esac
90+ done
91+}
92+
93+function show_usage(){
94+ # Display the usage line
95+ echo "Usage $(basename $0) [--serial|-s <serial>] [--config|-c <config_file>] [--git|g <git-url>] <other-option>"
96+ echo "Usage $(basename $0) [--help|-h]"
97+}
98+
99+function parse_output_result(){
100+ result_f=${1}
101+ if [ ! -f "${1}" ]; then
102+ echo "There is no result file output/results.csv"
103+ return
104+ fi
105+
106+ file_tmp=${result_f}.tmp
107+ sed 's/ /_/g' ${result_f} > ${file_tmp}
108+ keys=`head -n 1 ${file_tmp}`
109+ values=`tail -n 1 ${file_tmp}`
110+ for ((i=1; i<21; i++)); do
111+ key=`echo ${keys}|cut -d , -f ${i}|sed 's/\r//'`
112+ value=`echo ${values}|cut -d , -f ${i}|sed 's/\r//'`
113+
114+ echo ${value}|grep -P '^[.\d]+$' &>/dev/null
115+ if [ $? -ne 0 ]; then
116+ key="${key}_${value}"
117+ value="true"
118+ fi
119+ echo ${key}=${value}
120+ done
121+ rm -f ${file_tmp}
122+}
123+
124+function main(){
125+ local_git="file:///home/bhoj/workload-automation.git"
126+ branch="lava"
127+ outputdir="outputdir"
128+ result="${outputdir}/result.csv"
129+
130+ parse_argv "$@"
131+
132+ config_file="config.csv"
133+ if [ -n "${CONFIG}" ]; then
134+ config_file="${CONFIG}"
135+ fi
136+
137+ if [ -n "${GIT_URL}" ]; then
138+ git_url="${GIT_URL}"
139+ else
140+ git_url="${local_git}"
141+ fi
142+
143+ git clone "${git_url}" -b ${branch}
144+ if [ $? -ne 0 ]; then
145+ echo "Failed to clone git repository: ${git_url}"
146+ exit 1
147+ fi
148+ ip=`echo ${SERIAL}|sed 's/:5555//'`
149+ cd "workload-automation"
150+
151+ #update the ip address and patch config.csv file
152+ sed -i "s/192.168.1.38/${ip}/g" workload_config.py
153+ sed -i "s/,1200000//g" "${config_file}" #for config_a15.csv and config.csv
154+ sed -i "s/,1000000//g" "${config_file}" #for config_a7.csv
155+
156+ python workload_setup_dependencies.py
157+ if [ $? -ne 0 ]; then
158+ echo "Failed to run workload_setup_dependencies.py"
159+ exit 1
160+ fi
161+
162+ rm -fr ${outputdir}
163+ python workload.py ${config_file} ${outputdir}/
164+ if [ $? -ne 0 ]; then
165+ echo "Failed to run workload.py config.csv outputdir/"
166+ exit 1
167+ fi
168+ parse_output_result ${result}
169+}
170+
171+main "$@"
172+
173
174=== modified file 'lava_android_test/testdef.py'
175--- lava_android_test/testdef.py 2012-08-17 07:36:25 +0000
176+++ lava_android_test/testdef.py 2012-12-11 16:47:25 +0000
177@@ -429,8 +429,8 @@
178 def real_parse(self, result_filename='stdout.log',
179 output_filename='stdout.log', test_name=''):
180 """Using the pattern to do the real parse operation
181-
182- generate the test_results elements from the result file by parsing
183+
184+ generate the test_results elements from the result file by parsing
185 with the pattern specified.
186 """
187 if not self.pattern:
188@@ -599,6 +599,38 @@
189 self.fixmeasurements()
190 self.fixids()
191
192+class AndroidSimpleTestParser(AndroidTestParser):
193+
194+ def real_parse(self, result_filename='stdout.log',
195+ output_filename='stdout.log', test_name=''):
196+ self.res_pattern = ("^\s*(?P<test_case_id>.+?)\s*="
197+ "\s*(?P<result>(pass|fail|ok|ng|true|false|skip|done))\s*$")
198+ self.measurement_pattern = ("^\s*(?P<test_case_id>.+?)\s*="
199+ "\s*(?P<measurement>[\.\d]+)\s*$")
200+ self.measurement_units_pattern = ("^\s*(?P<test_case_id>.+?)\s*="
201+ "\s*(?P<measurement>[\.\d]+)\s+(?P<units>\S+)\s*$")
202+
203+ res_pat = re.compile(self.res_pattern)
204+ measurement_pat = re.compile(self.measurement_pattern)
205+ measurement_units_pat = re.compile(self.measurement_units_pattern)
206+
207+ with open(output_filename, 'r') as stream:
208+ for lineno, line in enumerate(stream, 1):
209+ match = res_pat.search(line)
210+ if not match:
211+ match = measurement_pat.search(line)
212+ if not match:
213+ match = measurement_units_pat.search(line)
214+ if not match:
215+ continue
216+ data = match.groupdict()
217+ data["log_filename"] = result_filename
218+ data["log_lineno"] = lineno
219+ if data.get('result') is None:
220+ data['result'] = 'pass'
221+
222+ self.results['test_results'].append(data)
223+
224
225 def _run_steps_host(steps=[], serial=None, option=None, resultsdir=None):
226 adb = ADB(serial)

Subscribers

People subscribed via source and target branches