diff options
author | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-07-22 18:56:43 +0100 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2014-07-22 18:56:43 +0100 |
commit | e214f7c8dc9d4a518239db171c65fa470922ed89 (patch) | |
tree | ae8210f6c49ca91bd7b663f7c2051f8c8556e996 /android/scripts/parse-lat.py | |
parent | c7cef569677c94a56eb8a250f822cc99ebb9307c (diff) |
android: added lava-android-test wrapper
The lava-test-shell wrapper around lava-android-test
allows to execute the lava-android-test from the KVM device
type in LAVA which acts as a host. With this approach
it is possible to controll the host environment and for example
use different Java versions with different Android CTS branches.
The test wrapper JSON fragment follows:
{
"command": "lava_test_shell",
"parameters": {
"role": "host",
"testdef_repos": [
{
"git-repo": "git://git.linaro.org/qa/test-definitions.git",
"parameters": {
"TEST_NAME": "cts",
"TEST_PARAMS": "--package android.bionic --timeout 1800 --disable-reboot"
},
"testdef": "android/lava-android-test-host.yaml"
}
],
"timeout": 7200
}
},
{
"command": "lava_test_shell",
"parameters": {
"role": "target",
"testdef_repos": [
{
"git-repo": "git://git.linaro.org/qa/test-definitions.git",
"parameters": {
"TEST_NAME": "cts",
"TEST_PARAMS": "--package android.bionic --timeout 1800 --disable-reboot"
},
"testdef": "android/lava-android-test-target.yaml"
}
],
"timeout": 7200
}
}
lava-android-test-host.yaml and lava-android-test-target.yaml take
TEST_NAME and TEST_PARAMS. These have to be the same for each pair
of test shells. Optionally lava-android-test-host.yaml takes
JAVA_PACKAGE parameter which is used to define the Java version
running on host.
Change-Id: Ief169010a1510392c741513136cbc245ab769b7b
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
Diffstat (limited to 'android/scripts/parse-lat.py')
-rw-r--r-- | android/scripts/parse-lat.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/android/scripts/parse-lat.py b/android/scripts/parse-lat.py new file mode 100644 index 0000000..2ecb011 --- /dev/null +++ b/android/scripts/parse-lat.py @@ -0,0 +1,54 @@ +import json +from base64 import standard_b64decode +from os import mkdir, chdir, path +from optparse import OptionParser +from random import choice +from string import ascii_uppercase +from subprocess import call + + +if __name__ == '__main__': + usage = "usage: %prog -f <results file> -t <test name>" + parser = OptionParser(usage=usage) + parser.add_option("-f", "--file", dest="filename", + help="result file", metavar="FILE") + parser.add_option("-t", "--testcase", dest="testcase", + help="lava-android-test test name") + + (options, args) = parser.parse_args() + + if not options.filename: + parser.error("Results file is mandatory") + if not options.testcase: + parser.error("Test name is mandatory") + + source = file(options.filename, "rb") + bundle = json.loads(source.read()) + + for run in bundle['test_runs']: + test_id = run['test_id'] + print "total number of results in %s: %s" % (test_id, len(run['test_results'])) + for index, result in enumerate(run['test_results']): + print "TESTCASE: %s-[%s.%s] - %s (%s)" % ( + options.testcase, + test_id.replace(" ", "_"), + result['test_case_id'].replace(" ", "_"), + result['result'], + index) + print "LAVA TEST CASE SECTION FINISHED!" + if 'attachments' in run: + attachments_dir_name = ''.join(choice(ascii_uppercase) for _ in range(6)) + mkdir(attachments_dir_name) + for attachment in run['attachments']: + print "Extracting %s to %s" % (attachment['pathname'], attachments_dir_name) + attachment_file = open( + path.join(attachments_dir_name, + attachment['pathname']), + 'wb') + attachment_file.write(standard_b64decode(attachment['content'])) + attachment_file.close() + chdir(attachments_dir_name) + call(["lava-test-run-attach", + attachment['pathname'], + attachment['mime_type']]) + chdir("..") |