CTS tradefed: ignore known failures.
This commit changes cts-tradefed, similiar to the existing CTS harness, to
ignore results from tests that are not listed in the CTS test package xml.
There are two main parts of this change:
- refactor the code that parses the test package xml, to expose methods to
determine if test is defined in xml (ITestCaseRepo, ITestPackageDef)
- Add a filter for CTS plan test results, that will discard test results
from unknown tests (ResultFilter, and changes to PlanTest to use ResultFilter)
Change-Id: Idf195682ebeab7fbb30562ac2d7aacbdd6679e13
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
index a75295e..cf67365 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
@@ -29,7 +29,7 @@
* <p/>
* Knows how to translate this info into a runnable {@link IRemoteTest}.
*/
-public class TestPackageDef {
+class TestPackageDef implements ITestPackageDef {
private static final String LOG_TAG = "TestPackageDef";
@@ -44,13 +44,15 @@
private Collection<TestIdentifier> mTests = new ArrayList<TestIdentifier>();
+ /** the cached {@link IRemoteTest} */
+ private IRemoteTest mRemoteTest;
+
void setUri(String uri) {
mUri = uri;
}
/**
- * Get the unique URI of the test package.
- * @return the {@link String} uri
+ * {@inheritDoc}
*/
public String getUri() {
return mUri;
@@ -114,13 +116,20 @@
}
/**
- * Creates a runnable {@link IRemoteTest} from info stored in this definition.
- *
- * @param testCaseDir {@link File} representing directory of test case data
- * @return a {@link IRemoteTest} with all necessary data populated to run the test or
- * <code>null</code> if test could not be created
+ * {@inheritDoc}
*/
public IRemoteTest createTest(File testCaseDir) {
+ if (mRemoteTest == null) {
+ mRemoteTest = doCreateTest(testCaseDir);
+ }
+ return mRemoteTest;
+ }
+
+ /**
+ * @param testCaseDir
+ * @return
+ */
+ private IRemoteTest doCreateTest(File testCaseDir) {
if (mIsHostSideTest) {
Log.d(LOG_TAG, String.format("Creating host test for %s", mName));
JarHostTest hostTest = new JarHostTest();
@@ -157,6 +166,13 @@
}
/**
+ * {@inheritDoc}
+ */
+ public boolean isKnownTest(TestIdentifier testDef) {
+ return mTests.contains(testDef);
+ }
+
+ /**
* Add a {@link TestDef} to the list of tests in this package.
*
* @param testdef