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 | |
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')
-rw-r--r-- | android/lava-android-test-host.yaml | 55 | ||||
-rw-r--r-- | android/lava-android-test-target.yaml | 32 | ||||
-rw-r--r-- | android/scripts/parse-lat.py | 54 |
3 files changed, 141 insertions, 0 deletions
diff --git a/android/lava-android-test-host.yaml b/android/lava-android-test-host.yaml new file mode 100644 index 0000000..5f23967 --- /dev/null +++ b/android/lava-android-test-host.yaml @@ -0,0 +1,55 @@ +metadata: + name: lava-android-test-host + format: "Lava-Test-Shell Test Definition 1.0" + description: "Wrapper around lava-android-test. This is the host part. + It runs on KVM device type in LAVA and installs lava-android-test + on it. Tests are executed using TEST_NAME parameter. Default + test tu run is 'busybox'. Optional test parameters are + specified using TEST_PARAMS parameter. There is optional + JAVA_PACKAGE parameter to be used in case different + Java version is needed. It defaults to openjdk-6-jre-headless. + This test definition should be run on Ubuntu images." + maintainer: + - milosz.wasilewski@linaro.org + os: + - android + scope: + - functional + devices: + - kvm + +install: + git-repos: + - http://git.linaro.org/git/lava/lava-android-test.git + steps: + - cd lava-android-test + - python setup.py install + deps: + - python-pip + - python-dev + - libyaml-dev + - unzip + +params: + TEST_NAME: "busybox" + TEST_PARAMS: "" + JAVA_PACKAGE: "openjdk-6-jre-headless" + +run: + steps: + - apt-add-repository -y http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu + - apt-get update -y + - apt-get install -y android-tools-adb android-tools-fastboot $JAVA_PACKAGE + - lava-wait $TEST_NAME-${TEST_PARAMS// /_}-send-ip + - IPADDR=`awk -F '=' '{print $2}' /tmp/lava_multi_node_cache.txt` + - adb connect $IPADDR + - adb wait-for-device + - lava-android-test install $TEST_NAME + - if [[ $TEST_PARAMS != "" ]]; then lava-android-test run -o $TEST_NAME.results -O "$TEST_PARAMS" $TEST_NAME; fi + - if [[ $TEST_PARAMS == "" ]]; then lava-android-test run -o $TEST_NAME.results $TEST_NAME; fi + - lava-test-run-attach $TEST_NAME.results text/plain + - python android/scripts/parse-lat.py -f $TEST_NAME.results -t $TEST_NAME + - lava-sync $TEST_NAME-${TEST_PARAMS// /_}-finished + +parse: + pattern: "^TESTCASE:\\s(?P<test_case_id>\\S+)\\s-\\s(?P<result>\\w+)" diff --git a/android/lava-android-test-target.yaml b/android/lava-android-test-target.yaml new file mode 100644 index 0000000..a705e0c --- /dev/null +++ b/android/lava-android-test-target.yaml @@ -0,0 +1,32 @@ +metadata: + name: lava-android-test-target + format: "Lava-Test-Shell Test Definition 1.0" + description: "Wrapper around lava-android-test. This is the target part. + It sends the IP address of the target to host and than + waits for the host to execute tests." + maintainer: + - milosz.wasilewski@linaro.org + os: + - android + scope: + - functional + devices: + - panda + - panda-es + - vexpress-a9 + - vexpress-tc2 + - wg + +params: + TEST_NAME: "busybox" + TEST_PARAMS: "" + +run: + steps: + - lava-test-case step1-cat-build-info --shell cat /system/build.prop + - lava-test-case step2-get-adb --shell getprop service.adb.tcp.port + - lava-test-case step3-set-adb --shell setprop service.adb.tcp.port 5555 + - lava-test-case step4-stop-adbd --shell stop adbd + - lava-test-case step5-start-adbd --shell start adbd + - lava-test-case step6-send-ip --shell lava-send $TEST_NAME-${TEST_PARAMS// /_}-send-ip ipaddr=$(getprop dhcp.eth0.ipaddress) + - lava-test-case step7-multinode-sync --shell lava-sync $TEST_NAME-${TEST_PARAMS// /_}-finished 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("..") |