DO NOT MERGE. Cherry pick 'Support multiple notAnnotation values'
Bug 12208088
Change-Id: I7e79220ba1572baf1851687f44e3bf635367853f
diff --git a/androidtestlib/src/com/android/test/runner/AndroidJUnitRunner.java b/androidtestlib/src/com/android/test/runner/AndroidJUnitRunner.java
index f3c2aa7..1006665 100644
--- a/androidtestlib/src/com/android/test/runner/AndroidJUnitRunner.java
+++ b/androidtestlib/src/com/android/test/runner/AndroidJUnitRunner.java
@@ -107,6 +107,10 @@
* e.g. "-e size large -e notAnnotation com.android.foo.MyAnnotation" will run tests with
* the {@link LargeTest} annotation that do NOT have the "com.android.foo.MyAnnotation" annotations.
* <p/>
+ * <b>Filter test run to tests <i>without any</i> of a list of annotations:</b> adb shell am
+ * instrument -w -e notAnnotation com.android.foo.MyAnnotation,com.android.foo.AnotherAnnotation
+ * com.android.foo/com.android.test.runner.AndroidJUnitRunner
+ * <p/>
* <b>To run in 'log only' mode</b>
* -e log true
* This option will load and iterate through all test classes and methods, but will bypass actual
@@ -361,9 +365,11 @@
builder.addAnnotationInclusionFilter(annotation);
}
- String notAnnotation = arguments.getString(ARGUMENT_NOT_ANNOTATION);
- if (notAnnotation != null) {
- builder.addAnnotationExclusionFilter(notAnnotation);
+ String notAnnotations = arguments.getString(ARGUMENT_NOT_ANNOTATION);
+ if (notAnnotations != null) {
+ for (String notAnnotation : notAnnotations.split(",")) {
+ builder.addAnnotationExclusionFilter(notAnnotation);
+ }
}
if (getBooleanArgument(ARGUMENT_LOG_ONLY)) {