common: Have "assume" failures PASS
When we fail a JUnit4 "assume" check, we do not want to report
NOT_EXECUTED, as that indicates to the user that there was a
problem trying to run the test, and we need to run it again.
Eventually (b/28386054), we want to report this as SKIP to the
user. So we introduce some partial plumbing to allow that in
the future. But this will require a change of the TestStatus
enum, which is out of scope for this fix. So for now, we use
PASS so the user knows this isn't a CTS/GTS issue.
Bug: 28633728
Change-Id: Idf370aa7c44f1343d413a6301edcd02965bdd478
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java
index bae1bfa..e3e8757 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java
@@ -260,7 +260,7 @@
*/
@Override
public void testAssumptionFailure(TestIdentifier test, String trace) {
- mCurrentResult.notExecuted();
+ mCurrentResult.skipped();
logResult("%s failed assumption: %s", test, trace);
}
diff --git a/common/util/src/com/android/compatibility/common/util/ITestResult.java b/common/util/src/com/android/compatibility/common/util/ITestResult.java
index 701a629..918495b 100644
--- a/common/util/src/com/android/compatibility/common/util/ITestResult.java
+++ b/common/util/src/com/android/compatibility/common/util/ITestResult.java
@@ -119,10 +119,23 @@
/**
* Report that the test was not executed.
+ *
+ * This means something like a loss of connection to the hardware,
+ * and indicates the run of this test was invalid and needs to be redone.
*/
void notExecuted();
/**
+ * Report that the test was skipped.
+ *
+ * This means that the test is not considered appropriate for the
+ * current device, and thus is never attempted. Unlike notExecuted(),
+ * this indicates the run of this test was valid and nothing further
+ * needs to be done.
+ */
+ void skipped();
+
+ /**
* Resets the result.
*/
void reset();
diff --git a/common/util/src/com/android/compatibility/common/util/TestResult.java b/common/util/src/com/android/compatibility/common/util/TestResult.java
index aa635fc..d984a84 100644
--- a/common/util/src/com/android/compatibility/common/util/TestResult.java
+++ b/common/util/src/com/android/compatibility/common/util/TestResult.java
@@ -208,6 +208,16 @@
* {@inheritDoc}
*/
@Override
+ public void skipped() {
+ // TODO(b/28386054): Report SKIPPED as a separate result.
+ // For now, we mark this as PASS.
+ setResultStatus(TestStatus.PASS);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void reset() {
mResult = null;
mMessage = null;