summaryrefslogtreecommitdiffstats
path: root/testrunner
diff options
context:
space:
mode:
authorBrett Chabot <brettchabot@google.com>2009-06-02 11:46:04 -0700
committerBrett Chabot <brettchabot@google.com>2009-06-02 11:46:46 -0700
commit49b77117feb1d1a0efeae9498cf898a2e1e3ccfd (patch)
treeb0a911432951b5bcb008cb2a030925ffd8478b43 /testrunner
parentc825ab1d31af5092a9941e765159237ddd02ed88 (diff)
downloadandroid_development-49b77117feb1d1a0efeae9498cf898a2e1e3ccfd.tar.gz
android_development-49b77117feb1d1a0efeae9498cf898a2e1e3ccfd.tar.bz2
android_development-49b77117feb1d1a0efeae9498cf898a2e1e3ccfd.zip
Initial change to add cts tests to runtest.
Adds cts test definitions to the testrunner/test_defs.xml. Adds support for runtest --cts arg, which will run all cts tests. This temporarily relies on the addition of a 'cts' attribute to the test definition - a new xml format may be defined later that changes how cts tests are identified. This change is based on previous unsubmitted CL https://android-git.corp.google.com/g/Gerrit#change,1702. The only delta wrt to that change is the use of InstrumentationCtsTestRunner. Update: rebased to latest donut.
Diffstat (limited to 'testrunner')
-rwxr-xr-xtestrunner/errors.py2
-rwxr-xr-xtestrunner/runtest.py16
-rw-r--r--testrunner/test_defs.py18
-rw-r--r--testrunner/test_defs.xml158
-rw-r--r--testrunner/test_defs.xsd1
5 files changed, 190 insertions, 5 deletions
diff --git a/testrunner/errors.py b/testrunner/errors.py
index e24089918..c04fd012c 100755
--- a/testrunner/errors.py
+++ b/testrunner/errors.py
@@ -34,7 +34,7 @@ class AbortError(Exception):
"""Generic exception that indicates a fatal error has occurred and program
execution should be aborted."""
- def __init__(self, msg="AbortError"):
+ def __init__(self, msg=""):
self.msg = msg
diff --git a/testrunner/runtest.py b/testrunner/runtest.py
index 046eb7c31..e66b8def5 100755
--- a/testrunner/runtest.py
+++ b/testrunner/runtest.py
@@ -115,7 +115,10 @@ class TestRunner(object):
parser.add_option("--timeout", dest="timeout",
default=300, help="Set a timeout limit (in sec) for "
"running native tests on a device (default: 300 secs)")
-
+ parser.add_option("--cts", dest="cts_tests",
+ default=False, action="store_true",
+ help="Run all tests defined as part of the "
+ "compatibility test suite")
group = optparse.OptionGroup(
parser, "Targets", "Use these options to direct tests to a specific "
"Android target")
@@ -129,8 +132,11 @@ class TestRunner(object):
self._options, self._test_args = parser.parse_args()
- if (not self._options.only_list_tests and not self._options.all_tests
- and not self._options.continuous_tests and len(self._test_args) < 1):
+ if (not self._options.only_list_tests
+ and not self._options.all_tests
+ and not self._options.continuous_tests
+ and not self._options.cts_tests
+ and len(self._test_args) < 1):
parser.print_help()
logger.SilentLog("at least one test name must be specified")
raise errors.AbortError
@@ -229,8 +235,10 @@ class TestRunner(object):
"""Get a list of TestSuite objects to run, based on command line args."""
if self._options.all_tests:
return self._known_tests.GetTests()
- if self._options.continuous_tests:
+ elif self._options.continuous_tests:
return self._known_tests.GetContinuousTests()
+ elif self._options.cts_tests:
+ return self._known_tests.GetCtsTests()
tests = []
for name in self._test_args:
test = self._known_tests.GetTest(name)
diff --git a/testrunner/test_defs.py b/testrunner/test_defs.py
index 2cdcfa87c..0542a053d 100644
--- a/testrunner/test_defs.py
+++ b/testrunner/test_defs.py
@@ -144,6 +144,14 @@ class TestDefinitions(object):
con_tests.append(test)
return con_tests
+ def GetCtsTests(self):
+ """Return list of cts tests."""
+ cts_tests = []
+ for test in self.GetTests():
+ if test.IsCts():
+ cts_tests.append(test)
+ return cts_tests
+
def GetTest(self, name):
return self._testname_map.get(name, None)
@@ -157,6 +165,7 @@ class TestSuite(object):
_TARGET_ATTR = "coverage_target"
_BUILD_ATTR = "build_path"
_CONTINUOUS_ATTR = "continuous"
+ _CTS_ATTR = "cts"
_DESCRIPTION_ATTR = "description"
_EXTRA_MAKE_ARGS_ATTR = "extra_make_args"
@@ -199,6 +208,11 @@ class TestSuite(object):
self._continuous = suite_element.getAttribute(self._CONTINUOUS_ATTR)
else:
self._continuous = False
+ if suite_element.hasAttribute(self._CTS_ATTR):
+ self._cts = suite_element.getAttribute(self._CTS_ATTR)
+ else:
+ self._cts = False
+
if suite_element.hasAttribute(self._DESCRIPTION_ATTR):
self._description = suite_element.getAttribute(self._DESCRIPTION_ATTR)
else:
@@ -236,6 +250,10 @@ class TestSuite(object):
"""Returns true if test is flagged as being part of the continuous tests"""
return self._continuous
+ def IsCts(self):
+ """Returns true if test is part of the compatibility test suite"""
+ return self._cts
+
def IsNative(self):
"""Returns true if test is a native one."""
return self._native
diff --git a/testrunner/test_defs.xml b/testrunner/test_defs.xml
index 4121f7b90..e1d9cc54c 100644
--- a/testrunner/test_defs.xml
+++ b/testrunner/test_defs.xml
@@ -42,6 +42,8 @@ JAVA/application tests:
continuous: Optional boolean. Default is false. Set to true if tests are known
to be reliable, and should be included in a continuous test system. false if
they are under development.
+ cts: Optional boolean. Default is false. Set to true if test is included in
+ compatibility test suite.
description: Optional string. Default is empty. Short description (typically
less than 60 characters) about this test.
@@ -166,6 +168,162 @@ Native tests:
coverage_target="framework"
continuous="true" />
+<!-- cts tests -->
+
+<test name="cts-permission"
+ build_path="cts/tests"
+ package="com.android.cts.permission"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ continuous="true"
+ cts="true" />
+
+<test name="cts-process"
+ build_path="cts/tests"
+ package="com.android.cts.process"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-api-signature"
+ build_path="cts/tests"
+ package="android.tests.sigtest"
+ runner=".InstrumentationRunner"
+ cts="true" />
+
+<test name="cts-api-signature-func"
+ build_path="cts/tests"
+ package="android.tests.sigtest.tests"
+ cts="true" />
+
+<test name="cts-apidemos"
+ build_path="cts/tests"
+ package="android.apidemos.cts"
+ coverage_target="ApiDemos"
+ cts="true" />
+
+<test name="cts-app"
+ build_path="cts/tests"
+ package="com.android.cts.app"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-content"
+ build_path="cts/tests"
+ package="com.android.cts.content"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-database"
+ build_path="cts/tests"
+ package="com.android.cts.database"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-graphics"
+ build_path="cts/tests"
+ package="com.android.cts.graphics"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-hardware"
+ build_path="cts/tests"
+ package="com.android.cts.hardware"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-location"
+ build_path="cts/tests"
+ package="com.android.cts.location"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-net"
+ build_path="cts/tests"
+ package="com.android.cts.net"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-os"
+ build_path="cts/tests"
+ package="com.android.cts.os"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-perf1"
+ build_path="cts/tests"
+ package="com.android.cts.performance"
+ runner="android.test.InstrumentationCtsTestRunner"
+ cts="true" />
+
+<test name="cts-perf2"
+ build_path="cts/tests"
+ package="com.android.cts.performance2"
+ runner="android.test.InstrumentationCtsTestRunner"
+ cts="true" />
+
+<test name="cts-perf3"
+ build_path="cts/tests"
+ package="com.android.cts.performance3"
+ runner="android.test.InstrumentationCtsTestRunner"
+ cts="true" />
+
+<test name="cts-perf4"
+ build_path="cts/tests"
+ package="com.android.cts.performance4"
+ runner="android.test.InstrumentationCtsTestRunner"
+ cts="true" />
+
+<test name="cts-perf5"
+ build_path="cts/tests"
+ package="com.android.cts.performance5"
+ runner="android.test.InstrumentationCtsTestRunner"
+ cts="true" />
+
+<test name="cts-provider"
+ build_path="cts/tests"
+ package="com.android.cts.provider"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-text"
+ build_path="cts/tests"
+ package="com.android.cts.text"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-util"
+ build_path="cts/tests"
+ package="com.android.cts.util"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-view"
+ build_path="cts/tests"
+ package="com.android.cts.view"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<test name="cts-widget"
+ build_path="cts/tests"
+ package="com.android.cts.widget"
+ runner="android.test.InstrumentationCtsTestRunner"
+ coverage_target="framework"
+ cts="true" />
+
+<!-- end of cts tests -->
+
<!-- selected app tests -->
<test name="browser"
build_path="packages/apps/Browser"
diff --git a/testrunner/test_defs.xsd b/testrunner/test_defs.xsd
index 5387a2801..f9647795f 100644
--- a/testrunner/test_defs.xsd
+++ b/testrunner/test_defs.xsd
@@ -24,6 +24,7 @@
default="android.test.InstrumentationTestRunner"/>
<xs:attribute name="coverage_target" type="xs:string" use="optional"/>
<xs:attribute name="continuous" type="xs:boolean" use="optional" default="false"/>
+ <xs:attribute name="cts" type="xs:boolean" use="optional" default="false"/>
</xs:complexType>
<xs:complexType name="nativeTestType">