Merge lp://qastaging/~liuyq0307/lava-android-test/support-monkeyrunner into lp://qastaging/lava-android-test

Proposed by Yongqin Liu
Status: Merged
Merged at revision: 158
Proposed branch: lp://qastaging/~liuyq0307/lava-android-test/support-monkeyrunner
Merge into: lp://qastaging/lava-android-test
Diff against target: 496 lines (+290/-15)
9 files modified
lava_android_test/commands.py (+174/-5)
lava_android_test/config.py (+3/-1)
lava_android_test/main.py (+3/-4)
lava_android_test/repository.py (+83/-0)
lava_android_test/test_definitions/tjbench.py (+1/-1)
lava_android_test/test_definitions/v8.py (+0/-1)
lava_android_test/testdef.py (+2/-2)
lava_android_test/utils.py (+23/-1)
setup.py (+1/-0)
To merge this branch: bzr merge lp://qastaging/~liuyq0307/lava-android-test/support-monkeyrunner
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+106942@code.qastaging.launchpad.net

This proposal supersedes a proposal from 2012-04-25.

Description of the change

add run-monkeyrunner sub command to make support monkeyrunner test easily.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote : Posted in a previous version of this proposal

It's pretty hard to review this as I'm not that fluent in the android parts of lava.

287 === added file 'lava_android_test/repository.py'

We already have lava-vcs which supports git and bzr through single API. Perhaps it would be better to use that instead?

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

On 25 April 2012 21:17, Zygmunt Krynicki <email address hidden>wrote:

> It's pretty hard to review this as I'm not that fluent in the android
> parts of lava.
>
> 287 === added file 'lava_android_test/repository.py'
>
> We already have lava-vcs which supports git and bzr through single API.
> Perhaps it would be better to use that instead?
>
This component is great.

Can it be used now?
And just one look, it has many files, seems a little complicate.
(Maybe it is easy to be used)

I'd like to change to use it after we merged it to lava-core

Revision history for this message
Zygmunt Krynicki (zyga) wrote : Posted in a previous version of this proposal

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

W dniu 25.04.2012 16:08, Yongqin Liu pisze:
> On 25 April 2012 21:17, Zygmunt Krynicki
> <email address hidden>wrote:
>
>> It's pretty hard to review this as I'm not that fluent in the
>> android parts of lava.
>>
>> 287 === added file 'lava_android_test/repository.py'
>>
>> We already have lava-vcs which supports git and bzr through
>> single API. Perhaps it would be better to use that instead?
>>
> This component is great.
>
> Can it be used now?

Yes

> And just one look, it has many files, seems a little complicate.
> (Maybe it is easy to be used)

It's pretty easy. The abstraction has three objects: IVCS (like git
and bzr), IRemoteBranch which has limited functionality but allows you
to create a local copy / branch / clone and ILocalBranch that gives
you extra stuff that I needed to work on lava. If you need more then
we can easily extend it.

PS: look at lava/vcs/interfaces.py - this is what you can do on both
git and bzr.

from lava.vcs.adapters import get_vcs
git = get_vcs("git")
remote_branch = git.open_remote("git://...")
local_branch = remote_branch.sprout_to_pathname("some-place")
print local_branch.get_revision_id()

> I'd like to change to use it after we merged it to lava-core

Ok

Thanks
ZK

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPmDD6AAoJEOvx/vtfL8ZXadQP/0ga6sQg+vojuR6+ZSxzD78t
JtPKaRfWPlKrK7FazNjZLVXl/M390bxR/fWbHP9VMCsf9ZgXXL2t8whA0wk4sxnB
tHeaGjqgc21S2XdwGMbQ/XHI9cdSKvwvzpdOTD0ClqcjCBCOhVzQcylZLGAXapiW
TQo6ZrEvHBJwI62soSxk4xTO1ry5POYy8ZoVreYlhrPuYYE0SH7wnLj/Q/hvodmk
MWV5wfxgsGjeUTykKtNSZ7GQV1bWo8Cq60BG8xrUIlI2QEtcahFL2LsvKU/kV3PG
3Ul3QYj+zNv/TYMgA2qkyK7xYG0Rd0Gk8vxMEfId2nndcXTgo8MCue/vn8eU2Q5d
XdLHN+KzwDT6tY2QnxwYIfYIejUyWIPxBIXVI1DTO7xiJyjNpT/WESugC2MHZdGx
0k6KFXEYiGpze9INgnFp55aanfCDWUd+TY6vW4I754CtTIxOpvmMRIzxghVNjNLT
PNglV3y3nLy22N7+XBf0yKl2n9mh0f8te4DYNtjckKi1/lUyY8F4rDkPdhBkYj/J
b4zfGuw1E50fZ1nc+VDGFD+MS7Odj1Kmu5aRTppRobuOFVlsOSqvd1mkZ0t/WMj9
5cq78RBcXboFQF9beZJowrK6pI+koHzM8n55sicdySUSPhh24KtXHgo2T2TBajyA
3rI4BWQy+2v9tuxRFSw8
=xea1
-----END PGP SIGNATURE-----

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote : Posted in a previous version of this proposal
Download full text (12.6 KiB)

Yongqin Liu <email address hidden> writes:

> Yongqin Liu has proposed merging lp:~liuyq0307/lava-android-test/support-monkeyrunner into lp:lava-android-test.
>
> Requested reviews:
> Linaro Validation Team (linaro-validation)
>
> For more details, see:
> https://code.launchpad.net/~liuyq0307/lava-android-test/support-monkeyrunner/+merge/103452
>
> add run-monkeyrunner sub command to make support monkeyrunner test easily.

It has to be said, this whole approach feels like a way for the android
team to get out of the chore of having to define their tests
properly... but if that's what they want, they can have it I guess.

I have quite a lot of Python coding issues, please see inline comments.

> === modified file 'lava_android_test/commands.py'
> --- lava_android_test/commands.py 2012-04-11 05:58:13 +0000
> +++ lava_android_test/commands.py 2012-04-25 12:02:22 +0000
> @@ -21,16 +21,20 @@
> import urlparse
> import versiontools
>
> +from tempfile import mkdtemp
> +
> from lava_tool.interface import Command as LAVACommand
> from lava_tool.interface import LavaCommandError
> from linaro_dashboard_bundle.io import DocumentIO
>
> from lava_android_test.adb import ADB
> from lava_android_test.config import get_config
> +from lava_android_test.repository import GitRepository
> from lava_android_test.testdef import testloader, AndroidTest
> from lava_android_test.testdef import AndroidTestRunner, \
> AndroidTestInstaller, \
> AndroidTestParser
> +from lava_android_test import utils
>
>
> class Command(LAVACommand):
> @@ -146,6 +150,17 @@
> test_dir = os.path.join(self.config.installdir_android, test_id)
> return self.adb.exists(test_dir)
>
> + def get_device_serial(self):
> + if not self.args.serial:
> + serial_ary = ADB().run_cmd_host('adb get-serialno')[1]
> + serial = serial_ary[0].strip()
> + if not serial or serial == 'unknown':
> + return ''
> + else:
> + return serial
> + else:
> + return self.args.serial
> +
>
> class AndroidTestCommand(AndroidCommand):
> @classmethod
> @@ -435,6 +450,136 @@
> self.say_end(tip_msg)
>
>
> +class run_monkeyrunner(AndroidCommand):
> + """
> + Run the monkeyrunner scripts that stored in the specified git repository

> + program:: lava-android-test run-monkeyrunner -g giturl -r resultfilelist
> + """
> +
> + @classmethod
> + def register_arguments(cls, parser):
> + super(run_monkeyrunner, cls).register_arguments(parser)
> + parser.add_argument("url",
> + help="The repository url of the test scripts")
> + parser.add_argument('-t', '--repo-type',
> + default='git',
> + help=("Specify the type of the repository"))
> + group = parser.add_argument_group("specify the bundle output file")
> + group.add_argument("-o", "--output",
> + default=None,
> + metavar="FILE",
> + he...

Revision history for this message
Yongqin Liu (liuyq0307) wrote :

>> + if not self.test_installed(test.testname):
>> + test.install()
>
>The need to do this seems a bit strange, given that test.install()
>doesn't really seem to do anything? I guess given the way things work
>today it's needed.

The install function will create directory in the target, it is there for store some file.
But in this time, not really use.

Here used to keep the consistency with other tests.

>> + bundle = {}
>> + org_png_file_list = utils.find_files(config.tempdir_host,
>> + '.%s' % 'png')
>> + result_id = test.run(quiet=self.args.quiet)
>> + if self.args.output:
>> + cur_all_png_list = utils.find_files(config.tempdir_host,
>> + '.%s' % 'png')
>> + new_png_list = set(cur_all_png_list).difference(org_png_file_list)
>> + test_id = 'monkeyrunner(%s)' % (test_case_id)
>> + bundle = generate_bundle(self.args.serial,
>> + result_id, test=test,
>> + test_id=test_id,
>> + attachments=list(new_png_list))
>> + utils.delete_files(new_png_list)
>> + return bundle

>I can't find the code which will copy the pngs from the device to the
>host. Can you tell me where it is?

The png files are generate on the host by the monkeyrunner script, so there is no need to pull them form device.
And it is suggested to generated on the same directory of the monkeyrunner script file

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :
Download full text (13.1 KiB)

Thanks for fixing the things I complained about, however there seem to
be some new, unrelated changes that really belong in another branch...

Yongqin Liu <email address hidden> writes:

> Yongqin Liu has proposed merging lp:~liuyq0307/lava-android-test/support-monkeyrunner into lp:lava-android-test.
>
> Requested reviews:
> Linaro Validation Team (linaro-validation)
>
> For more details, see:
> https://code.launchpad.net/~liuyq0307/lava-android-test/support-monkeyrunner/+merge/106942
>
> add run-monkeyrunner sub command to make support monkeyrunner test easily.
> --
> https://code.launchpad.net/~liuyq0307/lava-android-test/support-monkeyrunner/+merge/106942
> Your team Linaro Validation Team is requested to review the proposed merge of lp:~liuyq0307/lava-android-test/support-monkeyrunner into lp:lava-android-test.
> === modified file 'lava_android_test/commands.py'
> --- lava_android_test/commands.py 2012-05-08 05:32:19 +0000
> +++ lava_android_test/commands.py 2012-05-23 06:49:24 +0000
> @@ -19,18 +19,23 @@
> import os
> import base64
> import urlparse
> +from uuid import uuid4
> import versiontools
>
> +from tempfile import mkdtemp
> +
> from lava_tool.interface import Command as LAVACommand
> from lava_tool.interface import LavaCommandError
> from linaro_dashboard_bundle.io import DocumentIO
>
> from lava_android_test.adb import ADB
> from lava_android_test.config import get_config
> +from lava_android_test.repository import GitRepository
> from lava_android_test.testdef import testloader, AndroidTest
> from lava_android_test.testdef import AndroidTestRunner, \
> AndroidTestInstaller, \
> AndroidTestParser
> +from lava_android_test import utils
>
>
> class Command(LAVACommand):
> @@ -146,6 +151,13 @@
> test_dir = os.path.join(self.config.installdir_android, test_id)
> return self.adb.exists(test_dir)
>
> + def get_device_serial(self):
> + if not self.args.serial:
> + serial_ary = ADB().run_cmd_host('adb get-serialno')[1]
> + serial = serial_ary[0].strip()
> + if not serial or serial == 'unknown':
> + return ''

This looks wrong -- I guess a 'return serial' has been dropped?

> def assertDeviceIsConnected(self):
> if not self.adb.isDeviceConnected():
> if self.adb.serial:
> @@ -163,7 +175,7 @@
>
> self.invoke_sub()
>
> - def invoke_sub():
> + def invoke_sub(self):
> raise NotImplementedError
>
>
> @@ -344,7 +356,7 @@
> class run_custom(AndroidCommand):
> """
> Run the command(s) that specified by the -c option in the command line

> - program:: lava-android-test run-custom -c 'command1' -c 'command2' -p 'parse-regex1'
> + program:: lava-android-test run-custom -c 'cm1' -c 'cmd2' -p 'parse-regex1'
> program:: lava-android-test run test-id -s device_serial
> program:: lava-android-test run test-id -s device_serial -o outputfile
> """
> @@ -453,6 +465,139 @@
> self.say_end(tip_msg)
>
>
> +class run_monkeyrunner(AndroidCommand):
> + """
> + Run the monkeyrun...

154. By Yongqin Liu

update the typo of bundle

155. By Yongqin Liu

revert project files

156. By Yongqin Liu

add return serial for get_device_serial according to review comment

157. By Yongqin Liu

modify bundle_format definition bug that using os.environ.get to define

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

206 - parser.add_argument('-p', '--parse-regex',
207 + parser.add_argument(' - p', ' - -parse - regex',

I still don't understand what this is for.

All else looks good, so if you can revert the above, please merge.

158. By Yongqin Liu

modify the auto rewriting error

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches