summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYing Chen <chying@google.com>2016-01-19 18:45:43 -0800
committerYing Chen <chying@google.com>2016-01-19 19:06:50 -0800
commit44a940906e37ba8f7a0c9e9258b02b186c95a793 (patch)
tree10fb5d5498ced957cc72d4ee4cd64ad8f38eb177
parent025c53a0a85595266b1dcb7634f90f952a6c0213 (diff)
downloadadt-infra-44a940906e37ba8f7a0c9e9258b02b186c95a793.tar.gz
Add tests of "-gpu mesa" for api above 16, add "-engine classic" for api above 22
Change-Id: I189652ca52cc39da80b4502e5a8227c7c9e6da84
-rw-r--r--build/scripts/slave/recipes/adt/adt.py9
-rw-r--r--emu_test/test_cts/test_cts.py2
-rw-r--r--emu_test/utils/emu_testcase.py54
3 files changed, 50 insertions, 15 deletions
diff --git a/build/scripts/slave/recipes/adt/adt.py b/build/scripts/slave/recipes/adt/adt.py
index 9e3d4c84..92da403d 100644
--- a/build/scripts/slave/recipes/adt/adt.py
+++ b/build/scripts/slave/recipes/adt/adt.py
@@ -104,8 +104,7 @@ def RunSteps(api):
if not deferred_step_result.is_ok:
stderr_output = deferred_step_result.get_error().result.stderr
print stderr_output
- lines = ['%s: %s' % (line[0:line.index(':')], line[line.rfind('.')+1:])
- for line in stderr_output.split('\n')
+ lines = [line for line in stderr_output.split('\n')
if line.startswith('FAIL:') or line.startswith('TIMEOUT:')]
for line in lines:
api.step.active_result.presentation.logs[line] = ''
@@ -124,20 +123,20 @@ def RunSteps(api):
api.path.join(log_dir, 'boot_test_public_sysimage'),
'test_boot.*',
'boot_cfg.csv',
- '{"tot_image": "no"}')
+ '{"api": "<=21"}')
# At least one of the system images are available
if str(api.properties['lmp_revision']) != 'None' and project in ['git_lmp-mr1-emu-dev', 'emu-master-dev']:
PythonTestStep('Boot Test - LMP System Image',
api.path.join(log_dir, 'boot_test_LMP_sysimage'),
'test_boot.*',
'boot_cfg.csv',
- '{"tot_image": "yes", "api": "22"}')
+ '{"api": "22"}')
if str(api.properties['mnc_revision']) != 'None' and project in ['git_mnc-emu-dev', 'emu-master-dev']:
PythonTestStep('Boot Test - MNC System Image',
api.path.join(log_dir, 'boot_test_MNC_sysimage'),
'test_boot.*',
'boot_cfg.csv',
- '{"tot_image": "yes", "api": "23"}')
+ '{"api": "23"}')
PythonTestStep('Run Emulator CTS Test',
api.path.join(log_dir, 'CTS_test'),
'test_cts.*',
diff --git a/emu_test/test_cts/test_cts.py b/emu_test/test_cts/test_cts.py
index 298c8c3b..3bea3310 100644
--- a/emu_test/test_cts/test_cts.py
+++ b/emu_test/test_cts/test_cts.py
@@ -118,7 +118,7 @@ def create_test_case_for_avds():
res = avd_name_re.match(avd_str)
assert res is not None
tag, abi, device, ram, gpu, api = avd_name_re.match(avd_str).groups()
- avd_config = AVDConfig(api, tag, abi, device, ram, gpu, "yes", ranchu="no", port="", cts=True)
+ avd_config = AVDConfig(api, tag, abi, device, ram, gpu, classic="no", port="", cts=True)
return avd_config
def fn(avd_name, plan):
diff --git a/emu_test/utils/emu_testcase.py b/emu_test/utils/emu_testcase.py
index 1fe8722c..7ad6d48e 100644
--- a/emu_test/utils/emu_testcase.py
+++ b/emu_test/utils/emu_testcase.py
@@ -18,7 +18,7 @@ from subprocess import PIPE, STDOUT
from collections import namedtuple
from ConfigParser import ConfigParser
-class AVDConfig(namedtuple('AVDConfig', 'api, tag, abi, device, ram, gpu, tot_image, ranchu, port, cts')):
+class AVDConfig(namedtuple('AVDConfig', 'api, tag, abi, device, ram, gpu, classic, port, cts')):
__slots__ = ()
def __str__(self):
device = self.device if self.device != '' else 'defdev'
@@ -119,8 +119,10 @@ class EmuBaseTestCase(LoggedTestCase):
"""Launch given avd and return immediately"""
exec_path = emu_args.emulator_exec
launch_cmd = [exec_path, "-avd", str(avd), "-verbose", "-show-kernel", "-wipe-data"]
- if avd.ranchu == "yes":
- launch_cmd += ["-ranchu"]
+ if avd.classic == "yes" and avd.api > "21":
+ launch_cmd += ["-engine", "classic"]
+ if avd.gpu == "mesa":
+ launch_cmd += ["-gpu", "mesa"]
def launch_in_thread():
self.start_proc = psutil.Popen(launch_cmd, stdout=PIPE, stderr=STDOUT)
@@ -199,8 +201,9 @@ class EmuBaseTestCase(LoggedTestCase):
'%s.avd' % avd_config.name(), 'config.ini')
if avd_config.device == "":
self.m_logger.info("No device information, use default settings!")
+ gpu = "no" if avd_config.gpu == "no" else "yes"
with open(dst_path, 'a') as fout:
- fout.write('hw.gpu.enabled=%s' % avd_config.gpu)
+ fout.write('hw.gpu.enabled=%s' % gpu)
return
class AVDIniConverter:
output_file = None
@@ -239,7 +242,8 @@ class EmuBaseTestCase(LoggedTestCase):
set_val('hw.cpu.arch', abi_to_cpu_arch[avd_config.abi])
if avd_config.abi == 'armeabi-v7a':
set_val('hw.cpu.model', 'cortex-a8')
- set_val('hw.gpu.enabled', avd_config.gpu)
+ gpu = "no" if avd_config.gpu == "no" else "yes"
+ set_val('hw.gpu.enabled', gpu)
set_val('hw.ramSize', avd_config.ram)
set_val('image.sysdir.1',
'system-images/android-%s/%s/%s/' % (avd_config.api, avd_config.tag, avd_config.abi))
@@ -332,9 +336,35 @@ def create_test_case_from_file(desc, testcase_class, test_func):
return str(get_port._port)
def valid_case(avd_config):
+ def fn_leq(x,y): return x <= y
+ def fn_less(x,y): return x < y
+ def fn_geq(x,y): return x >= y
+ def fn_greater(x,y): return x > y
+ def fn_eq(x,y): return x == y
+ def fn_neq(x,y): return x != y
+
+ op_lookup = {
+ "==": fn_eq,
+ "=": fn_eq,
+ "!=": fn_neq,
+ "<>": fn_neq,
+ ">": fn_greater,
+ "<": fn_less,
+ ">=": fn_geq,
+ "<=": fn_leq
+ }
if emu_args.filter_dict is not None:
for key, value in emu_args.filter_dict.iteritems():
- if getattr(avd_config, key) != value:
+ if any([value.startswith(x) for x in ["==", "!=", "<>", ">=", "<="]]):
+ cmp_op = value[:2]
+ cmp_val = value[2:]
+ elif any([value.startswith(x) for x in ["=", ">", "<"]]):
+ cmp_op = value[:1]
+ cmp_val = value[1:]
+ else:
+ cmp_op = "=="
+ cmp_val = value
+ if not op_lookup[cmp_op](getattr(avd_config, key), cmp_val):
return False
return True
@@ -348,9 +378,15 @@ def create_test_case_from_file(desc, testcase_class, test_func):
# TODO: handle flakey tests
elif op == "F":
func = func
- qemu_str = "_qemu2" if avd_config.ranchu == "yes" else ""
+ qemu_str = "_qemu1"
+ if avd_config.api > "21" and avd_config.classic == "no":
+ qemu_str = "_qemu2"
setattr(testcase_class, "test_%s_%s%s" % (desc, str(avd_config), qemu_str), func)
+ if platform.system() != "Darwin" and avd_config.api > "15" and avd_config.gpu == "yes":
+ avd_config_mesa = avd_config._replace(gpu = "mesa")
+ create_test_case(avd_config_mesa, op)
+
with open(emu_args.config_file, "rb") as file:
reader = csv.reader(file)
for row in reader:
@@ -387,9 +423,9 @@ def create_test_case_from_file(desc, testcase_class, test_func):
if api < "22" and row[6] == "yes":
raise ConfigError()
tot_image = row[6] if row[6] == "yes" else "no"
- avd_config = AVDConfig(api, tag, abi, device, ram, gpu, tot_image, ranchu="no", port=get_port(), cts=False)
+ avd_config = AVDConfig(api, tag, abi, device, ram, gpu, classic="yes", port=get_port(), cts=False)
create_test_case(avd_config, op)
# for unreleased images, test with qemu2 in addition
if tot_image == "yes":
- avd_config = AVDConfig(api, tag, abi, device, ram, gpu, tot_image, ranchu="yes", port=get_port(), cts=False)
+ avd_config = AVDConfig(api, tag, abi, device, ram, gpu, classic="no", port=get_port(), cts=False)
create_test_case(avd_config, op)