summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-03-31 13:51:25 +0100
committerVishal Bhoj <vishal.bhoj@linaro.org>2017-05-03 11:01:50 +0530
commit226b8353781007d898b02942ca20970d20ed46e6 (patch)
tree037521639b0eaba60b437c79133218b710af452c
parentab48dcadc4eb74a126a8d76bece720ab000b1452 (diff)
Automated: Android: Added support for running VTSHEADmaster
CTS test is almost compatible with VTS as they use the same test shell - tradefed. The CTS test was updated to also support executing and reporting VTS results. Change-Id: Ida3ceda733c5e74f87256cf2ebefbaf93a6fce74 Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
-rwxr-xr-xautomated/android/tradefed/tradefed-runner.py (renamed from automated/android/cts/cts-runner.py)63
-rwxr-xr-xautomated/android/tradefed/tradefed.sh (renamed from automated/android/cts/cts.sh)42
-rw-r--r--automated/android/tradefed/tradefed.yaml (renamed from automated/android/cts/cts.yaml)22
3 files changed, 76 insertions, 51 deletions
diff --git a/automated/android/cts/cts-runner.py b/automated/android/tradefed/tradefed-runner.py
index b81b8ff..dff16a6 100755
--- a/automated/android/cts/cts-runner.py
+++ b/automated/android/tradefed/tradefed-runner.py
@@ -77,15 +77,17 @@ def result_parser(xml_file):
OUTPUT = '%s/output' % os.getcwd()
RESULT_FILE = '%s/result.txt' % OUTPUT
-CTS_STDOUT = '%s/cts-stdout.txt' % OUTPUT
-CTS_LOGCAT = '%s/cts-logcat.txt' % OUTPUT
+TRADEFED_STDOUT = '%s/tradefed-stdout.txt' % OUTPUT
+TRADEFED_LOGCAT = '%s/tradefed-logcat.txt' % OUTPUT
TEST_PARAMS = ''
parser = argparse.ArgumentParser()
parser.add_argument('-t', dest='TEST_PARAMS', required=True,
- help="cts test parameters")
+ help="tradefed shell test parameters")
+parser.add_argument('-p', dest='TEST_PATH', required=True,
+ help="path to tradefed package top directory")
args = parser.parse_args()
-TEST_PARAMS = args.TEST_PARAMS
+#TEST_PARAMS = args.TEST_PARAMS
if os.path.exists(OUTPUT):
suffix = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
@@ -96,7 +98,7 @@ os.makedirs(OUTPUT)
# There might be an issue in lava/local dispatcher, most likely problem of
# pexpect. It prints the messages from print() last, not by sequence.
# Use logging and subprocess.call() to work around this.
-logger = logging.getLogger('CTS')
+logger = logging.getLogger('Tradefed')
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
@@ -104,19 +106,32 @@ formatter = logging.Formatter('%(asctime)s - %(name)s: %(levelname)s: %(message)
ch.setFormatter(formatter)
logger.addHandler(ch)
-cts_stdout = open(CTS_STDOUT, 'w')
-cts_logcat_out = open(CTS_LOGCAT, 'w')
-cts_logcat = subprocess.Popen(['adb', 'logcat'], stdout=cts_logcat_out)
+tradefed_stdout = open(TRADEFED_STDOUT, 'w')
+tradefed_logcat_out = open(TRADEFED_LOGCAT, 'w')
+tradefed_logcat = subprocess.Popen(['adb', 'logcat'], stdout=tradefed_logcat_out)
-logger.info('Test params: %s' % TEST_PARAMS)
-logger.info('Starting CTS test...')
+logger.info('Test params: %s' % args.TEST_PARAMS)
+logger.info('Starting tradefed shell test...')
-child = pexpect.spawn('android-cts/tools/cts-tradefed', logfile=cts_stdout)
+command = None
+prompt = None
+if args.TEST_PATH == "android-cts":
+ command = "android-cts/tools/cts-tradefed"
+ prompt = "cts-tf >"
+if args.TEST_PATH == "android-vts":
+ command = "android-vts/tools/vts-tradefed"
+ prompt = "vts-tf >"
+
+if command is None:
+ logger.error("Not supported path: %s" % args.TEST_PATH)
+ sys.exit(1)
+
+child = pexpect.spawn(command, logfile=tradefed_stdout)
try:
- child.expect('cts-tf >', timeout=60)
- child.sendline(TEST_PARAMS)
+ child.expect(prompt, timeout=60)
+ child.sendline(args.TEST_PARAMS)
except pexpect.TIMEOUT:
- result = 'lunch-cts-rf-shell fail'
+ result = 'lunch-tf-shell fail'
py_test_lib.add_result(RESULT_FILE, result)
while child.isalive():
@@ -127,7 +142,7 @@ while child.isalive():
adb_check = subprocess.Popen(shlex.split(adb_command))
if adb_check.wait() != 0:
subprocess.call(['adb', 'devices'])
- logger.error('Terminating CTS test as adb connection is lost!')
+ logger.error('Terminating tradefed shell test as adb connection is lost!')
child.terminate(force=True)
result = 'check-adb-connectivity fail'
py_test_lib.add_result(RESULT_FILE, result)
@@ -141,24 +156,24 @@ while child.isalive():
'I/ConsoleReporter:.*Test run failed to complete.'],
timeout=60)
if m == 0:
- py_test_lib.add_result(RESULT_FILE, 'cts-test-run pass')
+ py_test_lib.add_result(RESULT_FILE, 'tradefed-test-run pass')
elif m == 1:
- py_test_lib.add_result(RESULT_FILE, 'cts-test-run fail')
+ py_test_lib.add_result(RESULT_FILE, 'tradefed-test-run fail')
# Once all tests finshed, exit from tf shell and throw EOF.
child.sendline('exit')
child.expect(pexpect.EOF, timeout=60)
except pexpect.TIMEOUT:
- logger.info('Printing cts recent output...')
- subprocess.call(['tail', CTS_STDOUT])
+ logger.info('Printing tradefed recent output...')
+ subprocess.call(['tail', TRADEFED_STDOUT])
-logger.info('CTS test finished')
-cts_logcat.kill()
-cts_logcat_out.close()
-cts_stdout.close()
+logger.info('Tradefed test finished')
+tradefed_logcat.kill()
+tradefed_logcat_out.close()
+tradefed_stdout.close()
# Locate and parse test result.
-result_dir = 'android-cts/results'
+result_dir = '%s/results' % args.TEST_PATH
test_result = 'test_result.xml'
if os.path.exists(result_dir) and os.path.isdir(result_dir):
for root, dirs, files in os.walk(result_dir):
diff --git a/automated/android/cts/cts.sh b/automated/android/tradefed/tradefed.sh
index 8e85d94..ef9f2f3 100755
--- a/automated/android/cts/cts.sh
+++ b/automated/android/tradefed/tradefed.sh
@@ -9,24 +9,26 @@ SKIP_INSTALL="false"
TIMEOUT="300"
JDK="openjdk-8-jdk-headless"
PKG_DEPS="curl wget zip xz-utils python-lxml python-setuptools python-pexpect aapt android-tools-adb lib32z1-dev libc6-dev-i386 lib32gcc1 libc6:i386 libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386"
-CTS_URL="http://testdata.validation.linaro.org/cts/android-cts-7.1_r1.zip"
+TEST_URL="http://testdata.validation.linaro.org/cts/android-cts-7.1_r1.zip"
TEST_PARAMS="run cts -m CtsBionicTestCases --abi arm64-v8a --disable-reboot --skip-preconditions --skip-device-info"
+TEST_PATH="android-cts"
RESULT_FILE="$(pwd)/output/result.txt"
export RESULT_FILE
usage() {
- echo "Usage: $0 [-s <true|false>] [-o timeout] [-n serialno] [-d jdk-version] [-c cts_url] [-t test_params]" 1>&2
+ echo "Usage: $0 [-s <true|false>] [-o timeout] [-n serialno] [-d jdk-version] [-c cts_url] [-t test_params] [-p test_path]" 1>&2
exit 1
}
-while getopts ':s:o:n:d:c:t:' opt; do
+while getopts ':s:o:n:d:c:t:p:' opt; do
case "${opt}" in
s) SKIP_INSTALL="${OPTARG}" ;;
o) TIMEOUT="${OPTARG}" ;;
n) ANDROID_SERIAL="${OPTARG}" ;;
d) JDK="${OPTARG}" ;;
- c) CTS_URL="${OPTARG}" ;;
+ c) TEST_URL="${OPTARG}" ;;
t) TEST_PARAMS="${OPTARG}" ;;
+ p) TEST_PATH="${OPTARG}" ;;
*) usage ;;
esac
done
@@ -41,11 +43,11 @@ else
debian)
dpkg --add-architecture i386
dist_info
- echo "deb [arch=amd64,i386] http://ftp.us.debian.org/debian ${Codename} main non-free contrib" > /etc/apt/sources.list.d/cts.list
+ echo "deb [arch=amd64,i386] http://ftp.us.debian.org/debian ${Codename} main non-free contrib" > /etc/apt/sources.list.d/tradefed.list
if [ "${Codename}" != "sid" ]; then
- echo "deb http://ftp.debian.org/debian ${Codename}-backports main" >> /etc/apt/sources.list.d/cts.list
+ echo "deb http://ftp.debian.org/debian ${Codename}-backports main" >> /etc/apt/sources.list.d/tradefed.list
fi
- cat /etc/apt/sources.list.d/cts.list
+ cat /etc/apt/sources.list.d/tradefed.list
apt-get update || true
install_deps "${JDK}" || install_deps "-t ${Codename}-backports ${JDK}"
install_deps "${PKG_DEPS}"
@@ -58,6 +60,10 @@ else
fi
initialize_adb
+if [ "${TEST_PATH}" = "android-vts" ]; then
+ adb_root
+fi
+disable_suspend
wait_boot_completed "${TIMEOUT}"
wait_homescreen "${TIMEOUT}"
@@ -65,23 +71,23 @@ wait_homescreen "${TIMEOUT}"
export _JAVA_OPTIONS="-Xmx350M"
java -version
-# Download CTS test package or copy it from local disk.
-if echo "${CTS_URL}" | grep "^http" ; then
- wget -S --progress=dot:giga "${CTS_URL}"
+# Download CTS/VTS test package or copy it from local disk.
+if echo "${TEST_URL}" | grep "^http" ; then
+ wget -S --progress=dot:giga "${TEST_URL}"
else
- cp "${CTS_URL}" ./
+ cp "${TEST_URL}" ./
fi
-file_name=$(basename "${CTS_URL}")
+file_name=$(basename "${TEST_URL}")
unzip -q "${file_name}"
rm -f "${file_name}"
-if [ -d android-cts/results ]; then
- mv android-cts/results "android-cts/results_$(date +%Y%m%d%H%M%S)"
+if [ -d "${TEST_PATH}/results" ]; then
+ mv "${TEST_PATH}/results" "${TEST_PATH}/results_$(date +%Y%m%d%H%M%S)"
fi
-# Run CTS test.
-info_msg "About to run dd speed test on device ${ANDROID_SERIAL}"
-./cts-runner.py -t "${TEST_PARAMS}"
+# Run tradefed test.
+info_msg "About to run tradefed shell on device ${ANDROID_SERIAL}"
+./tradefed-runner.py -t "${TEST_PARAMS}" -p "${TEST_PATH}"
# Cleanup.
-rm -f /etc/apt/sources.list.d/cts.list
+rm -f /etc/apt/sources.list.d/tradefed.list
diff --git a/automated/android/cts/cts.yaml b/automated/android/tradefed/tradefed.yaml
index d12e149..bc33917 100644
--- a/automated/android/cts/cts.yaml
+++ b/automated/android/tradefed/tradefed.yaml
@@ -1,7 +1,7 @@
metadata:
name: cts
format: "Lava-Test-Shell Test Definition 1.0"
- description: "Run CTS on Linaro android."
+ description: "Run tradefed based tests in LAVA."
maintainer:
- milosz.wasilewski@linaro.org
- chase.qi@linaro.org
@@ -22,20 +22,24 @@ params:
JDK: "openjdk-8-jdk-headless"
# Download CTS package or copy it from local disk.
# CTS_URL: "/root/android-cts/linaro/7.1_r1/android-cts-7.1_r1.zip"
- CTS_URL: "http://testdata.validation.linaro.org/cts/android-cts-7.1_r1.zip"
+ TEST_URL: "http://testdata.validation.linaro.org/cts/android-cts-7.1_r1.zip"
TEST_PARAMS: "run cts -m CtsBionicTestCases --abi arm64-v8a --disable-reboot --skip-preconditions --skip-device-info"
+ # set to the name of the top directory in TEST_URL archive
+ # This should be 'android-cts' for CTS and android-vts for VTS
+ TEST_PATH: "android-cts"
# Specify url and token for file uploading.
URL: "https://archive.validation.linaro.org/artifacts/team/qa/"
- TOKEN: "4373c97b474497dbd12373689d7d492e"
+ TOKEN: ""
+
run:
steps:
- - cd ./automated/android/cts
- - ./cts.sh -s "${SKIP_INSTALL}" -o "${TIMEOUT}" -n "${ANDROID_SERIAL}" -d "${JDK}" -c "${CTS_URL}" -t "${TEST_PARAMS}"
+ - cd ./automated/android/tradefed
+ - ./tradefed.sh -s "${SKIP_INSTALL}" -o "${TIMEOUT}" -n "${ANDROID_SERIAL}" -d "${JDK}" -c "${TEST_URL}" -t "${TEST_PARAMS}" -p "${TEST_PATH}"
# Upload test log and result files to artifactorial.
- - cp -r ./android-cts/results ./output/ || true
- - cp -r ./android-cts/logs ./output/ || true
- - tar caf cts-output-$(date +%Y%m%d%H%M%S).tar.xz ./output
- - ATTACHMENT=$(ls cts-output-*.tar.xz)
+ - cp -r ./${TEST_PATH}/results ./output/ || true
+ - cp -r ./${TEST_PATH}/logs ./output/ || true
+ - tar caf tradefed-output-$(date +%Y%m%d%H%M%S).tar.xz ./output
+ - ATTACHMENT=$(ls tradefed-output-*.tar.xz)
- ../../utils/upload-to-artifactorial.sh -a "${ATTACHMENT}" -u "${URL}" -t "${TOKEN}"
# Send test result to LAVA.
- ../../utils/send-to-lava.sh ./output/result.txt