summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-09-30 11:24:55 -0400
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-09-30 11:24:55 -0400
commit163cb7dc5a77b186cf66b00be970af7a14203b5f (patch)
treea06518ea3e9f625efef087afc1f022d17ae80e6a /luni
parentc71b48a9f26a714b70be33b740620756f4bb8392 (diff)
parent16c26f4cdcd6f55c7409199484416e269b45b24a (diff)
downloadlibcore-163cb7dc5a77b186cf66b00be970af7a14203b5f.zip
libcore-163cb7dc5a77b186cf66b00be970af7a14203b5f.tar.gz
libcore-163cb7dc5a77b186cf66b00be970af7a14203b5f.tar.bz2
Merge change I866cc5d6
* changes: Improve run-core-tests.
Diffstat (limited to 'luni')
-rw-r--r--luni/src/test/java/com/google/coretests/CoreTestRunner.java49
1 files changed, 29 insertions, 20 deletions
diff --git a/luni/src/test/java/com/google/coretests/CoreTestRunner.java b/luni/src/test/java/com/google/coretests/CoreTestRunner.java
index d469c86..d80fa4e 100644
--- a/luni/src/test/java/com/google/coretests/CoreTestRunner.java
+++ b/luni/src/test/java/com/google/coretests/CoreTestRunner.java
@@ -15,6 +15,8 @@
*/
package com.google.coretests;
+import java.util.ArrayList;
+import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -134,10 +136,10 @@ public class CoreTestRunner extends TestRunner {
* Prints a help screen on the console.
*/
private void showHelp() {
- System.out.println("Usage: run-core-tests {<param>} <test>");
+ System.out.println("Usage: run-core-tests [OPTION]... [TEST]...");
System.out.println();
- System.out.println("Where <test> is a class name, optionally followed");
- System.out.println("by \"#\" and a method name, and <param> is one of");
+ System.out.println("Where each TEST is a class name, optionally followed");
+ System.out.println("by \"#\" and a method name, and each OPTION is one of");
System.out.println("the following:");
System.out.println();
System.out.println(" --include-all");
@@ -185,26 +187,29 @@ public class CoreTestRunner extends TestRunner {
}
/**
- * Tries to create a Test instance from a given string. The string might
+ * Tries to create a Test instance from the given strings. The strings might
* either specify a class only or a class plus a method name, separated by
* a "#".
*/
- private Test createTest(String testCase) throws Exception {
- int p = testCase.indexOf("#");
- if (p != -1) {
- String testName = testCase.substring(p + 1);
- testCase = testCase.substring(0, p);
-
- return TestSuite.createTest(Class.forName(testCase), testName);
- } else {
- return getTest(testCase);
+ private Test createTest(List<String> testCases) throws Exception {
+ TestSuite result = new TestSuite();
+ for (String testCase : testCases) {
+ int p = testCase.indexOf("#");
+ if (p != -1) {
+ String testName = testCase.substring(p + 1);
+ testCase = testCase.substring(0, p);
+
+ result.addTest(TestSuite.createTest(Class.forName(testCase), testName));
+ } else {
+ result.addTest(getTest(testCase));
+ }
}
-
+ return result;
}
@Override
protected TestResult start(String args[]) throws Exception {
- String testName = null;
+ List<String> testNames = new ArrayList<String>();
// String victimName = null;
boolean wait = false;
@@ -269,12 +274,12 @@ public class CoreTestRunner extends TestRunner {
showHelp();
System.exit(1);
} else {
- System.err.println("Unknown argument " + args[i] +
- ", try --help");
- System.exit(1);
+ unknownArgument(args[i]);
}
+ } else if (args[i].startsWith("-")) {
+ unknownArgument(args[i]);
} else {
- testName = args[i];
+ testNames.add(args[i]);
}
}
@@ -288,7 +293,7 @@ public class CoreTestRunner extends TestRunner {
System.out.println();
try {
- return doRun(createTest(testName), wait);
+ return doRun(createTest(testNames), wait);
}
catch(Exception e) {
e.printStackTrace();
@@ -296,4 +301,8 @@ public class CoreTestRunner extends TestRunner {
}
}
+ private static void unknownArgument(String arg) {
+ System.err.println("Unknown argument " + arg + ", try --help");
+ System.exit(1);
+ }
}