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

Proposed by Yongqin Liu
Status: Superseded
Proposed branch: lp://qastaging/~liuyq0307/lava-android-test/support-custom-command
Merge into: lp://qastaging/lava-android-test
Diff against target: 1835 lines (+542/-237)
20 files modified
lava_android_test/adb.py (+43/-19)
lava_android_test/commands.py (+224/-51)
lava_android_test/config.py (+4/-2)
lava_android_test/hwprofile.py (+16/-7)
lava_android_test/main.py (+12/-2)
lava_android_test/swprofile.py (+22/-16)
lava_android_test/test_definitions/0xbench.py (+28/-10)
lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_kill.py (+8/-4)
lava_android_test/test_definitions/android-0xbenchmark/android_0xbenchmark_modify_path.py (+21/-12)
lava_android_test/test_definitions/cts.py (+6/-3)
lava_android_test/test_definitions/gatortest.py (+4/-4)
lava_android_test/test_definitions/glmark2.py (+3/-2)
lava_android_test/test_definitions/glmark2/glmark2_wait.py (+6/-3)
lava_android_test/test_definitions/mmtest.py (+17/-10)
lava_android_test/test_definitions/monkey.py (+12/-7)
lava_android_test/test_definitions/skia.py (+12/-9)
lava_android_test/test_definitions/v8.py (+0/-2)
lava_android_test/testdef.py (+100/-53)
lava_android_test/utils.py (+2/-21)
setup.py (+2/-0)
To merge this branch: bzr merge lp://qastaging/~liuyq0307/lava-android-test/support-custom-command
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Needs Information
Zach Pfeffer Pending
Review via email: mp+96318@code.qastaging.launchpad.net

This proposal has been superseded by a proposal from 2012-03-07.

Description of the change

mainly 3 points:
1. add support for running android command that user specified
2. add run option for run command
3. change the parent directory of temporary directory to 777,
   so that anyone can write and read for that directory.

And about the support for specified android command,
if it's acceptable, then I will modify lava-dispatcher and linaro-android-build-tools
to make it can be used on android-build.

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

18 + parser.add_argument('-O', '--run-option', help=("Specified in the job file for using in the real test action,"
19 + " so that we can customize some test when need"))

This is probably too long. I'd split it before help= if I were you. Running pep8 lava_android_test will tell you more.

+ except Exception as strerror:
37 + raise LavaCommandError("Test execution error: %s" % strerror)

By convention the exception should be named 'exc'. Using strerror is confusing as it may imply this is the C equivalent which it is not.

52 + parser.add_argument('-c', '--android-command', action='append', help=("Specified in the job file for using in the real test action,"
53 + " so that we can customize some test when need"))
54 + parser.add_argument('-p', '--parse-regex', help=("Specified the regular expression used for analyzing command output"))

Probably too long as well

74 + tip_msg = ''
75 + if self.args.serial:
76 + tip_msg = "Run following custom test(s) on device(%s):\n\t\t%s" % (self.args.serial, '\n\t\t'.join(ADB_SHELL_STEPS))
77 + else:
78 + tip_msg = "Run following custom test(s):\n\t\t%s" % ('\n\t\t'.join(ADB_SHELL_STEPS))

Line 74 is not needed. Python scoping will ensure that tip_msg is present after the if/else statement.

81 + inst = AndroidTestInstaller()
82 + run = AndroidTestRunner(adbshell_steps=ADB_SHELL_STEPS)
83 + parser = AndroidTestParser(pattern=PATTERN)
84 + test = AndroidTest(testname=test_name, installer=inst,
85 + runner=run, parser=parser)
86 + test.parser.results = {'test_results':[]}
87 + test.setadb(self.adb)

I cannot help to notice that we're duplicating part of lava-test. Could we consider depending on lava-test and reuse the TestArtifacts class defined there? I know this is a long topic so we can postpone this discussion but I want to reverse the trend so that we go towards unified APIs for both host-driven (lava-android-test, upcoming lava-uboot-test) and target-driven (lava-test) frameworks.

188 + #make every user can write/read this directory
189 + os.chmod(config.tempdir_host, 0777)

Why is this needed?

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

>
> 81 + inst = AndroidTestInstaller()
> 82 + run = AndroidTestRunner(adbshell_steps=ADB_SHELL_STEPS)
> 83 + parser = AndroidTestParser(pattern=PATTERN)
> 84 + test = AndroidTest(testname=test_name, installer=inst,
> 85 + runner=run, parser=parser)
> 86 + test.parser.results = {'test_results':[]}
> 87 + test.setadb(self.adb)
>
> I cannot help to notice that we're duplicating part of lava-test. Could we
> consider depending on lava-test and reuse the TestArtifacts class defined
> there? I know this is a long topic so we can postpone this discussion but I
> want to reverse the trend so that we go towards unified APIs for both host-
> driven (lava-android-test, upcoming lava-uboot-test) and target-driven (lava-
> test) frameworks.
Yes, I agree this, especial we will have more similar test tools.
There are some common parts between lava-test and lava-android-test now.
        lava-tools
            ^
            |
     lava-test-base
     ^ ^ ^
     | | |
  Linux Android Others

I create a BP about this.
https://blueprints.launchpad.net/lava-android-test/+spec/linaro-android-test-redesign

> 188 + #make every user can write/read this directory
> 189 + os.chmod(config.tempdir_host, 0777)
>
> Why is this needed?
Now there is a problem like this:
1. when use lava-instance to run android job, it will create /tmp/lava-android-test with the apache user,
2. then when I run lava-android-test as a normal user, I can't create temporary directory in /tmp/lava-android-test in this case.
so I think we can change the /tmp/lava-android-test to 777 when create it, then normal user can also use that directory.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

464 + help=("Specified the regular expression used for \
465 + analyzing command output"))

This will not work as you think. The general consensus is to use

("text text text"
 " text text text" # repeat as many times as you want
 " more text")

Thanks for the blueprint! +1 :)

1. when use lava-instance to run android job, it will create /tmp/lava-android-test with the apache user,

Huh? What? Could you explain how this happens please? Lava runs as a designated user. Apache should _never_ be part of that.

2. then when I run lava-android-test as a normal user, I can't create temporary directory in /tmp/lava-android-test in this case.
so I think we can change the /tmp/lava-android-test to 777 when create it, then normal user can also use that directory.

review: Needs Information
142. By Yongqin Liu

merge with coding improve branch

143. By Yongqin Liu

improve coding style

144. By Yongqin Liu

modify doc/conf.py to the same of trunk

Unmerged revisions

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