summaryrefslogtreecommitdiffstats
path: root/testrunner/test_defs/host_test.py
diff options
context:
space:
mode:
authorBrett Chabot <brettchabot@android.com>2009-10-21 14:23:54 -0700
committerBrett Chabot <brettchabot@android.com>2009-10-21 14:35:37 -0700
commit924c0898792f4e14eb87a91a8e30d7138fb68be0 (patch)
treeffc72407564a8d3b474a5fd79e5d8b2bdd895e40 /testrunner/test_defs/host_test.py
parentec59a8834bbca256495045a6687a672f66b52df0 (diff)
downloadandroid_development-924c0898792f4e14eb87a91a8e30d7138fb68be0.tar.gz
android_development-924c0898792f4e14eb87a91a8e30d7138fb68be0.tar.bz2
android_development-924c0898792f4e14eb87a91a8e30d7138fb68be0.zip
Refactor runtest test_defs to allow programmatic creation.
Previously a test definition could only be created via xml. Also fix some minor lint warnings.
Diffstat (limited to 'testrunner/test_defs/host_test.py')
-rw-r--r--testrunner/test_defs/host_test.py41
1 files changed, 22 insertions, 19 deletions
diff --git a/testrunner/test_defs/host_test.py b/testrunner/test_defs/host_test.py
index 4aefa3a7b..81050754c 100644
--- a/testrunner/test_defs/host_test.py
+++ b/testrunner/test_defs/host_test.py
@@ -20,23 +20,15 @@
# python imports
import os
-# local imports
-from abstract_test import AbstractTestSuite
import errors
import logger
import run_command
+import test_suite
-class HostTestSuite(AbstractTestSuite):
+class HostTestSuite(test_suite.AbstractTestSuite):
"""A test suite for running hosttestlib java tests."""
- TAG_NAME = "test-host"
-
- _CLASS_ATTR = "class"
- # TODO: consider obsoleting in favor of parsing the Android.mk to find the
- # jar name
- _JAR_ATTR = "jar_name"
-
_JUNIT_JAR_NAME = "junit.jar"
_HOSTTESTLIB_NAME = "hosttestlib.jar"
_DDMLIB_NAME = "ddmlib.jar"
@@ -54,21 +46,29 @@ class HostTestSuite(AbstractTestSuite):
# the test suite?
_TEST_RUNNER = "com.android.hosttest.DeviceTestRunner"
- def Parse(self, suite_element):
- super(HostTestSuite, self).Parse(suite_element)
- self._ParseAttribute(suite_element, self._CLASS_ATTR, True)
- self._ParseAttribute(suite_element, self._JAR_ATTR, True)
+ def __init__(self):
+ test_suite.AbstractTestSuite.__init__(self)
+ self._jar_name = None
+ self._class_name = None
def GetBuildDependencies(self, options):
"""Override parent to tag on building host libs."""
return self._LIB_BUILD_PATHS
- def GetClass(self):
- return self._GetAttribute(self._CLASS_ATTR)
+ def GetClassName(self):
+ return self._class_name
+
+ def SetClassName(self, class_name):
+ self._class_name = class_name
+ return self
def GetJarName(self):
"""Returns the name of the host jar that contains the tests."""
- return self._GetAttribute(self._JAR_ATTR)
+ return self._jar_name
+
+ def SetJarName(self, jar_name):
+ self._jar_name = jar_name
+ return self
def Run(self, options, adb_interface):
"""Runs the host test.
@@ -77,11 +77,14 @@ class HostTestSuite(AbstractTestSuite):
Args:
options: command line options for running host tests. Expected member
- fields:
+ fields:
host_lib_path: path to directory that contains host library files
test_data_path: path to directory that contains test data files
preview: if true, do not execute, display commands only
adb_interface: reference to device under test
+
+ Raises:
+ errors.AbortError: if fatal error occurs
"""
# get the serial number of the device under test, so it can be passed to
# hosttestlib.
@@ -100,7 +103,7 @@ class HostTestSuite(AbstractTestSuite):
# -p <test data path>
cmd = "java -cp %s %s %s -s %s -p %s" % (":".join(full_lib_paths),
self._TEST_RUNNER,
- self.GetClass(), serial_number,
+ self.GetClassName(), serial_number,
options.test_data_path)
logger.Log(cmd)
if not options.preview: