summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2010-04-26 10:31:19 -0700
committerJesse Wilson <jessewilson@google.com>2010-04-26 10:32:21 -0700
commit16a64bbb650f906e3b65897283d16086d2b6b823 (patch)
tree0bb00bc5b41615d2f6469990d10b13dffa6757ea
parent8798e411f22b743d80b08cc34970f8c74a55aacf (diff)
downloadlibcore-16a64bbb650f906e3b65897283d16086d2b6b823.zip
libcore-16a64bbb650f906e3b65897283d16086d2b6b823.tar.gz
libcore-16a64bbb650f906e3b65897283d16086d2b6b823.tar.bz2
Removing vogar from Dalvik's git tree; the source is now on code.google.com.
http://code.google.com/p/vogar/
-rw-r--r--tools/integrate/Android.mk19
-rw-r--r--tools/integrate/Command.java104
-rw-r--r--tools/integrate/Filesystem.java80
-rw-r--r--tools/integrate/Git.java90
-rw-r--r--tools/integrate/MappedDirectory.java41
-rw-r--r--tools/integrate/Module.java113
-rw-r--r--tools/integrate/PullHarmonyCode.java162
-rw-r--r--tools/integrate/PushAndroidCode.java87
-rw-r--r--tools/integrate/Svn.java25
-rw-r--r--tools/runner/Android.mk33
-rw-r--r--tools/runner/expectations/brokentests.txt742
-rw-r--r--tools/runner/expectations/todo.txt99
-rw-r--r--tools/runner/java/vogar/Action.java93
-rw-r--r--tools/runner/java/vogar/ActivityMode.java168
-rw-r--r--tools/runner/java/vogar/CaliperSpec.java51
-rw-r--r--tools/runner/java/vogar/Classpath.java61
-rw-r--r--tools/runner/java/vogar/Console.java224
-rw-r--r--tools/runner/java/vogar/DeviceDalvikVm.java111
-rw-r--r--tools/runner/java/vogar/Driver.java300
-rw-r--r--tools/runner/java/vogar/Environment.java83
-rw-r--r--tools/runner/java/vogar/EnvironmentDevice.java78
-rw-r--r--tools/runner/java/vogar/EnvironmentHost.java51
-rw-r--r--tools/runner/java/vogar/Expectation.java75
-rw-r--r--tools/runner/java/vogar/ExpectationStore.java185
-rw-r--r--tools/runner/java/vogar/HostMonitor.java208
-rw-r--r--tools/runner/java/vogar/JUnitSpec.java54
-rw-r--r--tools/runner/java/vogar/JavaVm.java61
-rw-r--r--tools/runner/java/vogar/Javac.java73
-rw-r--r--tools/runner/java/vogar/JtregSpec.java141
-rw-r--r--tools/runner/java/vogar/MainSpec.java43
-rw-r--r--tools/runner/java/vogar/Md5Cache.java117
-rw-r--r--tools/runner/java/vogar/Mode.java224
-rw-r--r--tools/runner/java/vogar/NamingPatternRunnerSpec.java104
-rw-r--r--tools/runner/java/vogar/Option.java36
-rw-r--r--tools/runner/java/vogar/OptionParser.java444
-rw-r--r--tools/runner/java/vogar/Outcome.java102
-rw-r--r--tools/runner/java/vogar/Result.java34
-rw-r--r--tools/runner/java/vogar/RunnerSpec.java56
-rw-r--r--tools/runner/java/vogar/Strings.java77
-rw-r--r--tools/runner/java/vogar/TestProperties.java61
-rw-r--r--tools/runner/java/vogar/Threads.java42
-rw-r--r--tools/runner/java/vogar/Vm.java170
-rw-r--r--tools/runner/java/vogar/Vogar.java414
-rw-r--r--tools/runner/java/vogar/XmlReportPrinter.java192
-rw-r--r--tools/runner/java/vogar/commands/Aapt.java49
-rw-r--r--tools/runner/java/vogar/commands/Adb.java114
-rw-r--r--tools/runner/java/vogar/commands/Command.java238
-rw-r--r--tools/runner/java/vogar/commands/CommandFailedException.java54
-rw-r--r--tools/runner/java/vogar/commands/Dx.java65
-rw-r--r--tools/runner/java/vogar/commands/Mkdir.java29
-rw-r--r--tools/runner/java/vogar/commands/Rm.java41
-rw-r--r--tools/runner/java/vogar/target/CaliperRunner.java44
-rw-r--r--tools/runner/java/vogar/target/JUnitRunner.java130
-rw-r--r--tools/runner/java/vogar/target/JtregRunner.java50
-rw-r--r--tools/runner/java/vogar/target/MainRunner.java49
-rw-r--r--tools/runner/java/vogar/target/Runner.java29
-rw-r--r--tools/runner/java/vogar/target/TargetMonitor.java106
-rw-r--r--tools/runner/java/vogar/target/TestRunner.java110
-rw-r--r--tools/runner/lib/TestActivity.java61
-rw-r--r--tools/runner/lib/caliper.jarbin442344 -> 0 bytes
-rw-r--r--tools/runner/lib/caliper.jar.txt202
-rw-r--r--tools/runner/lib/guava.jarbin579101 -> 0 bytes
-rw-r--r--tools/runner/lib/guava.jar.txt202
-rw-r--r--tools/runner/lib/javatest.jarbin4218879 -> 0 bytes
-rw-r--r--tools/runner/lib/jh.jarbin500645 -> 0 bytes
-rw-r--r--tools/runner/lib/jsr305.jarbin18308 -> 0 bytes
-rw-r--r--tools/runner/lib/jsr305.jar.txt28
-rw-r--r--tools/runner/lib/jtreg.jarbin374314 -> 0 bytes
-rwxr-xr-xtools/runner/test-dalvik-runner.sh53
-rwxr-xr-xtools/runner/vogar25
70 files changed, 0 insertions, 7407 deletions
diff --git a/tools/integrate/Android.mk b/tools/integrate/Android.mk
deleted file mode 100644
index f0f25b3..0000000
--- a/tools/integrate/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- Command.java \
- Filesystem.java \
- Git.java \
- Module.java \
- MappedDirectory.java \
- PullHarmonyCode.java \
- PushAndroidCode.java \
- Svn.java
-
-LOCAL_MODULE:= integrate
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-subdir-makefiles)
diff --git a/tools/integrate/Command.java b/tools/integrate/Command.java
deleted file mode 100644
index 5e7796f..0000000
--- a/tools/integrate/Command.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * An out of process executable.
- */
-class Command {
-
- private final List<String> args;
- private final boolean permitNonZeroExitStatus;
-
- Command(String... args) {
- this(Arrays.asList(args));
- }
-
- Command(List<String> args) {
- this.args = new ArrayList<String>(args);
- this.permitNonZeroExitStatus = false;
- }
-
- private Command(Builder builder) {
- this.args = new ArrayList<String>(builder.args);
- this.permitNonZeroExitStatus = builder.permitNonZeroExitStatus;
- }
-
- static class Builder {
- private final List<String> args = new ArrayList<String>();
- private boolean permitNonZeroExitStatus = false;
-
- public Builder args(String... args) {
- return args(Arrays.asList(args));
- }
-
- public Builder args(Collection<String> args) {
- this.args.addAll(args);
- return this;
- }
-
- public Builder permitNonZeroExitStatus() {
- permitNonZeroExitStatus = true;
- return this;
- }
-
- public Command build() {
- return new Command(this);
- }
-
- public List<String> execute() {
- return build().execute();
- }
- }
-
- public List<String> execute() {
- try {
- Process process = new ProcessBuilder()
- .command(args)
- .redirectErrorStream(true)
- .start();
-
- BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
- List<String> outputLines = new ArrayList<String>();
- String outputLine;
- while ((outputLine = in.readLine()) != null) {
- outputLines.add(outputLine);
- }
-
- if (process.waitFor() != 0 && !permitNonZeroExitStatus) {
- StringBuilder message = new StringBuilder();
- for (String line : outputLines) {
- message.append("\n").append(line);
- }
- throw new RuntimeException("Process failed: " + args + message);
- }
-
- return outputLines;
- } catch (IOException e) {
- throw new RuntimeException("Process failed: " + args, e);
- } catch (InterruptedException e) {
- throw new RuntimeException("Process failed: " + args, e);
- }
- }
-
-}
diff --git a/tools/integrate/Filesystem.java b/tools/integrate/Filesystem.java
deleted file mode 100644
index 4b296a0..0000000
--- a/tools/integrate/Filesystem.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Factory for filesystem commands.
- */
-class Filesystem {
-
- public void move(String source, String target) {
- new Command("mv", source, target).execute();
- }
-
- /**
- * Moves all of the files in {@code source} to {@code target}, one at a
- * time. Unlike {@code move}, this approach works even if the target
- * directory is nonempty.
- */
- public int moveContents(String source, String target) {
- return copyContents(true, source, target);
- }
-
- /**
- * Copies all of the files in {@code source} to {@code target}, one at a
- * time. Unlike {@code move}, this approach works even if the target
- * directory is nonempty.
- */
- public int copyContents(String source, String target) {
- return copyContents(false, source, target);
- }
-
- private int copyContents(boolean move, String source, String target) {
- List<String> files = new Command("find", source, "-type", "f") .execute();
- for (String file : files) {
- String targetFile = target + "/" + file.substring(source.length());
- mkdir(parent(targetFile));
- if (move) {
- new Command("mv", "-i", file, targetFile).execute();
- } else {
- new Command("cp", file, targetFile).execute();
- }
- }
- return files.size();
- }
-
- private String parent(String file) {
- return file.substring(0, file.lastIndexOf('/'));
- }
-
- public void mkdir(String dir) {
- new Command("mkdir", "-p", dir).execute();
- }
-
- public List<String> find(String where, String name) {
- return new Command("find", where, "-name", name).execute();
- }
-
- public void rm(Collection<String> files) {
- new Command.Builder().args("rm", "-r").args(files).execute();
- }
-
- public void rm(String file) {
- new Command("rm", "-r", file).execute();
- }
-}
diff --git a/tools/integrate/Git.java b/tools/integrate/Git.java
deleted file mode 100644
index da7dcfa..0000000
--- a/tools/integrate/Git.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Factory for git commands.
- */
-class Git {
-
- private static final Pattern STATUS_DELETED
- = Pattern.compile("#\\tdeleted: (.*)");
-
- public void branch(String newBranch) {
- branch(newBranch, "HEAD");
- }
-
- /**
- * @param base another branch, or a revision identifier like {@code HEAD}.
- */
- public void branch(String newBranch, String base) {
- // -b is used by git to branch from another checkout
- new Command("git", "checkout", "-b", newBranch, base).execute();
- }
-
- public void commit(String message) {
- new Command("git", "commit", "-m", message).execute();
- }
-
- public void add(String path) {
- new Command("git", "add", path).execute();
- }
-
- public void remove(Collection<String> paths) {
- new Command.Builder().args("git", "rm").args(paths).execute();
- }
-
- public List<String> merge(String otherBranch) {
- return new Command.Builder()
- .args("git", "merge", "-s", "recursive", otherBranch)
- .permitNonZeroExitStatus()
- .execute();
- }
-
- /**
- * Returns the files that have been deleted from the filesystem, but that
- * don't exist in the active git change.
- */
- public List<String> listDeleted() {
- List<String> statusLines = new Command.Builder()
- .args("git", "status")
- .permitNonZeroExitStatus()
- .execute();
-
- List<String> deletedFiles = new ArrayList<String>();
- Matcher matcher = STATUS_DELETED.matcher("");
- for (String line : statusLines) {
- matcher.reset(line);
- if (matcher.matches()) {
- deletedFiles.add(matcher.group(1));
- }
- }
- return deletedFiles;
- }
-
- public void rm(List<String> files) {
- new Command.Builder()
- .args("git", "rm").args(files)
- .permitNonZeroExitStatus()
- .build()
- .execute();
- }
-}
diff --git a/tools/integrate/MappedDirectory.java b/tools/integrate/MappedDirectory.java
deleted file mode 100644
index 8e28d29..0000000
--- a/tools/integrate/MappedDirectory.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * A logical directory that has a different location in Harmony and Dalvik.
- */
-class MappedDirectory {
-
- private final String svnPath;
- private final String gitPath;
-
- public MappedDirectory(String svnPath, String gitPath) {
- this.svnPath = svnPath;
- this.gitPath = gitPath;
- }
-
- public String svnPath() {
- return svnPath;
- }
-
- public String gitPath() {
- return gitPath;
- }
-
- @Override public String toString() {
- return "svn:" + svnPath + " -> git:" + gitPath;
- }
-}
diff --git a/tools/integrate/Module.java b/tools/integrate/Module.java
deleted file mode 100644
index 02cdb6a..0000000
--- a/tools/integrate/Module.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * A logical unit of code shared between Apache Harmony and Dalvik.
- */
-class Module {
-
- static final Map<String, Module> VALUES;
- static {
- Map<String, Module> valuesMutable = new LinkedHashMap<String, Module>();
-
- String svnRoot = "http://svn.apache.org/repos/asf/harmony/enhanced/classlib/trunk/modules";
- valuesMutable.put("archive", new Module.Builder(svnRoot, "archive")
- .mapDirectory("archive/src/main/native/archive/shared",
- "archive/src/main/native")
- .mapDirectory("archive/src/main/native/zip/shared",
- "archive/src/main/native")
- .build());
-
- valuesMutable.put("crypto", new Module.Builder(svnRoot, "crypto")
- .mapDirectory("crypto/src/test/api/java.injected/javax",
- "crypto/src/test/java/org/apache/harmony/crypto/tests/javax")
- .mapDirectory("crypto/src/test/api/java",
- "crypto/src/test/java")
- .mapDirectory("crypto/src/test/resources/serialization",
- "crypto/src/test/java/serialization")
- .mapDirectory("crypto/src/test/support/common/java",
- "crypto/src/test/java")
- .build());
-
- valuesMutable.put("logging", new Module.Builder(svnRoot, "logging").build());
-
- valuesMutable.put("regex", new Module.Builder(svnRoot, "regex").build());
-
- valuesMutable.put("security", new Module.Builder(svnRoot, "security")
- .mapDirectory("security/src/main/java/common",
- "security/src/main/java")
- .mapDirectory("security/src/main/java/unix/org",
- "security/src/main/java/org")
- .mapDirectory("security/src/test/api/java",
- "security/src/test/java")
- .build());
-
- valuesMutable.put("text", new Module.Builder(svnRoot, "text").build());
-
- valuesMutable.put("x-net", new Module.Builder(svnRoot, "x-net").build());
-
- VALUES = Collections.unmodifiableMap(valuesMutable);
- }
-
- private final String svnBaseUrl;
- private final String path;
- private final Set<MappedDirectory> mappedDirectories;
-
- public String getSvnBaseUrl() {
- return svnBaseUrl;
- }
-
- public String path() {
- return path;
- }
-
- public Set<MappedDirectory> getMappedDirectories() {
- return mappedDirectories;
- }
-
- private Module(Builder builder) {
- this.svnBaseUrl = builder.svnBaseUrl;
- this.path = builder.path;
- this.mappedDirectories = new LinkedHashSet<MappedDirectory>(builder.mappedDirectories);
- }
-
- public static class Builder {
- private final String svnBaseUrl;
- private final String path;
- private final Set<MappedDirectory> mappedDirectories
- = new LinkedHashSet<MappedDirectory>();
-
- public Builder(String svnBaseUrl, String path) {
- this.svnBaseUrl = svnBaseUrl;
- this.path = path;
- }
-
- public Builder mapDirectory(String svnPath, String gitPath) {
- mappedDirectories.add(new MappedDirectory(svnPath, gitPath));
- return this;
- }
-
- public Module build() {
- return new Module(this);
- }
- }
-}
diff --git a/tools/integrate/PullHarmonyCode.java b/tools/integrate/PullHarmonyCode.java
deleted file mode 100644
index ce019d4..0000000
--- a/tools/integrate/PullHarmonyCode.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.util.List;
-import java.util.UUID;
-
-/**
- * Download two versions of Apache Harmony from their SVN version, and use it
- * to perform a three-way merge with Dalvik.
- */
-public class PullHarmonyCode {
-
- private final int currentVersion;
- private final int targetVersion;
-
- public PullHarmonyCode(int currentVersion, int targetVersion) {
- this.currentVersion = currentVersion;
- this.targetVersion = targetVersion;
- }
-
- public void pull(Module module) {
- String path = module.path();
- String svnOldBranch = path + "_" + currentVersion;
- String svnNewBranch = path + "_" + targetVersion;
- String dalvikBranch = path + "_dalvik";
-
- Git git = new Git();
- Filesystem filesystem = new Filesystem();
- Svn svn = new Svn();
-
- // Assume we're starting with the current Dalvik code. Tuck this away
- // somewhere while we rewrite history.
- String temp = "/tmp/" + UUID.randomUUID();
- filesystem.mkdir(temp);
-
- // To prepare a three-way-merge, we need a common starting point: the
- // time at which Dalvik and Harmony were most the same. We'll use the
- // previous Harmony SVN code as this starting point. We grab the old
- // code from their repository, and commit it as a git branch.
- System.out.print("Creating branch " + svnOldBranch + "...");
- git.branch(svnOldBranch);
- filesystem.move(path, temp + "/" + path);
- svn.checkOut(currentVersion, module.getSvnBaseUrl() + "/" + path);
- filesystem.rm(filesystem.find(path, ".svn"));
- for (MappedDirectory mappedDirectory : module.getMappedDirectories()) {
- filesystem.moveContents(mappedDirectory.svnPath(), mappedDirectory.gitPath());
- }
- git.rm(git.listDeleted());
- git.add(path);
- git.commit(svnOldBranch);
- System.out.println("done");
-
- // Create a branch that's derived from the starting point. It will
- // contain all of the changes Harmony has made from then until now.
- System.out.print("Creating branch " + svnNewBranch + "...");
- git.branch(svnNewBranch, svnOldBranch);
- filesystem.rm(path);
- svn.checkOut(targetVersion, module.getSvnBaseUrl() + "/" + path);
- filesystem.rm(filesystem.find(path, ".svn"));
- for (MappedDirectory mappedDirectory : module.getMappedDirectories()) {
- filesystem.moveContents(mappedDirectory.svnPath(), mappedDirectory.gitPath());
- }
- git.rm(git.listDeleted());
- git.add(path);
- git.commit(svnNewBranch);
- System.out.println("done");
-
- // Create another branch that's derived from the starting point. It will
- // contain all of the changes Dalvik has made from then until now.
- System.out.print("Creating branch " + dalvikBranch + "...");
- git.branch(dalvikBranch, svnOldBranch);
- filesystem.rm(path);
- filesystem.move(temp + "/" + path, path);
- git.rm(git.listDeleted());
- git.add(path);
- git.commit(dalvikBranch);
- System.out.println("done");
-
- // Merge the two sets of changes together: Harmony's and Dalvik's. By
- // initializing a common starting point, git can make better decisions
- // when the two new versions differ. For example, if today's Dalvik has
- // a method that today's Harmony does not, it may be because Dalvik
- // added it, or because Harmony deleted it!
- System.out.println("Merging " + svnNewBranch + " into " + dalvikBranch + ":");
- List<String> mergeResults = git.merge(svnNewBranch);
- for (String mergeResult : mergeResults) {
- System.out.print(" ");
- System.out.println(mergeResult);
- }
- }
-
-
- public static void main(String[] args) {
- if (args.length < 3) {
- printUsage();
- return;
- }
-
- int currentSvnRev = Integer.parseInt(args[0]);
- int targetSvnRev = Integer.parseInt(args[1]);
-
- if (currentSvnRev < 527399 || targetSvnRev <= currentSvnRev) {
- System.out.println("Invalid SVN revision range: "
- + currentSvnRev + ".." + targetSvnRev);
- return;
- }
-
- Module module = Module.VALUES.get(args[2]);
- if (module == null) {
- System.out.println("No such module: " + args[2]);
- return;
- }
-
- PullHarmonyCode puller = new PullHarmonyCode(currentSvnRev, targetSvnRev);
- puller.pull(module);
- }
-
- private static void printUsage() {
- System.out.println("This tool will prepare a three-way merge between the latest Harmony");
- System.out.println("the latest Dalvik, and their common ancestor. It downloads both old");
- System.out.println("and new versions of Harmony code from SVN for better merge results.");
- System.out.println();
- System.out.println("Usage: PullHarmonyCode <current_rev> <target_rev> <module>...");
- System.out.println();
- System.out.println(" <current_rev> is the SVN revision of the Harmony code that was");
- System.out.println(" most recently integrated into Dalvik. This should");
- System.out.println(" be a number greater than 527399. The current");
- System.out.println(" revision for each module is tracked at");
- System.out.println(" http://go/dalvik/harmony");
- System.out.println();
- System.out.println(" <target_rev> is the SVN revision of the Harmony code to be");
- System.out.println(" merged into Dalvik. This should be a number greater");
- System.out.println(" than <current_rev>. The latest Harmony revision is");
- System.out.println(" tracked at");
- System.out.println(" http://svn.apache.org/viewvc/harmony/?root=Apache-SVN");
- System.out.println();
- System.out.println(" <module> is one of " + Module.VALUES.keySet());
- System.out.println();
- System.out.println("This program must be executed from within the dalvik/libcore directory");
- System.out.println("of an Android git client. Such a client must be synced and contain no");
- System.out.println("uncommitted changes. Upon termination, a new Git branch with the");
- System.out.println("integrated changes will be active. This branch may require some manual");
- System.out.println("merging.");
- System.out.println();
- System.out.println("Example usage:");
- System.out.println(" java -cp ../../out/host/linux-x86/framework/integrate.jar PullAndroidCode \\");
- System.out.println(" 527399 802921 security");
- }
-}
diff --git a/tools/integrate/PushAndroidCode.java b/tools/integrate/PushAndroidCode.java
deleted file mode 100644
index c0002f5..0000000
--- a/tools/integrate/PushAndroidCode.java
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2009 Google Inc. All Rights Reserved.
-
-import java.util.UUID;
-
-/**
- * Copy the current Android sourcecode into Apache Harmony, where it can be
- * reviewed and submitted to their SVN. Only run this script after first merging
- * the latest harmony code into Android.
- */
-public class PushAndroidCode {
-
- private final String androidPath;
- private final String harmonyPath;
-
- public PushAndroidCode(String androidPath, String harmonyPath) {
- this.androidPath = androidPath;
- this.harmonyPath = harmonyPath;
- }
-
- public void push(Module module) {
- Filesystem filesystem = new Filesystem();
-
- // copy android code to a temp directory that is laid out like Harmony
- String temp = "/tmp/" + UUID.randomUUID();
- filesystem.mkdir(temp);
- filesystem.copyContents(androidPath + "/" + module.path(),
- temp + "/" + module.path());
- for (MappedDirectory mappedDirectory : module.getMappedDirectories()) {
- filesystem.moveContents(
- temp + "/" + mappedDirectory.gitPath(),
- temp + "/" + mappedDirectory.svnPath());
- }
-
- // clobber files from harmony with their Android equivalents
- filesystem.copyContents(temp + "/" + module.path(),
- harmonyPath + "/" + module.path());
- }
-
- public static void main(String[] args) {
- if (args.length < 3) {
- printUsage();
- return;
- }
-
- String androidPath = args[0] + "/dalvik/libcore";
- String harmonyPath = args[1] + "/working_classlib/modules";
-
- // TODO: validate directories?
-
- Module[] modules = new Module[args.length - 2];
- for (int i = 0; i < modules.length; i++) {
- modules[i] = Module.VALUES.get(args[i+2]);
- if (modules[i] == null) {
- System.out.println("No such module: " + args[i+2]);
- return;
- }
- }
-
- PushAndroidCode pusher = new PushAndroidCode(androidPath, harmonyPath);
- for (Module module : modules) {
- pusher.push(module);
- }
- }
-
- private static void printUsage() {
- System.out.println("This tool will clobber Harmony's core libraries with Android's copy");
- System.out.println("so that a patch can be submitted upstream.");
- System.out.println();
- System.out.println("Usage: PushAndroidCode <android_root> <harmony_root> <module>...");
- System.out.println();
- System.out.println(" <android_root> is the android git client directory that contains dalvik");
- System.out.println(" This should hold an up-to-date checkout of Android. The");
- System.out.println(" target modules should also be up-to-date with respect to");
- System.out.println(" Harmony; use the PullHarmonyCode tool first if necessary.");
- System.out.println();
- System.out.println(" <harmony_root> is the android client directory that contains working_classlib.");
- System.out.println(" This should hold an up-to-date checkout of Harmony.");
- System.out.println();
- System.out.println(" <module> is one of " + Module.VALUES.keySet());
- System.out.println();
- System.out.println("Example usage:");
- System.out.println(" java -cp out/host/linux-x86/framework/integrate.jar PushAndroidCode \\");
- System.out.println(" /usr/local/google/jesse/clients/jessewilson_g1 \\");
- System.out.println(" /usr/local/google/jesse/clients/jessewilson_h0/trunk \\");
- System.out.println(" crypto");
- }
-}
diff --git a/tools/integrate/Svn.java b/tools/integrate/Svn.java
deleted file mode 100644
index dc9be35..0000000
--- a/tools/integrate/Svn.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Factory for Subversion commands.
- */
-class Svn {
-
- public void checkOut(int version, String url) {
- new Command("svn", "co", "-r", "" + version, url).execute();
- }
-}
diff --git a/tools/runner/Android.mk b/tools/runner/Android.mk
deleted file mode 100644
index b208219..0000000
--- a/tools/runner/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-# build DalvikRunner from the source under java/.
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,java)
-LOCAL_MODULE:= dalvik_runner
-LOCAL_STATIC_JAVA_LIBRARIES := caliper javatest jh jtreg kxml2-2.3.0
-# TODO this only works when junit is already built...
-LOCAL_JAVA_LIBRARIES := junit
-LOCAL_JAVACFLAGS := -Werror -Xlint:unchecked
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(call all-subdir-makefiles)
-
-# prebuilt caliper.jar
-include $(CLEAR_VARS)
-LOCAL_PREBUILT_JAVA_LIBRARIES := caliper:lib/caliper.jar
-include $(BUILD_HOST_PREBUILT)
-
-# prebuilt javatest.jar
-include $(CLEAR_VARS)
-LOCAL_PREBUILT_JAVA_LIBRARIES := javatest:lib/javatest.jar
-include $(BUILD_HOST_PREBUILT)
-
-# prebuilt jh.jar
-include $(CLEAR_VARS)
-LOCAL_PREBUILT_JAVA_LIBRARIES := jh:lib/jh.jar
-include $(BUILD_HOST_PREBUILT)
-
-# prebuilt jtreg.jar
-include $(CLEAR_VARS)
-LOCAL_PREBUILT_JAVA_LIBRARIES := jtreg:lib/jtreg.jar
-include $(BUILD_HOST_PREBUILT)
diff --git a/tools/runner/expectations/brokentests.txt b/tools/runner/expectations/brokentests.txt
deleted file mode 100644
index caf92e7..0000000
--- a/tools/runner/expectations/brokentests.txt
+++ /dev/null
@@ -1,742 +0,0 @@
-# This file contains expectations for tests that we don't ever intend to fix.
-
-# We're retiring the security manager. Unfortunately, tests all over the place
-# need to check that they're secure, so they all fail when we refuse to install
-# a security manager. This suppresses all of these failures.
-# http://b/issue?id=2585285
-failure disable securityManager
-result EXEC_FAILED
-pattern .*java.lang.UnsupportedOperationException\s+at java.lang.System.setSecurityManager.*
-
-
-# The RI avoids blocking calls when '\r' is the last character. We don't
-# bother since that adds complexity to every other read call, and '\r' as the
-# last character will be diminishingly rare anyway.
-test java.io.BufferedReader.ReadLine
-result EXEC_FAILED
-pattern .*java.lang.RuntimeException: Read past limit.*
-
-test java.io.BufferedReader.Ready
-result EXEC_FAILED
-pattern .*Hit infinite wait condition.*
-
-
-# The test is checking that the implementation doesn't read any characters
-# earlier than it absolutely needs to. This is a bogus requirement; streams
-# are allowed to buffer input as necessary.
-test java.io.StreamTokenizer.Reset
-result EXEC_FAILED
-pattern .*Test failed: should get token \[, but get -1.*
-
-
-# These tests only pass if the root logger hasn't yet been initialized. They
-# incorrectly assume that resetting the LogManager will clear the root logger's
-# resource bundle; this isn't the case.
-test org.apache.harmony.logging.tests.java.util.logging.LoggerTest#testGetLoggerWithRes_InvalidResourceBundle
-result EXEC_FAILED
-pattern .*java.lang.IllegalArgumentException: Resource bundle name 'impossible_not_existing' is inconsistent.*
-
-test org.apache.harmony.logging.tests.java.util.logging.LoggerTest#testGetLogger_Empty
-result EXEC_FAILED
-pattern .*junit.framework.AssertionFailedError.*
-
-
-# Dalvik doesn't include the "SunJCE" crypto provider
-test com.sun.crypto.provider.Cipher.AES.Test4513830
-result EXEC_FAILED
-pattern .*NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.AES.Test4512704
-result EXEC_FAILED
-pattern .*NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.AES.Test4512524
-result EXEC_FAILED
-pattern .*NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.AES.Test4511676
-result EXEC_FAILED
-pattern .*NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.AES.Test4517355
-result EXEC_FAILED
-pattern .*NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.AES.TestISO10126Padding
-result EXEC_FAILED
-pattern .* java.security.NoSuchProviderException: SunJCE.*
-
-test com.sun.crypto.provider.Cipher.AES.Test4626070
-result EXEC_FAILED
-pattern .*NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.AES.TestShortBuffer
-result EXEC_FAILED
-pattern .*Provider SunJCE is not available.*
-
-test com.sun.crypto.provider.Cipher.CTS.CTSMode
-result EXEC_FAILED
-pattern .*Provider SunJCE is not available.*
-
-test com.sun.crypto.provider.Cipher.DES.DesAPITest
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.DES.DoFinalReturnLen
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.DES.FlushBug
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.DES.KeyWrapping
-result EXEC_FAILED
-pattern .*Provider SunJCE is not available.*
-
-test com.sun.crypto.provider.Cipher.DES.PaddingTest
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.DES.Sealtest
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.DES.PerformanceTest
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Cipher.PBE.DecryptWithoutParameters
-result EXEC_FAILED
-pattern .*Provider SunJCE is not available.*
-
-test com.sun.crypto.provider.Cipher.PBE.PBEInvalidParamsTest
-result EXEC_FAILED
-pattern .*Provider SunJCE is not available.*
-
-test com.sun.crypto.provider.Cipher.PBE.PBEKeysAlgorithmNames
-result EXEC_FAILED
-pattern .*java.security.NoSuchProviderException: SunJCE.*
-
-test com.sun.crypto.provider.Cipher.PBE.PBEParametersTest
-result EXEC_FAILED
-pattern .*Provider SunJCE is not available.*
-
-test com.sun.crypto.provider.Cipher.PBE.PKCS12Oid
-result EXEC_FAILED
-pattern .*Provider SunJCE is not available.*
-
-test com.sun.crypto.provider.Cipher.UTIL.StrongOrUnlimited
-result EXEC_FAILED
-pattern .*Provider SunJCE is not available.*
-
-test com.sun.crypto.provider.Cipher.KeyWrap.NISTWrapKAT
-result EXEC_FAILED
-pattern .*Provider SunJCE is not available.*
-
-test com.sun.crypto.provider.KeyAgreement.DHGenSecretKey
-result EXEC_FAILED
-pattern .*java.security.NoSuchProviderException: SunJCE.*
-
-test com.sun.crypto.provider.KeyAgreement.DHGenSharedSecret
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.KeyAgreement.DHKeyAgreement3
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.KeyAgreement.DHKeyFactory
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.KeyAgreement.DHKeyGenSpeed
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.KeyAgreement.TestExponentSize
-result EXEC_FAILED
-pattern .*java.security.NoSuchProviderException: SunJCE.*
-
-test com.sun.crypto.provider.KeyFactory.TestProviderLeak
-result EXEC_FAILED
-pattern .*java.security.NoSuchProviderException: SunJCE.*
-
-test com.sun.crypto.provider.KeyFactory.PBKDF2HmacSHA1FactoryTest
-result EXEC_FAILED
-pattern .*java.security.NoSuchProviderException: SunJCE.*
-
-test com.sun.crypto.provider.KeyGenerator.Test4628062
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.KeyGenerator.TestExplicitKeyLength
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Mac.HmacPBESHA1
-result EXEC_FAILED
-pattern .*java.security.NoSuchProviderException: SunJCE.*
-
-test com.sun.crypto.provider.Mac.HmacMD5
-result EXEC_FAILED
-pattern .*java.lang.NoClassDefFoundError: com.sun.crypto.provider.SunJCE.*
-
-test com.sun.crypto.provider.Mac.MacClone
-result EXEC_FAILED
-pattern .*java.security.NoSuchProviderException: SunJCE.*
-
-
-# These NPEs all happen while calling Provider#getName on the result of
-# Security#getProvider(). Unfortunately, that method is permitted to return
-# null if the system has no provider with the requested name. And since we don't
-# have the "SunJCE" provider, tests fail
-test com.sun.crypto.provider.Cipher.PBE.PKCS12Cipher
-result EXEC_FAILED
-pattern .*PKCS12Cipher.java\:87\).*NullPointerException.*
-
-test com.sun.crypto.provider.Cipher.PBE.PKCS12CipherKAT
-result EXEC_FAILED
-pattern .*NullPointerException.*PKCS12CipherKAT.java\:183\).*
-
-test com.sun.crypto.provider.Cipher.RC2ArcFour.CipherKAT
-result EXEC_FAILED
-pattern .*NullPointerException.*CipherKAT.java\:205\).*
-
-test com.sun.crypto.provider.Cipher.RSA.TestOAEP_KAT
-result EXEC_FAILED
-pattern .*TestOAEP_KAT.java\:62\).*NullPointerException.*
-
-test com.sun.crypto.provider.Cipher.RSA.TestOAEP
-result EXEC_FAILED
-pattern .*TestOAEP.java\:50\).*NullPointerException.*
-
-test com.sun.crypto.provider.Cipher.RSA.TestOAEPParameterSpec
-result EXEC_FAILED
-pattern .*TestOAEPParameterSpec.java\:124\).*NullPointerException.*
-
-test com.sun.crypto.provider.Cipher.RSA.TestOAEPWithParams
-result EXEC_FAILED
-pattern .*TestOAEPWithParams.java\:58\).*NullPointerException.*
-
-test com.sun.crypto.provider.Cipher.RSA.TestRSA
-result EXEC_FAILED
-pattern .*TestRSA.java\:171\).*NullPointerException.*
-
-test com.sun.crypto.provider.Mac.HmacSaltLengths
-result EXEC_FAILED
-pattern .*HmacSaltLengths.java\:83\).*java.lang.NullPointerException.*
-
-test com.sun.crypto.provider.Mac.MacKAT
-result EXEC_FAILED
-pattern .*MacKAT.java\:228\).*java.lang.NullPointerException.*
-
-
-# These tests call into misc Sun classes that we don't have
-test com.sun.crypto.provider.KeyAgreement.DHKeyAgreement2
-result COMPILE_FAILED
-pattern .*cannot find symbol.*sun.misc.HexDumpEncoder.*
-
-test com.sun.crypto.provider.Cipher.KeyWrap.XMLEncKAT
-result COMPILE_FAILED
-pattern .*cannot find symbol.*sun.misc.BASE64Decoder.*
-
-test com.sun.crypto.provider.TLS.TestKeyMaterial
-result COMPILE_FAILED
-pattern .*package sun.security.internal.spec does not exist.*
-
-test com.sun.crypto.provider.TLS.TestMasterSecret
-result COMPILE_FAILED
-pattern .*package sun.security.internal.spec does not exist.*
-
-test com.sun.crypto.provider.TLS.TestPremaster
-result COMPILE_FAILED
-pattern .*package sun.security.internal.spec does not exist.*
-
-test com.sun.crypto.provider.TLS.TestPRF
-result COMPILE_FAILED
-pattern .*package sun.security.internal.spec does not exist.*
-
-
-# we don't have com.sun.jdi; none of the corresponding tests will work
-test com.sun.jdi.connect.spi.GeneratedConnectors
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.connect.spi.DebugUsingCustomConnector
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.redefine.RedefineTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.redefineMethod.RedefineTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.sde.MangleStepTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.sde.MangleTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.sde.FilterMangleTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.sde.SourceDebugExtensionTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.sde.TemperatureTableTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.AcceptTimeout
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.AccessSpecifierTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.AfterThreadDeathTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.AllLineLocations
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ArrayRangeTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.BacktraceFieldTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.BadHandshakeTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.BreakpointTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ClassesByName
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ClassesByName2Test
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ClassLoaderClassesTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.CompatibleConnectors
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ConnectedVMs
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ConstantPoolInfo
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.CountEvent
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.CountFilterTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.DebuggerThreadTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.DeleteAllBkptsTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.DeleteEventRequestsTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.DoubleAgentTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.EarlyReturnNegativeTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.EarlyReturnTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.EnumTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.EventQueueDisconnectTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ExceptionEvents
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ExclusiveBind
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ExpiredRequestDeletionTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.FieldWatchpoints
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.FilterMatch
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.FilterNoMatch
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.FinalizerTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.FinalLocalsTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.FramesTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.GenericsTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.GetLocalVariables2Test
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.HomeTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.InstanceFilter
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.InstancesTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.InterruptHangTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.InvokeHangTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.InvokeTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.Java_gTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.LaunchCommandLine
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.LineNumberInfo
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ListenAddress
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.LocalVariableEqual
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.LocationTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.MethodEntryExitEvents
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.MethodExitReturnValuesTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ModificationWatchpoints
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.MonitorEventTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.MonitorFrameInfo
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.MultiBreakpointsTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.NewInstanceTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.NoLaunchOptionTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.NoLocInfoTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.OnThrowTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.OptionTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.PopAndInvokeTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.PopAndStepTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.PopAsynchronousTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.PopSynchronousTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ReferrersTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.RepStep
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.RequestReflectionTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.RunToExit
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.SDENullTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.SourceNameFilterTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.StepTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.SuspendThreadTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.TemplateTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.ThreadGroupTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.TwoThreadsTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.UnpreparedByName
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.UnpreparedClasses
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.UTF8Test
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.VarargsTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.Vars
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.VMDeathLastTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-test com.sun.jdi.VMDeathRequestTest
-result COMPILE_FAILED
-pattern .*package com.sun.jdi does not exist.*
-
-
-# Dalvik doesn't include a com.sun.net HTTP server
-test com.sun.net.httpserver
-result UNSUPPORTED
-
-test sun.net.www
-result UNSUPPORTED
-
-
-# Dalvik doesn't include AWT except the font package
-test java.awt
-result UNSUPPORTED
-
-test java.awt.FontClass
-result SUCCESS
-
-
-# Dalvik doesn't include java.beans except for property listeners
-test java.beans
-result UNSUPPORTED
-
-test java.beans.PropertyChangeSupport
-result SUCCESS
-
-
-# Dalvik doesn't include java.lang.instrument
-test java.lang.instrument
-result UNSUPPORTED
-
-
-# Dalvik doesn't include java.lang.management
-test java.lang.management
-result UNSUPPORTED
-
-
-# Dalvik doesn't include RMI
-test java.rmi
-result UNSUPPORTED
-
-test sun.rmi
-result UNSUPPORTED
-
-
-# Dalvik doesn't include javax.management
-test javax.management
-result UNSUPPORTED
-
-
-# Dalvik doesn't include javax.naming
-test javax.naming
-result UNSUPPORTED
-
-
-# Dalvik doesn't include javax.sound
-test javax.sound
-result UNSUPPORTED
-
-
-# Dalvik doesn't include javax.swing
-test javax.swing
-result UNSUPPORTED
-
-
-# Dalvik doesn't include sun.management
-test sun.management
-result UNSUPPORTED
-
-
-# Dalvik doesn't include javax.smartcardio
-test sun.security.smartcardio
-result UNSUPPORTED
-
-
-# Our exception messages don't match the RIs
-test java.lang.StringBuilder.Exceptions
-result EXEC_FAILED
-pattern .*got java\.lang\.StringIndexOutOfBoundsException: null - FAILED.*
-
-test java.lang.StringBuffer.Exceptions
-result EXEC_FAILED
-pattern .*got java\.lang\.StringIndexOutOfBoundsException: null - FAILED.*
-
-
-# this test is invalid, proxy.equals isn't symmetric
-test org.apache.harmony.luni.tests.java.util.HashMapTest#test_proxies
-result EXEC_FAILED
-
-
-# this test is invalid, the mock map's entry set isn't to spec
-test org.apache.harmony.luni.tests.java.util.HashMapTest.test_putAllLjava_util_Map
-result EXEC_FAILED
-
-
-# We don't have AWT
-test java.io.File.isDirectory.Applet
-result COMPILE_FAILED
-pattern .*package java.applet does not exist.*
-
-# ICU doesn't like 3-letter names like CST because they're ambiguous.
-# Harmony prefers them because they're more human readable. We'll be
-# consistent with ICU, since that seems least fragile.
-# See https://issues.apache.org/jira/browse/HARMONY-5468
-# and http://bugs.icu-project.org/trac/ticket/6174
-test org.apache.harmony.luni.tests.java.util.DateTest#test_toString
-result EXEC_FAILED
-pattern .*GMT-07:00.*
-
-
-# These harmony tests are broken. The RI doesn't ship with es__TRADITIONAL, so
-# they have incorrect expectations.
-# http://b/2608750
-
-test org.apache.harmony.text.tests.java.text.RuleBasedCollatorTest#testGetCollationElementIteratorCharacterIterator
-result EXEC_FAILED
-pattern .*expected:<1> but was:<2>.*
-
-test org.apache.harmony.text.tests.java.text.RuleBasedCollatorTest#testGetCollationElementIteratorString
-result EXEC_FAILED
-pattern .*expected:<1> but was:<2>.*
-
-# This test fails because on Android, RuleBasedCollators default to
-# CANONICAL_DECOMPOSITION, not NO_DECOMPOSITION.
-test org.apache.harmony.text.tests.java.text.RuleBasedCollatorTest#testEqualsObject
-result EXEC_FAILED
-pattern .*expected:<0> but was:<1>.*
diff --git a/tools/runner/expectations/todo.txt b/tools/runner/expectations/todo.txt
deleted file mode 100644
index f3341a7..0000000
--- a/tools/runner/expectations/todo.txt
+++ /dev/null
@@ -1,99 +0,0 @@
-# This file contains expectations for tests that we'd like to eventually fix.
-# Severe problems should be accompanied by a tracking bug.
-
-# Dalvik doesn't support XML Schemas, DTDs or validation
-# http://code.google.com/p/android/issues/detail?id=7395
-test tests.xml.DomTest#testEntityDeclarations
-result EXEC_FAILED
-pattern .*This implementation does not parse entity declarations.*
-
-test tests.xml.DomTest#testGetWholeTextWithEntityReference
-result EXEC_FAILED
-pattern .*This implementation doesn't resolve entity references in getWholeText.*
-
-test tests.xml.DomTest#testIsElementContentWhitespaceWithDeclaration
-result EXEC_FAILED
-pattern .*This implementation does not recognize element content whitespace.*
-
-test tests.xml.DomTest#testNotations
-result EXEC_FAILED
-pattern .*This implementation does not parse notations.*
-
-test tests.xml.DeclarationTest#testGetXmlEncoding
-result EXEC_FAILED
-pattern .*This implementation doesn't parse the encoding from the XML declaration expected:<ISO-8859-1> but was:<null>.*
-
-test tests.xml.DeclarationTest#testGetXmlStandalone
-pattern .*This implementation doesn't parse standalone from the XML declaration expected:<true> but was:<false>.*
-result EXEC_FAILED
-
-test tests.xml.DeclarationTest#testGetXmlVersion
-pattern .*This implementation doesn't parse the version from the XML declaration expected:<...1> but was:<...0>.*
-result EXEC_FAILED
-
-test tests.xml.NormalizeTest#testSchemaTypeDtd
-result EXEC_FAILED
-pattern .*This implementation's setParameter\(\) supports an unexpected value: schema-type=http://www.w3.org/TR/REC-xml.*
-
-test tests.api.javax.xml.parsers.DocumentBuilderTest#testSetEntityResolver
-result EXEC_FAILED
-pattern .*java.lang.ClassCastException: org.apache.harmony.xml.dom.EntityReferenceImpl.*
-
-
-# low-impact XML bugs:
-test tests.xml.DomTest#testAttributeNamedIdIsNotAnIdByDefault
-result EXEC_FAILED
-pattern .*This implementation incorrectly interprets the "id" attribute as an identifier by default.*
-
-test tests.xml.DomTest#testDocumentAddChild
-result EXEC_FAILED
-pattern .*Document nodes shouldn't accept child nodes.*
-
-test tests.xml.DomTest#testElementTraversalFeature
-result EXEC_FAILED
-pattern .*This implementation is expected to support ElementTraversal v. 1.0 but does not..*
-
-test tests.xml.DomTest#testLoadSaveFeature
-result EXEC_FAILED
-pattern .*This implementation is expected to support LS v. 3.0 but does not..*
-
-test tests.xml.SaxTest#testYesPrefixesYesNamespaces
-result EXEC_FAILED
-pattern .*The 'namespace-prefix' feature is not supported while the 'namespaces' feature is enabled..*
-
-test tests.api.javax.xml.parsers.SAXParserFactoryTest#test_newInstance
-result EXEC_FAILED
-pattern .*Expected FactoryConfigurationError was not thrown.*
-
-test tests.api.javax.xml.parsers.DocumentBuilderFactoryTest#test_isSetXIncludeAware
-result EXEC_FAILED
-pattern .*java.lang.UnsupportedOperationException: This parser does not support specification "Unknown" version "0.0".*
-
-test tests.api.javax.xml.parsers.DocumentBuilderTest#testIsXIncludeAware
-result EXEC_FAILED
-pattern .*java.lang.UnsupportedOperationException: This parser does not support specification "Unknown" version "0.0".*
-
-test tests.api.javax.xml.parsers.SAXParserFactoryTest#test_setIsXIncludeAware
-result EXEC_FAILED
-pattern .*java.lang.UnsupportedOperationException: This parser does not support specification "Unknown" version "0.0".*
-
-test tests.api.javax.xml.parsers.SAXParserTest#testIsXIncludeAware
-result EXEC_FAILED
-pattern .*java.lang.UnsupportedOperationException: This parser does not support specification "Unknown" version "0.0".*
-
-# a low-impact bug: "Shared FileDescriptors get closed too early"
-# http://code.google.com/p/android/issues/detail?id=5923
-test java.io.FileDescriptor.Finalize
-result EXEC_FAILED
-pattern .*java.io.IOException.*openCheck.*
-
-
-# a low-impact bug, also present in Crockford's implementation of org.json
-test org.json.ParsingTest#test64BitHexValues
-result EXEC_FAILED
-pattern .*Large hex longs shouldn't be yield ints or strings expected:<-1> but was:<0xFFFFFFFFFFFFFFFF>.*
-
-
-# this test needs to be fixed. We supply optional qnames, but this test doesn't expect them
-test tests.api.javax.xml.parsers.SAXParserTest#test_parseLjava_io_InputStreamLorg_xml_sax_helpers_DefaultHandlerLjava_lang_String
-result EXEC_FAILED
diff --git a/tools/runner/java/vogar/Action.java b/tools/runner/java/vogar/Action.java
deleted file mode 100644
index 5a562c7..0000000
--- a/tools/runner/java/vogar/Action.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-
-/**
- * A named job such as a test or benchmark run. This class tracks the resource
- * files and classes for compiling and running a Java source file.
- */
-public final class Action {
-
- private final String name;
- private final String actionClass;
- private final File resourcesDirectory;
- private final File javaFile;
- private final RunnerSpec runnerSpec;
- private File userDir = new File(System.getProperty("user.dir"));
-
- public Action(String name, String actionClass, File resourcesDirectory,
- File javaFile, RunnerSpec runnerSpec) {
- this.name = name;
- this.actionClass = actionClass;
- this.resourcesDirectory = resourcesDirectory;
- this.javaFile = javaFile;
- this.runnerSpec = runnerSpec;
- }
-
- /**
- * Returns the local directory containing this action's required resource
- * files, or {@code null} if this action is standalone.
- */
- public File getResourcesDirectory() {
- return resourcesDirectory;
- }
-
- /**
- * Returns this action's java file, or {@code null} if this file wasn't
- * built from source.
- */
- public File getJavaFile() {
- return javaFile;
- }
-
- /**
- * Returns the executable classname, such as java.lang.IntegerTest
- * or BitTwiddle.
- */
- public String getTargetClass() {
- return actionClass;
- }
-
- /**
- * Returns a unique identifier for this action.
- */
- public String getName() {
- return name;
- }
-
- public RunnerSpec getRunnerSpec() {
- return runnerSpec;
- }
-
- /**
- * Initializes the directory from which local files can be read by the
- * action.
- */
- public void setUserDir(File base) {
- this.userDir = base;
- }
-
- public File getUserDir() {
- return userDir;
- }
-
- @Override public String toString() {
- return name;
- }
-}
diff --git a/tools/runner/java/vogar/ActivityMode.java b/tools/runner/java/vogar/ActivityMode.java
deleted file mode 100644
index da49c89..0000000
--- a/tools/runner/java/vogar/ActivityMode.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.logging.Logger;
-import vogar.commands.Aapt;
-import vogar.commands.Command;
-import vogar.commands.Dx;
-import vogar.commands.Rm;
-
-/**
- * Runs an action in the context of an android.app.Activity on a device
- */
-final class ActivityMode extends Mode {
-
- private static final Logger logger = Logger.getLogger(ActivityMode.class.getName());
-
- private static final String TEST_ACTIVITY_CLASS = "vogar.target.TestActivity";
-
- ActivityMode(Integer debugPort, File sdkJar, List<String> javacArgs,
- int monitorPort, File localTemp, boolean cleanBefore, boolean cleanAfter,
- File deviceRunnerDir, Classpath classpath) {
- super(new EnvironmentDevice(cleanBefore, cleanAfter,
- debugPort, monitorPort, localTemp, deviceRunnerDir),
- sdkJar, javacArgs, monitorPort, classpath);
- }
-
- private EnvironmentDevice getEnvironmentDevice() {
- return (EnvironmentDevice) environment;
- }
-
- @Override protected void prepare(Set<RunnerSpec> runners) {
- runnerJava.add(new File("dalvik/libcore/tools/runner/lib/TestActivity.java"));
- super.prepare(runners);
- }
-
- @Override protected void postCompile(Action action, File jar) {
- logger.fine("aapt and push " + action.getName());
-
- // We can't put multiple dex files in one apk.
- // We can't just give dex multiple jars with conflicting class names
-
- // With that in mind, the APK packaging strategy is as follows:
- // 1. dx to create a dex
- // 2. aapt the dex to create apk
- // 3. sign the apk
- // 4. install the apk
- File dex = createDex(action, jar);
- File apkUnsigned = createApk(action, dex);
- File apkSigned = signApk(action, apkUnsigned);
- installApk(action, apkSigned);
- }
-
- /**
- * Returns a single dexfile containing {@code action}'s classes and all
- * dependencies.
- */
- private File createDex(Action action, File actionJar) {
- File dex = environment.file(action, "classes.dex");
- Classpath classesToDex = Classpath.of(actionJar);
- classesToDex.addAll(this.classpath);
- new Dx().dex(dex, classesToDex);
- return dex;
- }
-
- /**
- * According to android.content.pm.PackageParser, package name
- * "must have at least one '.' separator" Since the qualified name
- * may not contain a dot, we prefix containing one to ensure we
- * are compliant.
- */
- private static String packageName(Action action) {
- return "vogar.test." + action.getName();
- }
-
- private File createApk (Action action, File dex) {
- String androidManifest =
- "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
- "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" +
- " package=\"" + packageName(action) + "\">\n" +
- " <uses-permission android:name=\"android.permission.INTERNET\" />\n" +
- " <application>\n" +
- " <activity android:name=\"" + TEST_ACTIVITY_CLASS + "\">\n" +
- " <intent-filter>\n" +
- " <action android:name=\"android.intent.action.MAIN\" />\n" +
- " <category android:name=\"android.intent.category.LAUNCHER\" />\n" +
- " </intent-filter>\n" +
- " </activity>\n" +
- " </application>\n" +
- "</manifest>\n";
- File androidManifestFile = environment.file(action, "classes", "AndroidManifest.xml");
- try {
- FileOutputStream androidManifestOut =
- new FileOutputStream(androidManifestFile);
- androidManifestOut.write(androidManifest.getBytes("UTF-8"));
- androidManifestOut.close();
- } catch (IOException e) {
- throw new RuntimeException("Problem writing " + androidManifestFile, e);
- }
-
- File apkUnsigned = environment.file(action, action + ".apk.unsigned");
- new Aapt().apk(apkUnsigned, androidManifestFile);
- new Aapt().add(apkUnsigned, dex);
- new Aapt().add(apkUnsigned, environment.file(action, "classes", TestProperties.FILE));
- return apkUnsigned;
- }
-
- private File signApk(Action action, File apkUnsigned) {
- File apkSigned = environment.file(action, action + ".apk");
- // TODO: we should be able to work with a shipping SDK, not depend on out/...
- // TODO: we should be able to work without hardwired keys, not depend on build/...
- new Command.Builder()
- .args("java")
- .args("-jar")
- .args("out/host/linux-x86/framework/signapk.jar")
- .args("build/target/product/security/testkey.x509.pem")
- .args("build/target/product/security/testkey.pk8")
- .args(apkUnsigned)
- .args(apkSigned).execute();
- new Rm().file(apkUnsigned);
- return apkSigned;
- }
-
- private void installApk(Action action, File apkSigned) {
- // install the local apk ona the device
- getEnvironmentDevice().adb.uninstall(packageName(action));
- getEnvironmentDevice().adb.install(apkSigned);
- }
-
- @Override protected void fillInProperties(Properties properties, Action action) {
- super.fillInProperties(properties, action);
- properties.setProperty(TestProperties.DEVICE_RUNNER_DIR, getEnvironmentDevice().runnerDir.getPath());
- }
-
- @Override protected Command createActionCommand(Action action) {
- return new Command(
- "adb", "shell", "am", "start", "-W",
- "-a", "android.intent.action.MAIN",
- "-n", (packageName(action) + "/" + TEST_ACTIVITY_CLASS));
- }
-
- @Override void cleanup(Action action) {
- super.cleanup(action);
- if (environment.cleanAfter) {
- getEnvironmentDevice().adb.uninstall(action.getName());
- }
- }
-}
diff --git a/tools/runner/java/vogar/CaliperSpec.java b/tools/runner/java/vogar/CaliperSpec.java
deleted file mode 100644
index f0c0e39..0000000
--- a/tools/runner/java/vogar/CaliperSpec.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import vogar.target.CaliperRunner;
-import vogar.target.Runner;
-
-/**
- * Create {@link Action}s for {@code .java} files with Caliper benchmarks in
- * them.
- */
-class CaliperSpec extends NamingPatternRunnerSpec {
-
- @Override protected boolean matches(File file) {
- return super.matches(file) && file.getName().endsWith("Benchmark.java");
- }
-
- public boolean supports(String className) {
- return className.endsWith("Benchmark");
- }
-
- public Class<? extends Runner> getRunnerClass() {
- return CaliperRunner.class;
- }
-
- public File getSource() {
- return new File(Vogar.HOME_JAVA, "vogar/target/CaliperRunner.java");
- }
-
- public Classpath getClasspath() {
- return Classpath.of(
- new File("dalvik/libcore/tools/runner/lib/jsr305.jar"),
- new File("dalvik/libcore/tools/runner/lib/guava.jar"),
- new File("dalvik/libcore/tools/runner/lib/caliper.jar"));
- }
-}
diff --git a/tools/runner/java/vogar/Classpath.java b/tools/runner/java/vogar/Classpath.java
deleted file mode 100644
index cd83409..0000000
--- a/tools/runner/java/vogar/Classpath.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * A list of jar files and directories.
- */
-public final class Classpath {
-
- private final List<File> elements = new ArrayList<File>();
-
- public static Classpath of(File... files) {
- return of(Arrays.asList(files));
- }
-
- public static Classpath of(Collection<File> files) {
- Classpath result = new Classpath();
- result.elements.addAll(files);
- return result;
- }
-
- public void addAll(File... elements) {
- addAll(Arrays.asList(elements));
- }
-
- public void addAll(Collection<File> elements) {
- this.elements.addAll(elements);
- }
-
- public void addAll(Classpath anotherClasspath) {
- this.elements.addAll(anotherClasspath.elements);
- }
-
- public Collection<File> getElements() {
- return elements;
- }
-
- @Override public String toString() {
- return Strings.join(elements, ":");
- }
-}
diff --git a/tools/runner/java/vogar/Console.java b/tools/runner/java/vogar/Console.java
deleted file mode 100644
index 54c8f51..0000000
--- a/tools/runner/java/vogar/Console.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.List;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Formatter;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-
-/**
- * Controls, formats and emits output to the command line. Command line output
- * can be generated both by java.util.logging and by direct calls to this class.
- */
-public class Console {
-
- private final boolean stream;
- private final boolean color;
- private final String indent;
-
- private String currentName;
- private CurrentLine currentLine = CurrentLine.NEW;
- private final StringBuilder bufferedOutput = new StringBuilder();
-
- public Console(boolean stream, String indent, boolean color) {
- this.stream = stream;
- this.indent = indent;
- this.color = color;
- }
-
- public void configureJavaLogging(boolean verbose) {
- ConsoleHandler handler = new ConsoleHandler();
- handler.setLevel(Level.ALL);
- handler.setFormatter(new Formatter() {
- @Override public String format(LogRecord r) {
- return logRecordToString(r);
- }
- });
-
- Logger logger = Logger.getLogger("vogar");
- logger.setLevel(verbose ? Level.FINE : Level.INFO);
- logger.addHandler(handler);
- logger.setUseParentHandlers(false);
- }
-
- /**
- * Formats a sequence of regular log messages with the output streamed from
- * a foreign process.
- */
- private String logRecordToString(LogRecord logRecord) {
- String message = logRecord.getMessage();
-
- if (logRecord.getThrown() != null) {
- StringWriter writer = new StringWriter();
- writer.write(message);
- writer.write("\n");
- logRecord.getThrown().printStackTrace(new PrintWriter(writer));
- message = writer.toString();
- }
-
- newLine();
- return message + "\n";
- }
-
- public void action(String name) {
- newLine();
- System.out.print("Action " + name);
- currentName = name;
- currentLine = CurrentLine.NAME;
- }
-
- /**
- * Prints the beginning of the named outcome.
- */
- public void outcome(String name) {
- // if the outcome and action names are the same, omit the outcome name
- if (name.equals(currentName)) {
- return;
- }
-
- currentName = name;
- newLine();
- System.out.print(indent + name);
- currentLine = CurrentLine.NAME;
- }
-
- /**
- * Appends the action output immediately to the stream when streaming is on,
- * or to a buffer when streaming is off. Buffered output will be held and
- * printed only if the outcome is unsuccessful.
- */
- public void streamOutput(String output) {
- if (stream) {
- printOutput(output);
- } else {
- bufferedOutput.append(output);
- }
- }
-
- /**
- * Writes the action's outcome.
- */
- public void printResult(Result result, boolean ok) {
- if (ok) {
- String prefix = (currentLine == CurrentLine.NAME) ? " " : "\n" + indent;
- System.out.println(prefix + green("OK (" + result + ")"));
-
- } else {
- if (bufferedOutput.length() > 0) {
- printOutput(bufferedOutput.toString());
- bufferedOutput.delete(0, bufferedOutput.length());
- }
-
- newLine();
- System.out.println(indent + red("FAIL (" + result + ")"));
- }
-
- currentName = null;
- currentLine = CurrentLine.NEW;
- }
-
- public void summarizeFailures(List<String> failureNames) {
- System.out.println("Failure summary:");
- for (String failureName : failureNames) {
- System.out.println(red(failureName));
- }
- }
-
- /**
- * Prints the action output with appropriate indentation.
- */
- private void printOutput(String streamedOutput) {
- String[] lines = messageToLines(streamedOutput);
-
- if (currentLine != CurrentLine.STREAMED_OUTPUT) {
- newLine();
- System.out.print(indent);
- System.out.print(indent);
- }
- System.out.print(lines[0]);
- currentLine = CurrentLine.STREAMED_OUTPUT;
-
- for (int i = 1; i < lines.length; i++) {
- newLine();
-
- if (lines[i].length() > 0) {
- System.out.print(indent);
- System.out.print(indent);
- System.out.print(lines[i]);
- currentLine = CurrentLine.STREAMED_OUTPUT;
- }
- }
- }
-
- /**
- * Inserts a linebreak if necessary.
- */
- private void newLine() {
- if (currentLine == CurrentLine.NEW) {
- return;
- }
-
- System.out.println();
- currentLine = CurrentLine.NEW;
- }
-
- /**
- * Status of a currently-in-progress line of output.
- */
- enum CurrentLine {
-
- /**
- * The line is blank.
- */
- NEW,
-
- /**
- * The line contains streamed application output. Additional streamed
- * output may be appended without additional line separators or
- * indentation.
- */
- STREAMED_OUTPUT,
-
- /**
- * The line contains the name of an action or outcome. The outcome's
- * result (such as "OK") can be appended without additional line
- * separators or indentation.
- */
- NAME,
- }
-
- /**
- * Returns an array containing the lines of the given text.
- */
- private String[] messageToLines(String message) {
- // pass Integer.MAX_VALUE so split doesn't trim trailing empty strings.
- return message.split("\r\n|\r|\n", Integer.MAX_VALUE);
- }
-
- private String green(String message) {
- return color ? ("\u001b[32;1m" + message + "\u001b[0m") : message;
- }
-
- private String red(String message) {
- return color ? ("\u001b[31;1m" + message + "\u001b[0m") : message;
- }
-}
diff --git a/tools/runner/java/vogar/DeviceDalvikVm.java b/tools/runner/java/vogar/DeviceDalvikVm.java
deleted file mode 100644
index dfbfada..0000000
--- a/tools/runner/java/vogar/DeviceDalvikVm.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Logger;
-import vogar.commands.Dx;
-
-/**
- * Execute actions on a Dalvik VM using an Android device or emulator.
- */
-final class DeviceDalvikVm extends Vm {
- private static final Logger logger = Logger.getLogger(DeviceDalvikVm.class.getName());
-
- /** A list of generic names that we avoid when naming generated files. */
- private static final Set<String> BANNED_NAMES = new HashSet<String>();
- static {
- BANNED_NAMES.add("classes");
- BANNED_NAMES.add("javalib");
- }
-
- DeviceDalvikVm(Integer debugPort, File sdkJar, List<String> javacArgs,
- int monitorPort, File localTemp, List<String> additionalVmArgs,
- List<String> targetArgs, boolean cleanBefore, boolean cleanAfter,
- File runnerDir, Classpath classpath) {
- super(new EnvironmentDevice(cleanBefore, cleanAfter, debugPort, monitorPort, localTemp,
- runnerDir), sdkJar, javacArgs, additionalVmArgs, targetArgs, monitorPort, classpath);
- }
-
- private EnvironmentDevice getEnvironmentDevice() {
- return (EnvironmentDevice) environment;
- }
-
- @Override protected void installRunner() {
- // dex everything on the classpath and push it to the device.
- for (File classpathElement : classpath.getElements()) {
- dexAndPush(basenameOfJar(classpathElement), classpathElement);
- }
- }
-
- private String basenameOfJar(File file) {
- String name = file.getName().replaceAll("\\.jar$", "");
- while (BANNED_NAMES.contains(name)) {
- file = file.getParentFile();
- name = file.getName();
- }
- return name;
- }
-
- @Override protected void postCompile(Action action, File jar) {
- dexAndPush(action.getName(), jar);
- }
-
- private void dexAndPush(String name, File jar) {
- logger.fine("dex and push " + name);
-
- // make the local dex (inside a jar)
- File localDex = environment.file(name, name + ".dx.jar");
- new Dx().dex(localDex, Classpath.of(jar));
-
- // post the local dex to the device
- getEnvironmentDevice().adb.push(localDex, deviceDexFile(name));
- }
-
- private File deviceDexFile(String name) {
- return new File(getEnvironmentDevice().runnerDir, name + ".jar");
- }
-
- @Override protected VmCommandBuilder newVmCommandBuilder(
- File workingDirectory) {
- // ignore the working directory; it's device-local and we can't easily
- // set the working directory for commands run via adb shell.
- // TODO: we only *need* to set ANDROID_DATA on production devices.
- // We set "user.home" to /sdcard because code might reasonably assume it can write to
- // that directory.
- return new VmCommandBuilder()
- .vmCommand("adb", "shell", "ANDROID_DATA=/sdcard", "dalvikvm")
- .vmArgs("-Duser.home=/sdcard")
- .vmArgs("-Duser.name=root")
- .vmArgs("-Duser.language=en")
- .vmArgs("-Duser.region=US")
- .vmArgs("-Djavax.net.ssl.trustStore=/system/etc/security/cacerts.bks")
- .temp(getEnvironmentDevice().vogarTemp);
- }
-
- @Override protected Classpath getRuntimeClasspath(Action action) {
- Classpath result = new Classpath();
- result.addAll(deviceDexFile(action.getName()));
- for (File classpathElement : classpath.getElements()) {
- result.addAll(deviceDexFile(basenameOfJar(classpathElement)));
- }
- return result;
- }
-}
diff --git a/tools/runner/java/vogar/Driver.java b/tools/runner/java/vogar/Driver.java
deleted file mode 100644
index aaf0cf6..0000000
--- a/tools/runner/java/vogar/Driver.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.logging.Logger;
-import vogar.commands.Command;
-import vogar.commands.CommandFailedException;
-import vogar.commands.Mkdir;
-
-/**
- * Compiles, installs, runs and reports on actions.
- */
-final class Driver implements HostMonitor.Handler {
-
- private static final Logger logger = Logger.getLogger(Driver.class.getName());
-
- private final File localTemp;
- private final ExpectationStore expectationStore;
- private final List<RunnerSpec> runnerSpecs;
- private final Mode mode;
- private final XmlReportPrinter reportPrinter;
- private final Console console;
- private final int monitorPort;
- private final HostMonitor monitor;
- private final long timeoutSeconds;
- private int successes = 0;
- private int failures = 0;
- private List<String> failureNames = new ArrayList<String>();
-
- private Timer actionTimeoutTimer = new Timer("action timeout", true);
-
- private final Set<RunnerSpec> runnerSpecsBearingActions = new HashSet<RunnerSpec>();
- private final Map<String, Action> actions = Collections.synchronizedMap(
- new LinkedHashMap<String, Action>());
- private final Map<String, Outcome> outcomes = Collections.synchronizedMap(
- new LinkedHashMap<String, Outcome>());
-
- /**
- * The number of tests that weren't run because they aren't supported by
- * this runner.
- */
- private int unsupportedActions = 0;
-
- public Driver(File localTemp, Mode mode, ExpectationStore expectationStore,
- List<RunnerSpec> runnerSpecs, XmlReportPrinter reportPrinter,
- Console console, HostMonitor monitor, int monitorPort, long timeoutSeconds) {
- this.localTemp = localTemp;
- this.expectationStore = expectationStore;
- this.mode = mode;
- this.console = console;
- this.runnerSpecs = runnerSpecs;
- this.reportPrinter = reportPrinter;
- this.monitor = monitor;
- this.monitorPort = monitorPort;
- this.timeoutSeconds = timeoutSeconds;
- }
-
- /**
- * Builds and executes the actions in the given files.
- */
- public void buildAndRun(Collection<File> files, Collection<String> classes) {
- if (!actions.isEmpty()) {
- throw new IllegalStateException("Drivers are not reusable");
- }
-
- new Mkdir().mkdirs(localTemp);
-
- filesToActions(files);
- classesToActions(classes);
-
- if (actions.isEmpty()) {
- logger.info("Nothing to do.");
- return;
- }
-
- logger.info("Actions: " + actions.size());
-
- // mode.prepare before mode.buildAndInstall to ensure the runner is
- // built. packaging of activity APK files needs the runner along with
- // the action-specific files.
- mode.prepare(runnerSpecsBearingActions);
-
- // build and install actions in a background thread. Using lots of
- // threads helps for packages that contain many unsupported actions
- final BlockingQueue<Action> readyToRun = new ArrayBlockingQueue<Action>(4);
-
- ExecutorService builders = Threads.threadPerCpuExecutor();
- int t = 0;
-
- for (final Action action : actions.values()) {
- final String name = action.getName();
- final int runIndex = t++;
- builders.submit(new Runnable() {
- public void run() {
- try {
- logger.fine("installing action " + runIndex + "; "
- + readyToRun.size() + " are runnable");
-
- if (expectationStore.get(name).getResult() == Result.UNSUPPORTED) {
- outcomes.put(name, new Outcome(name, Result.UNSUPPORTED,
- "Unsupported according to expectations file"));
-
- } else {
- Outcome outcome = mode.buildAndInstall(action);
- if (outcome != null) {
- outcomes.put(name, outcome);
- }
- }
-
- readyToRun.put(action);
- } catch (InterruptedException e) {
- outcomes.put(name, new Outcome(name, Result.ERROR, e));
- }
- }
- });
- }
- builders.shutdown();
-
- for (int i = 0; i < actions.size(); i++) {
- logger.fine("executing action " + i + "; "
- + readyToRun.size() + " are ready to run");
-
- // if it takes 5 minutes for build and install, something is broken
- Action action;
- try {
- action = readyToRun.poll(5 * 60, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- throw new RuntimeException("Unexpected interruption waiting for build and install", e);
- }
-
- if (action == null) {
- outcome(new Outcome("vogar.Vogar", Result.ERROR,
- "Expected " + actions.size() + " actions but found only " + i));
- break;
- }
-
- execute(action);
- mode.cleanup(action);
- }
-
- if (reportPrinter != null) {
- logger.info("Printing XML Reports... ");
- int numFiles = reportPrinter.generateReports(outcomes.values());
- logger.info(numFiles + " XML files written.");
- }
-
- mode.shutdown();
-
- if (failures > 0 || unsupportedActions > 0) {
- Collections.sort(failureNames);
- console.summarizeFailures(failureNames);
- logger.info(String.format("Outcomes: %s. Passed: %d, Failed: %d, Skipped: %d",
- (successes + failures), successes, failures, unsupportedActions));
- } else {
- logger.info(String.format("Outcomes: %s. All successful.",
- (successes + failures)));
- }
- }
-
- private void classesToActions(Collection<String> classes) {
- for (String clazz : classes) {
- for (RunnerSpec runnerSpec : runnerSpecs) {
- if (runnerSpec.supports(clazz)) {
- runnerSpecsBearingActions.add(runnerSpec);
- Action action = new Action(clazz, clazz, null, null, runnerSpec);
- actions.put(action.getName(), action);
- break;
- }
- }
- }
- }
-
- private void filesToActions(Collection<File> files) {
- for (File file : files) {
- Set<Action> actionsForFile = Collections.emptySet();
-
- for (RunnerSpec runnerSpec : runnerSpecs) {
- actionsForFile = runnerSpec.findActions(file);
-
- // break as soon as we find any match. We don't need multiple
- // matches for the same file, since that would run it twice.
- if (!actionsForFile.isEmpty()) {
- runnerSpecsBearingActions.add(runnerSpec);
- break;
- }
- }
-
- for (Action action : actionsForFile) {
- actions.put(action.getName(), action);
- }
- }
- }
-
- /**
- * Executes a single action and then prints the result.
- */
- private void execute(final Action action) {
- console.action(action.getName());
-
- Outcome earlyFailure = outcomes.get(action.getName());
- if (earlyFailure == null) {
- final Command command = mode.createActionCommand(action);
- Future<List<String>> consoleOut = command.executeLater();
- final AtomicReference<Result> result = new AtomicReference<Result>();
-
- actionTimeoutTimer.schedule(new TimerTask() {
- @Override public void run() {
- if (result.compareAndSet(null, Result.EXEC_TIMEOUT)) {
- logger.fine("killing " + action.getName() + " because it "
- + "timed out after " + timeoutSeconds + " seconds");
- command.destroy();
- }
- }
- }, timeoutSeconds * 1000);
-
- boolean completedNormally = monitor.monitor(monitorPort, this);
- if (completedNormally) {
- if (result.compareAndSet(null, Result.SUCCESS)) {
- command.destroy();
- }
- return; // outcomes will have been reported via outcome()
- }
-
- if (result.compareAndSet(null, Result.ERROR)) {
- command.destroy();
- }
- try {
- earlyFailure = new Outcome(action.getName(), action.getName(),
- result.get(), consoleOut.get());
- } catch (Exception e) {
- if (e.getCause() instanceof CommandFailedException) {
- earlyFailure = new Outcome(action.getName(), action.getName(), result.get(),
- ((CommandFailedException) e.getCause()).getOutputLines());
- } else {
- earlyFailure = new Outcome(action.getName(), result.get(), e);
- }
- }
- }
-
- if (earlyFailure.getResult() == Result.UNSUPPORTED) {
- logger.fine("skipping " + action.getName());
- unsupportedActions++;
- } else {
- for (String line : earlyFailure.getOutputLines()) {
- console.streamOutput(line + "\n");
- }
- outcome(earlyFailure);
- }
- }
-
- public void outcome(Outcome outcome) {
- outcomes.put(outcome.getName(), outcome);
- Expectation expectation = expectationStore.get(outcome);
- boolean ok = expectation.matches(outcome);
- if (ok) {
- successes++;
- } else {
- failures++;
- failureNames.add(outcome.getName());
- }
- console.outcome(outcome.getName());
- console.printResult(outcome.getResult(), ok);
- }
-
- public void output(String outcomeName, String output) {
- console.outcome(outcomeName);
- console.streamOutput(output);
- }
-}
diff --git a/tools/runner/java/vogar/Environment.java b/tools/runner/java/vogar/Environment.java
deleted file mode 100644
index fc5c3ea..0000000
--- a/tools/runner/java/vogar/Environment.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.util.logging.Logger;
-import vogar.commands.Rm;
-
-/**
- * A target runtime environment such as a remote device or the local host
- */
-abstract class Environment {
- private static final Logger logger = Logger.getLogger(Environment.class.getName());
-
- final boolean cleanBefore;
- final boolean cleanAfter;
- final Integer debugPort;
- private final File localTemp;
-
- Environment (boolean cleanBefore, boolean cleanAfter, Integer debugPort, File localTemp) {
- this.cleanBefore = cleanBefore;
- this.cleanAfter = cleanAfter;
- this.debugPort = debugPort;
- this.localTemp = localTemp;
- }
-
- /**
- * Initializes the temporary directories and harness necessary to run
- * actions.
- */
- abstract void prepare();
-
- /**
- * Prepares the directory from which the action will be executed. Some
- * actions expect to read data files from the current working directory;
- * this step should ensure such files are available.
- */
- abstract void prepareUserDir(Action action);
-
- /**
- * Deletes files and releases any resources required for the execution of
- * the given action.
- */
- void cleanup(Action action) {
- if (cleanAfter) {
- logger.fine("clean " + action.getName());
- new Rm().directoryTree(file(action));
- }
- }
-
- final File file(Object... path) {
- return new File(localTemp + "/" + Strings.join(path, "/"));
- }
-
- final File hostJar(Object nameOrAction) {
- return file(nameOrAction, nameOrAction + ".jar");
- }
-
- final File actionUserDir(Action action) {
- File testTemp = new File(localTemp, "userDir");
- return new File(testTemp, action.getName());
- }
-
- void shutdown() {
- if (cleanAfter) {
- new Rm().directoryTree(localTemp);
- }
- }
-}
diff --git a/tools/runner/java/vogar/EnvironmentDevice.java b/tools/runner/java/vogar/EnvironmentDevice.java
deleted file mode 100644
index eddde8d..0000000
--- a/tools/runner/java/vogar/EnvironmentDevice.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import vogar.commands.Adb;
-
-class EnvironmentDevice extends Environment {
- final Adb adb = new Adb();
- final File runnerDir;
- final File vogarTemp;
- final int monitorPort;
-
- EnvironmentDevice (boolean cleanBefore, boolean cleanAfter,
- Integer debugPort, int monitorPort, File localTemp, File runnerDir) {
- super(cleanBefore, cleanAfter, debugPort, localTemp);
- this.runnerDir = runnerDir;
- this.vogarTemp = new File(runnerDir, "/vogar.tmp");
- this.monitorPort = monitorPort;
- }
-
- @Override void prepare() {
- adb.waitForDevice();
- adb.waitForNonEmptyDirectory(runnerDir.getParentFile(), 5 * 60);
- if (cleanBefore) {
- adb.rm(runnerDir);
- }
- adb.mkdir(runnerDir);
- adb.mkdir(vogarTemp);
- adb.mkdir(new File("/sdcard/dalvik-cache")); // TODO: only necessary on production devices.
- adb.forwardTcp(monitorPort, monitorPort);
- if (debugPort != null) {
- adb.forwardTcp(debugPort, debugPort);
- }
- }
-
- @Override protected void prepareUserDir(Action action) {
- File actionClassesDirOnDevice = actionClassesDirOnDevice(action);
- adb.mkdir(actionClassesDirOnDevice);
- File resourcesDirectory = action.getResourcesDirectory();
- if (resourcesDirectory != null) {
- adb.push(resourcesDirectory, actionClassesDirOnDevice);
- }
- action.setUserDir(actionClassesDirOnDevice);
- }
-
- private File actionClassesDirOnDevice(Action action) {
- return new File(runnerDir, action.getName());
- }
-
- @Override void cleanup(Action action) {
- super.cleanup(action);
- if (cleanAfter) {
- adb.rm(actionClassesDirOnDevice(action));
- }
- }
-
- @Override void shutdown() {
- super.shutdown();
- if (cleanAfter) {
- adb.rm(runnerDir);
- }
- }
-}
diff --git a/tools/runner/java/vogar/EnvironmentHost.java b/tools/runner/java/vogar/EnvironmentHost.java
deleted file mode 100644
index 7942332..0000000
--- a/tools/runner/java/vogar/EnvironmentHost.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import vogar.commands.Command;
-import vogar.commands.Mkdir;
-
-class EnvironmentHost extends Environment {
-
- EnvironmentHost(boolean cleanBefore, boolean cleanAfter,
- Integer debugPort, File localTemp) {
- super(cleanBefore, cleanAfter, debugPort, localTemp);
- }
-
- @Override void prepare() {}
-
- @Override protected void prepareUserDir(Action action) {
- File actionUserDir = actionUserDir(action);
-
- // if the user dir exists, cp would copy the files to the wrong place
- if (actionUserDir.exists()) {
- throw new IllegalStateException();
- }
-
- File resourcesDirectory = action.getResourcesDirectory();
- if (resourcesDirectory != null) {
- new Mkdir().mkdirs(actionUserDir.getParentFile());
- new Command("cp", "-r", resourcesDirectory.toString(),
- actionUserDir.toString()).execute();
- } else {
- new Mkdir().mkdirs(actionUserDir);
- }
-
- action.setUserDir(actionUserDir);
- }
-}
diff --git a/tools/runner/java/vogar/Expectation.java b/tools/runner/java/vogar/Expectation.java
deleted file mode 100644
index d997709..0000000
--- a/tools/runner/java/vogar/Expectation.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.util.regex.Pattern;
-
-/**
- * The expected result of an action execution. This is typically encoded in the
- * expectations text file, which has the following format:
- * <pre>
- * test java.io.StreamTokenizer.Reset
- * result UNSUPPORTED
- * pattern .*should get token \[, but get -1.*
- *
- * # should we fix this?
- * test java.util.Arrays.CopyMethods
- * result COMPILE_FAILED
- * pattern .*cannot find symbol.*
- * </pre>
- */
-final class Expectation {
-
- /** The pattern to use when no expected output is specified */
- private static final Pattern MATCH_ALL_PATTERN
- = Pattern.compile(".*", Pattern.MULTILINE | Pattern.DOTALL);
-
- /** The expectation of a general successful run. */
- static final Expectation SUCCESS = new Expectation(Result.SUCCESS, null);
-
- /** The action's expected result, such as {@code EXEC_FAILED}. */
- private final Result result;
-
- /** The pattern the expected output will match. */
- private final Pattern pattern;
-
- public Expectation(Result result, String pattern) {
- if (result == null) {
- throw new IllegalArgumentException();
- }
-
- this.result = result;
- this.pattern = pattern != null
- ? Pattern.compile(pattern, Pattern.MULTILINE | Pattern.DOTALL)
- : MATCH_ALL_PATTERN;
- }
-
- public Result getResult() {
- return result;
- }
-
- /**
- * Returns true if {@code outcome} matches this expectation.
- */
- public boolean matches(Outcome outcome) {
- return result == outcome.getResult() && patternMatches(outcome);
- }
-
- private boolean patternMatches(Outcome outcome) {
- return pattern.matcher(Strings.join(outcome.getOutputLines(), "\n")).matches();
- }
-}
diff --git a/tools/runner/java/vogar/ExpectationStore.java b/tools/runner/java/vogar/ExpectationStore.java
deleted file mode 100644
index 7d5a758..0000000
--- a/tools/runner/java/vogar/ExpectationStore.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * A database of expected outcomes. Entries in this database come in two forms.
- * <ul>
- * <li>Outcome expectations name an outcome (or its prefix, such as
- * "java.util"), its expected result, and an optional pattern to match
- * the expected output.
- * <li>Failure expectations include a pattern that may match the output of any
- * outcome. These expectations are useful for hiding failures caused by
- * cross-cutting features that aren't supported.
- * </ul>
- *
- * <p>If an outcome matches both an outcome expectation and a failure
- * expectation, the outcome expectation will be returned.
- */
-final class ExpectationStore {
-
- private static final Logger logger = Logger.getLogger(ExpectationStore.class.getName());
-
- /** Matches lines in the file containing a key and value pair. */
- private static final Pattern KEY_VALUE_PAIR_PATTERN = Pattern.compile("(\\w+)\\s+(.+)");
-
- private final Map<String, Expectation> outcomes = new HashMap<String, Expectation>();
- private final Map<String, Expectation> failures = new HashMap<String, Expectation>();
-
- private ExpectationStore() {}
-
- /**
- * Finds the expected result for the specified action or outcome name. This
- * returns a value for all names, even if no explicit expectation was set.
- */
- public Expectation get(String name) {
- Expectation byName = getByName(name);
- return byName != null ? byName : Expectation.SUCCESS;
- }
-
- /**
- * Finds the expected result for the specified outcome after it has
- * completed. Unlike {@code get()}, this also takes into account the
- * outcome's output.
- */
- public Expectation get(Outcome outcome) {
- Expectation byName = getByName(outcome.getName());
- if (byName != null) {
- return byName;
- }
-
- for (Map.Entry<String, Expectation> entry : failures.entrySet()) {
- if (entry.getValue().matches(outcome)) {
- return entry.getValue();
- }
- }
-
- return Expectation.SUCCESS;
- }
-
- private Expectation getByName(String name) {
- while (true) {
- Expectation expectation = outcomes.get(name);
- if (expectation != null) {
- return expectation;
- }
-
- int dot = name.lastIndexOf('.');
- if (dot == -1) {
- return null;
- }
-
- name = name.substring(0, dot);
- }
- }
-
- public static ExpectationStore parse(Set<File> expectationFiles) throws IOException {
- ExpectationStore result = new ExpectationStore();
- for (File f : expectationFiles) {
- if (f.exists()) {
- result.parse(f);
- }
- }
- return result;
- }
-
- public void parse(File expectationsFile) throws IOException {
- logger.fine("loading expectations file " + expectationsFile);
-
- BufferedReader reader = new BufferedReader(new FileReader(expectationsFile));
- int count = 0;
- try {
- Matcher keyValuePairMatcher = KEY_VALUE_PAIR_PATTERN.matcher("");
-
- // the fields of interest for the current element
- String type = null;
- String qualifiedName = null;
- Result result = null;
- String pattern = null;
-
- String line;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
-
- if (line.length() == 0 || line.startsWith("#")) {
- continue; // skip comment and blank lines
- }
-
- keyValuePairMatcher.reset(line);
- if (!keyValuePairMatcher.matches()) {
- throw new IllegalArgumentException("Unexpected line " + line
- + " in file " + expectationsFile);
- }
-
- String key = keyValuePairMatcher.group(1);
- String value = keyValuePairMatcher.group(2);
- if (key.equals("result") && result == null) {
- result = Result.valueOf(value);
-
- } else if (key.equals("pattern") && pattern == null) {
- pattern = value;
-
- } else if (key.equals("test") || key.equals("failure")) {
- // when we encounter a new qualified name, the previous
- // element is complete. Add it to the results.
- if (qualifiedName != null) {
- count++;
- put(type, qualifiedName, result, pattern);
- result = null;
- pattern = null;
- }
- type = key;
- qualifiedName = value;
-
- } else {
- throw new IllegalArgumentException("Unexpected key " + key
- + " in file " + expectationsFile);
- }
- }
-
- // add the last element in the file
- if (qualifiedName != null) {
- count++;
- put(type, qualifiedName, result, pattern);
- }
-
- logger.fine("loaded " + count + " expectations from " + expectationsFile);
- } finally {
- reader.close();
- }
- }
-
- void put(String type, String qualifiedName, Result result, String pattern) {
- Expectation expectation = new Expectation(result, pattern);
- Map<String, Expectation> map = "test".equals(type) ? outcomes : failures;
- if (map.put(qualifiedName, expectation) != null) {
- throw new IllegalArgumentException(
- "Duplicate expectations for " + qualifiedName);
- }
- }
-}
diff --git a/tools/runner/java/vogar/HostMonitor.java b/tools/runner/java/vogar/HostMonitor.java
deleted file mode 100644
index d94b6c0..0000000
--- a/tools/runner/java/vogar/HostMonitor.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.ConnectException;
-import java.net.Socket;
-import java.util.Collections;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Connects to a target process to monitor its action.
- */
-class HostMonitor {
-
- private static final Logger logger = Logger.getLogger(HostMonitor.class.getName());
-
- private final long monitorTimeoutSeconds;
-
- HostMonitor(long monitorTimeoutSeconds) {
- this.monitorTimeoutSeconds = monitorTimeoutSeconds;
- }
-
- /**
- * Connect to the target process on the given port, read all of its
- * outcomes into {@code handler}, and disconnect.
- */
- public boolean monitor(int port, Handler handler) {
- Socket socket;
- InputStream in;
- int attempt = 0;
- do {
- try {
- socket = new Socket("localhost", port);
- in = new BufferedInputStream(socket.getInputStream());
- if (checkStream(in)) {
- break;
- }
- in.close();
- socket.close();
- } catch (ConnectException recoverable) {
- } catch (IOException e) {
- logger.log(Level.WARNING, "Failed to connect to localhost:" + port, e);
- return false;
- }
-
- if (attempt++ == monitorTimeoutSeconds) {
- logger.warning("Exceeded " + monitorTimeoutSeconds
- + " attempts to connect to localhost:" + port);
- return false;
- }
-
- logger.fine("connection " + attempt + " to localhost:" + port
- + " failed; retrying in 1s");
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- } while (true);
-
- logger.fine("action monitor connected to " + socket.getRemoteSocketAddress());
-
- try {
- SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
- InputSource inputSource = new InputSource(in);
- parser.parse(inputSource, new ClientXmlHandler(handler));
- } catch (ParserConfigurationException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- logger.log(Level.WARNING, "Connection error from localhost:" + port, e);
- return false;
- } catch (SAXException e) {
- logger.log(Level.WARNING, "Received bad XML from localhost:" + port + " " + e);
- return false;
- }
-
- try {
- socket.close();
- } catch (IOException ignored) {
- }
-
- return true;
- }
-
- /**
- * Somewhere between the host and client process, broken socket connections
- * are being accepted. Before we try to do any work on such a connection,
- * check it to make sure it's not dead!
- *
- * TODO: file a bug (against adb?) for this
- */
- private boolean checkStream(InputStream in) throws IOException {
- in.mark(1);
- if (in.read() == -1) {
- return false;
- } else {
- in.reset();
- return true;
- }
- }
-
- /**
- * Handles updates on the outcomes of a target process.
- */
- public interface Handler {
-
- /**
- * Receive a completed outcome.
- */
- void outcome(Outcome outcome);
-
- /**
- * Receive partial output from an action being executed.
- */
- void output(String outcomeName, String output);
- }
-
- class ClientXmlHandler extends DefaultHandler {
- private final Handler handler;
-
- private String currentOutcomeName;
- private String currentActionName;
- private Result currentResult;
- private StringBuilder output = new StringBuilder();
-
- ClientXmlHandler(Handler handler) {
- this.handler = handler;
- }
-
- /*
- * Our XML wire format looks like this:
- *
- * <?xml version='1.0' encoding='UTF-8' ?>
- * <vogar-monitor>
- * <outcome name="java.util.FormatterTest" action="java.util.FormatterTest">
- * test output
- * more test output
- * <result value="SUCCESS" />
- * </outcome>
- * </vogar-monitor>
- */
-
- @Override public void startElement(String uri, String localName,
- String qName, Attributes attributes) throws SAXException {
- if (qName.equals("outcome")) {
- if (currentOutcomeName != null) {
- throw new IllegalStateException();
- }
-
- currentOutcomeName = attributes.getValue("name");
- currentActionName = attributes.getValue("action");
- return;
-
- } else if (qName.equals("result")) {
- currentResult = Result.valueOf(attributes.getValue("value"));
- return;
-
- } else if (!qName.equals("vogar-monitor")) {
- throw new IllegalArgumentException("Unrecognized: " + qName);
- }
- }
-
- @Override public void characters(char[] ch, int start, int length)
- throws SAXException {
- if (currentOutcomeName != null) {
- String text = new String(ch, start, length);
- output.append(text);
- handler.output(currentOutcomeName, text);
- }
- }
-
- @Override public void endElement(String uri, String localName, String qName)
- throws SAXException {
- if (qName.equals("outcome")) {
- handler.outcome(new Outcome(currentOutcomeName, currentActionName,
- currentResult, Collections.singletonList(output.toString())));
- currentOutcomeName = null;
- currentActionName = null;
- currentResult = null;
- output.delete(0, output.length());
- }
- }
- }
-}
diff --git a/tools/runner/java/vogar/JUnitSpec.java b/tools/runner/java/vogar/JUnitSpec.java
deleted file mode 100644
index 626efcb..0000000
--- a/tools/runner/java/vogar/JUnitSpec.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import vogar.target.JUnitRunner;
-import vogar.target.Runner;
-
-/**
- * Create {@link Action}s for {@code .java} files with JUnit tests in them.
- */
-class JUnitSpec extends NamingPatternRunnerSpec {
-
- @Override protected boolean matches(File file) {
- String filename = file.getName();
- return super.matches(file) && (filename.endsWith("Test.java")
- || filename.endsWith("TestSuite.java")
- || filename.contains("Tests"));
- }
-
- public boolean supports(String className) {
- return className.endsWith("Test")
- || className.endsWith("TestSuite")
- || className.contains("Tests");
- }
-
- public Class<? extends Runner> getRunnerClass() {
- return JUnitRunner.class;
- }
-
- public File getSource() {
- return new File(Vogar.HOME_JAVA, "vogar/target/JUnitRunner.java");
- }
-
- public Classpath getClasspath() {
- // TODO: jar up just the junit classes and drop the jar in our lib/ directory.
- return Classpath.of(
- new File("out/host/common/obj/JAVA_LIBRARIES/junit_intermediates/javalib.jar").getAbsoluteFile());
- }
-}
diff --git a/tools/runner/java/vogar/JavaVm.java b/tools/runner/java/vogar/JavaVm.java
deleted file mode 100644
index f8bdd56..0000000
--- a/tools/runner/java/vogar/JavaVm.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.util.List;
-
-/**
- * A local Java virtual machine like Harmony or the RI.
- */
-final class JavaVm extends Vm {
-
- private final File javaHome;
-
- JavaVm(Integer debugPort, File sdkJar, List<String> javacArgs, int monitorPort,
- File localTemp, File javaHome, List<String> additionalVmArgs,
- List<String> targetArgs, boolean cleanBefore, boolean cleanAfter,
- Classpath classpath) {
- super(new EnvironmentHost(cleanBefore, cleanAfter, debugPort, localTemp),
- sdkJar, javacArgs, additionalVmArgs, targetArgs, monitorPort, classpath);
- this.javaHome = javaHome;
- }
-
- @Override protected VmCommandBuilder newVmCommandBuilder(File workingDirectory) {
- String java = javaHome == null ? "java" : new File(javaHome, "bin/java").getPath();
- return new VmCommandBuilder()
- .vmCommand(java)
- .workingDir(workingDirectory);
- }
-
- @Override protected Classpath getRuntimeClasspath(Action action) {
- Classpath result = new Classpath();
- result.addAll(classpath);
- result.addAll(environment.hostJar(action));
-
- /*
- * For javax.net.ssl tests dependency on Bouncy Castle for
- * creating a self-signed X509 certificate. Needs to be run
- * with an openjdk, not a sunjdk, which expects a signed jar
- * to authenticate security providers. For example:
- *
- * --java-home /usr/lib/jvm/java-6-openjdk
- */
- result.addAll(new File("/usr/share/java/bcprov.jar"));
- return result;
- }
-}
diff --git a/tools/runner/java/vogar/Javac.java b/tools/runner/java/vogar/Javac.java
deleted file mode 100644
index 83ef8f0..0000000
--- a/tools/runner/java/vogar/Javac.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import vogar.commands.Command;
-
-/**
- * A javac command.
- */
-final class Javac {
-
- private final Command.Builder builder = new Command.Builder();
-
- Javac() {
- builder.args("javac");
- }
-
- public Javac bootClasspath(File... path) {
- builder.args("-bootclasspath", Classpath.of(path).toString());
- return this;
- }
-
- public Javac classpath(File... path) {
- return classpath(Classpath.of(path));
- }
-
- public Javac classpath(Classpath classpath) {
- builder.args("-classpath", classpath.toString());
- return this;
- }
-
- public Javac sourcepath(File... path) {
- builder.args("-sourcepath", Classpath.of(path).toString());
- return this;
- }
-
- public Javac destination(File directory) {
- builder.args("-d", directory.toString());
- return this;
- }
-
- public Javac extra(List<String> extra) {
- builder.args(extra);
- return this;
- }
-
- public List<String> compile(Collection<File> files) {
- return builder.args(Strings.objectsToStrings(files))
- .execute();
- }
-
- public List<String> compile(File... files) {
- return compile(Arrays.asList(files));
- }
-}
diff --git a/tools/runner/java/vogar/JtregSpec.java b/tools/runner/java/vogar/JtregSpec.java
deleted file mode 100644
index 8c06cc8..0000000
--- a/tools/runner/java/vogar/JtregSpec.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import com.sun.javatest.TestDescription;
-import com.sun.javatest.TestResult;
-import com.sun.javatest.TestResultTable;
-import com.sun.javatest.TestSuite;
-import com.sun.javatest.WorkDirectory;
-import com.sun.javatest.regtest.RegressionTestSuite;
-import java.io.File;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.logging.Logger;
-import vogar.commands.Mkdir;
-import vogar.target.JtregRunner;
-import vogar.target.Runner;
-
-/**
- * Create {@link Action}s for {@code .java} files with jtreg tests in them.
- */
-class JtregSpec implements RunnerSpec {
-
- // TODO: add support for the @library directive, as seen in
- // test/com/sun/crypto/provider/Cipher/AES/TestKATForECB_VT.java
-
- private static final Logger logger = Logger.getLogger(JtregSpec.class.getName());
-
- /**
- * The subpath of a platform implementation under which tests live. Used to
- * derive relative test paths like {@code /java/io/Reader} from an absolute
- * path like {@code /home/jessewilson/platform_v6/test/java/io/Reader}.
- */
- static final String TEST_ROOT = "/test/";
-
- private final File localTemp;
-
- JtregSpec(File localTemp) {
- this.localTemp = localTemp;
- }
-
- /**
- * Returns the tests in {@code directoryToScan}.
- */
- public Set<Action> findActions(File directoryToScan) {
- // for now, jtreg doesn't know how to scan anything but directories
- if (!directoryToScan.isDirectory()) {
- return Collections.emptySet();
- }
-
- try {
- logger.fine("scanning " + directoryToScan + " for jtreg tests");
- File workDirectory = new File(localTemp, "JTwork");
- new Mkdir().mkdirs(workDirectory);
-
- /*
- * This code is capable of extracting test descriptions using jtreg 4.0
- * and its bundled copy of jtharness. As a command line tool, jtreg's
- * API wasn't intended for this style of use. As a consequence, this
- * code is fragile and may be incompatible with newer versions of jtreg.
- */
- TestSuite testSuite = new RegressionTestSuite(directoryToScan);
- WorkDirectory wd = WorkDirectory.convert(workDirectory, testSuite);
- TestResultTable resultTable = wd.getTestResultTable();
-
- Set<Action> result = new LinkedHashSet<Action>();
- for (Iterator i = resultTable.getIterator(); i.hasNext(); ) {
- TestResult testResult = (TestResult) i.next();
- TestDescription description = testResult.getDescription();
- String qualifiedName = qualifiedName(description);
- String testClass = description.getName();
- result.add(new Action(qualifiedName, testClass, description.getDir(), description.getFile(), this));
- }
- return result;
- } catch (Exception jtregFailure) {
- // jtreg shouldn't fail in practice
- throw new RuntimeException(jtregFailure);
- }
- }
-
- public boolean supports(String className) {
- // the jtreg runner cannot run prebuilt classes
- return false;
- }
-
- /**
- * Returns a fully qualified name of the form {@code
- * java.lang.Math.PowTests} from the given test description. The returned
- * name is appropriate for use in a filename.
- */
- String qualifiedName(TestDescription testDescription) {
- return suiteName(testDescription) + "." + escape(testDescription.getName());
- }
-
- /**
- * Returns the name of the class under test, such as {@code java.lang.Math}.
- */
- String suiteName(TestDescription testDescription) {
- String dir = testDescription.getDir().toString();
- int separatorIndex = dir.indexOf(TEST_ROOT);
- return separatorIndex != -1
- ? escape(dir.substring(separatorIndex + TEST_ROOT.length()))
- : escape(dir);
- }
-
- /**
- * Returns a similar string with filename-unsafe characters replaced by
- * filename-safe ones.
- */
- private String escape(String s) {
- return s.replace('/', '.');
- }
-
- public Class<? extends Runner> getRunnerClass() {
- return JtregRunner.class;
- }
-
- public File getSource() {
- return new File(Vogar.HOME_JAVA, "vogar/target/JtregRunner.java");
- }
-
- public Classpath getClasspath() {
- return new Classpath();
- }
-}
diff --git a/tools/runner/java/vogar/MainSpec.java b/tools/runner/java/vogar/MainSpec.java
deleted file mode 100644
index 5a0bcf5..0000000
--- a/tools/runner/java/vogar/MainSpec.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import vogar.target.MainRunner;
-import vogar.target.Runner;
-
-/**
- * Create {@link Action}s for {@code .java} files with main methods in them.
- */
-class MainSpec extends NamingPatternRunnerSpec {
-
- public boolean supports(String className) {
- return true;
- }
-
- public Class<? extends Runner> getRunnerClass() {
- return MainRunner.class;
- }
-
- public File getSource() {
- return new File(Vogar.HOME_JAVA, "vogar/target/MainRunner.java");
- }
-
- public Classpath getClasspath() {
- return new Classpath();
- }
-}
diff --git a/tools/runner/java/vogar/Md5Cache.java b/tools/runner/java/vogar/Md5Cache.java
deleted file mode 100644
index 2855ae8..0000000
--- a/tools/runner/java/vogar/Md5Cache.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.security.MessageDigest;
-import java.util.logging.Logger;
-import vogar.commands.Command;
-import vogar.commands.Mkdir;
-
-/**
- * Caches content by MD5.
- */
-public final class Md5Cache {
- private static final Logger logger = Logger.getLogger(Md5Cache.class.getName());
- private static final File CACHE_ROOT = new File("/tmp/vogar-md5-cache/");
-
- private final String keyPrefix;
-
- /**
- * Creates a new cache accessor. There's only one directory on disk, so 'keyPrefix' is really
- * just a convenience for humans inspecting the cache.
- */
- public Md5Cache(String keyPrefix) {
- this.keyPrefix = keyPrefix;
- }
-
- /**
- * Returns an ASCII hex representation of the MD5 of the content of 'file'.
- */
- private static String md5(File file) {
- byte[] digest = null;
- try {
- MessageDigest digester = MessageDigest.getInstance("MD5");
- byte[] bytes = new byte[8192];
- FileInputStream in = new FileInputStream(file);
- try {
- int byteCount;
- while ((byteCount = in.read(bytes)) > 0) {
- digester.update(bytes, 0, byteCount);
- }
- digest = digester.digest();
- } finally {
- in.close();
- }
- } catch (Exception cause) {
- throw new RuntimeException("Unable to compute MD5 of \"" + file + "\"", cause);
- }
- return (digest == null) ? null : byteArrayToHexString(digest);
- }
-
- private static String byteArrayToHexString(byte[] bytes) {
- StringBuilder result = new StringBuilder();
- for (byte b : bytes) {
- result.append(Integer.toHexString((b >> 4) & 0xf));
- result.append(Integer.toHexString(b & 0xf));
- }
- return result.toString();
- }
-
- /**
- * Returns the appropriate key for a dex file corresponding to the contents of 'classpath'.
- * Returns null if we don't think it's possible to cache the given classpath.
- */
- public File makeKey(Classpath classpath) {
- // Do we have it in cache?
- String key = keyPrefix;
- for (File element : classpath.getElements()) {
- // We only cache dexed .jar files, not directories.
- if (!element.toString().endsWith(".jar")) {
- return null;
- }
- key += "-" + md5(element);
- }
- return new File(CACHE_ROOT, key);
- }
-
- /**
- * Copy the file 'content' into the cache with the given 'key'.
- * This method assumes you're using the appropriate key for the content (and has no way to
- * check because the key is a function of the inputs that made the content, not the content
- * itself).
- * We accept a null so the caller doesn't have to pay attention to whether we think we can
- * cache the content or not.
- */
- public void insert(File key, File content) {
- if (key == null) {
- return;
- }
- logger.fine("inserting " + key);
- if (!key.toString().startsWith(CACHE_ROOT.toString())) {
- throw new IllegalArgumentException("key '" + key + "' not a valid cache key");
- }
- // Make sure the cache exists first.
- new Mkdir().mkdirs(CACHE_ROOT);
- // Copy it onto the same file system first, then atomically move it into place.
- // That way, if we fail, we don't leave anything dangerous lying around.
- File temporary = new File(key + ".tmp");
- new Command.Builder().args("cp", content, temporary).execute();
- new Command.Builder().args("mv", temporary, key).execute();
- }
-}
diff --git a/tools/runner/java/vogar/Mode.java b/tools/runner/java/vogar/Mode.java
deleted file mode 100644
index 7009adb..0000000
--- a/tools/runner/java/vogar/Mode.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
-import vogar.commands.Command;
-import vogar.commands.CommandFailedException;
-import vogar.commands.Mkdir;
-
-/**
- * A Mode for running actions. Examples including running in a virtual machine
- * either on the host or a device or within a specific context such as within an
- * Activity.
- */
-abstract class Mode {
-
- private static final Pattern JAVA_SOURCE_PATTERN = Pattern.compile("\\/(\\w)+\\.java$");
-
- private static final Logger logger = Logger.getLogger(Mode.class.getName());
-
- protected final Environment environment;
- protected final File sdkJar;
- protected final List<String> javacArgs;
- protected final int monitorPort;
-
- /**
- * Set of Java files needed to built to tun the currently selected set of
- * actions. We build a subset rather than all the files all the time to
- * reduce dex packaging costs in the activity mode case.
- */
- protected final Set<File> runnerJava = new HashSet<File>();
-
- /**
- * User classes that need to be included in the classpath for both
- * compilation and execution. Also includes dependencies of all active
- * runners.
- */
- protected final Classpath classpath = new Classpath();
-
- Mode(Environment environment, File sdkJar, List<String> javacArgs,
- int monitorPort, Classpath classpath) {
- this.environment = environment;
- this.sdkJar = sdkJar;
- this.javacArgs = javacArgs;
- this.monitorPort = monitorPort;
- this.classpath.addAll(classpath);
- }
-
- /**
- * Initializes the temporary directories and harness necessary to run
- * actions.
- */
- protected void prepare(Set<RunnerSpec> runners) {
- for (RunnerSpec runnerSpec : runners) {
- runnerJava.add(runnerSpec.getSource());
- classpath.addAll(runnerSpec.getClasspath());
- }
- runnerJava.add(new File(Vogar.HOME_JAVA, "vogar/target/TestRunner.java"));
- environment.prepare();
- classpath.addAll(compileRunner());
- installRunner();
- }
-
- private List<File> dalvikAnnotationSourceFiles() {
- // Hopefully one day we'll strip the dalvik annotations out, but until then we need to make
- // them available to javac(1).
- File sourceDir = new File("dalvik/libcore/dalvik/src/main/java/dalvik/annotation");
- File[] javaSourceFiles = sourceDir.listFiles(new FilenameFilter() {
- public boolean accept(File dir, String filename) {
- return filename.endsWith(".java");
- }
- });
- return Arrays.asList(javaSourceFiles);
- }
-
- /**
- * Returns a .jar file containing the compiled runner .java files.
- */
- private File compileRunner() {
- logger.fine("build runner");
- File classes = environment.file("runner", "classes");
- File jar = environment.hostJar("runner");
- new Mkdir().mkdirs(classes);
- new Javac()
- .bootClasspath(sdkJar)
- .classpath(classpath)
- .sourcepath(Vogar.HOME_JAVA)
- .destination(classes)
- .extra(javacArgs)
- .compile(runnerJava);
- new Command("jar", "cvfM", jar.getPath(),
- "-C", classes.getPath(), "./").execute();
- return jar;
- }
-
- /**
- * Compiles classes for the given action and makes them ready for execution.
- *
- * @return null if the compilation succeeded, or an outcome describing the
- * failure otherwise.
- */
- public Outcome buildAndInstall(Action action) {
- logger.fine("build " + action.getName());
-
- try {
- File jar = compile(action);
- postCompile(action, jar);
- } catch (CommandFailedException e) {
- return new Outcome(action.getName(), action.getName(),
- Result.COMPILE_FAILED, e.getOutputLines());
- } catch (IOException e) {
- return new Outcome(action.getName(), Result.ERROR, e);
- }
- environment.prepareUserDir(action);
- return null;
- }
-
- /**
- * Returns the .jar file containing the action's compiled classes.
- *
- * @throws CommandFailedException if javac fails
- */
- private File compile(Action action) throws IOException {
- File classesDir = environment.file(action, "classes");
- new Mkdir().mkdirs(classesDir);
- FileOutputStream propertiesOut = new FileOutputStream(
- new File(classesDir, TestProperties.FILE));
- Properties properties = new Properties();
- fillInProperties(properties, action);
- properties.store(propertiesOut, "generated by " + Mode.class.getName());
- propertiesOut.close();
-
- Javac javac = new Javac();
-
- Set<File> sourceFiles = new HashSet<File>();
- sourceFiles.addAll(dalvikAnnotationSourceFiles());
-
- File javaFile = action.getJavaFile();
- if (javaFile != null) {
- if (!JAVA_SOURCE_PATTERN.matcher(javaFile.toString()).find()) {
- throw new CommandFailedException(Collections.<String>emptyList(),
- Collections.singletonList("Cannot compile: " + javaFile));
- }
- sourceFiles.add(javaFile);
- javac.sourcepath(javaFile.getParentFile());
- }
-
- javac.bootClasspath(sdkJar)
- .classpath(classpath)
- .destination(classesDir)
- .extra(javacArgs)
- .compile(sourceFiles);
-
- File jar = environment.hostJar(action);
- new Command("jar", "cvfM", jar.getPath(),
- "-C", classesDir.getPath(), "./").execute();
- return jar;
- }
-
- /**
- * Fill in properties for running in this mode
- */
- protected void fillInProperties(Properties properties, Action action) {
- properties.setProperty(TestProperties.TEST_CLASS, action.getTargetClass());
- properties.setProperty(TestProperties.QUALIFIED_NAME, action.getName());
- properties.setProperty(TestProperties.RUNNER_CLASS, action.getRunnerSpec().getRunnerClass().getName());
- properties.setProperty(TestProperties.MONITOR_PORT, String.valueOf(monitorPort));
- }
-
- /**
- * Hook method called after runner compilation.
- */
- protected void installRunner() {}
-
- /**
- * Hook method called after action compilation.
- */
- protected void postCompile(Action action, File jar) {}
-
- /**
- * Create the command that executes the action.
- */
- protected abstract Command createActionCommand(Action action);
-
- /**
- * Deletes files and releases any resources required for the execution of
- * the given action.
- */
- void cleanup(Action action) {
- environment.cleanup(action);
- }
-
- /**
- * Cleans up after all actions have completed.
- */
- void shutdown() {
- environment.shutdown();
- }
-}
diff --git a/tools/runner/java/vogar/NamingPatternRunnerSpec.java b/tools/runner/java/vogar/NamingPatternRunnerSpec.java
deleted file mode 100644
index 429bab9..0000000
--- a/tools/runner/java/vogar/NamingPatternRunnerSpec.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * A code finder that traverses through the directory tree looking for matching
- * naming patterns.
- */
-abstract class NamingPatternRunnerSpec implements RunnerSpec {
-
- private final String PACKAGE_PATTERN = "(?m)^\\s*package\\s+(\\S+)\\s*;";
-
- private final String TYPE_DECLARATION_PATTERN
- = "(?m)\\b(?:public|private)\\s+(?:final\\s+)?(?:interface|class|enum)\\b";
-
- public Set<Action> findActions(File searchDirectory) {
- Set<Action> result = new LinkedHashSet<Action>();
- findActionsRecursive(result, searchDirectory);
- return result;
- }
-
- /**
- * Returns true if {@code file} contains a action class of this type.
- */
- protected boolean matches(File file) {
- return (!file.getName().startsWith(".")
- && file.getName().endsWith(".java"));
- }
-
- private void findActionsRecursive(Set<Action> sink, File file) {
- if (file.isDirectory()) {
- for (File child : file.listFiles()) {
- findActionsRecursive(sink, child);
- }
- return;
- }
-
- if (!matches(file)) {
- return;
- }
-
- String className = fileToClass(file);
- sink.add(new Action(className, className, null, file, this));
- }
-
- /**
- * Returns the Java classname for the given file. For example, given the
- * input {@code luni/src/test/java/org/apache/harmony/luni/tests/java/util/ArrayListTest.java},
- * this returns {@code org.apache.harmony.luni.tests.java.util.ArrayListTest}.
- */
- private String fileToClass(File file) {
- String filePath = file.getPath();
- if (!filePath.endsWith(".java")) {
- throw new IllegalArgumentException("Not a .java file: " + file);
- }
-
- // We can get the unqualified class name from the path.
- // It's the last element minus the trailing ".java".
- String filename = file.getName();
- String className = filename.substring(0, filename.length() - 5);
-
- // For the package, the only foolproof way is to look for the package
- // declaration inside the file.
- try {
- String content = Strings.readFile(file);
- Pattern packagePattern = Pattern.compile(PACKAGE_PATTERN);
- Matcher packageMatcher = packagePattern.matcher(content);
- if (!packageMatcher.find()) {
- // if it doesn't have a package, make sure there's at least a
- // type declaration otherwise we're probably reading the wrong
- // kind of file.
- if (Pattern.compile(TYPE_DECLARATION_PATTERN).matcher(content).find()) {
- return className;
- }
- throw new IllegalArgumentException("Not a .java file: '" + file + "'\n" + content);
- }
- String packageName = packageMatcher.group(1);
- return packageName + "." + className;
- } catch (IOException ex) {
- throw new IllegalArgumentException("Couldn't read '" + file + "': " + ex.getMessage());
- }
- }
-}
diff --git a/tools/runner/java/vogar/Option.java b/tools/runner/java/vogar/Option.java
deleted file mode 100644
index a73fbbf..0000000
--- a/tools/runner/java/vogar/Option.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotates a field as representing a command-line option for OptionParser.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.FIELD)
-public @interface Option {
- /**
- * The names for this option, such as { "-h", "--help" }.
- * Names must start with one or two '-'s.
- * An option must have at least one name.
- */
- String[] names();
-}
diff --git a/tools/runner/java/vogar/OptionParser.java b/tools/runner/java/vogar/OptionParser.java
deleted file mode 100644
index d031316..0000000
--- a/tools/runner/java/vogar/OptionParser.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Parses command line options.
- *
- * Strings in the passed-in String[] are parsed left-to-right. Each
- * String is classified as a short option (such as "-v"), a long
- * option (such as "--verbose"), an argument to an option (such as
- * "out.txt" in "-f out.txt"), or a non-option positional argument.
- *
- * A simple short option is a "-" followed by a short option
- * character. If the option requires an argument (which is true of any
- * non-boolean option), it may be written as a separate parameter, but
- * need not be. That is, "-f out.txt" and "-fout.txt" are both
- * acceptable.
- *
- * It is possible to specify multiple short options after a single "-"
- * as long as all (except possibly the last) do not require arguments.
- *
- * A long option begins with "--" followed by several characters. If
- * the option requires an argument, it may be written directly after
- * the option name, separated by "=", or as the next argument. (That
- * is, "--file=out.txt" or "--file out.txt".)
- *
- * A boolean long option '--name' automatically gets a '--no-name'
- * companion. Given an option "--flag", then, "--flag", "--no-flag",
- * "--flag=true" and "--flag=false" are all valid, though neither
- * "--flag true" nor "--flag false" are allowed (since "--flag" by
- * itself is sufficient, the following "true" or "false" is
- * interpreted separately). You can use "yes" and "no" as synonyms for
- * "true" and "false".
- *
- * Each String not starting with a "-" and not a required argument of
- * a previous option is a non-option positional argument, as are all
- * successive Strings. Each String after a "--" is a non-option
- * positional argument.
- *
- * Parsing of numeric fields such byte, short, int, long, float, and
- * double fields is supported. This includes both unboxed and boxed
- * versions (e.g. int vs Integer). If there is a problem parsing the
- * argument to match the desired type, a runtime exception is thrown.
- *
- * File option fields are supported by simply wrapping the string
- * argument in a File object without testing for the existance of the
- * file.
- *
- * Parameterized Collection fields such as List<File> and Set<String>
- * are supported as long as the parameter type is otherwise supported
- * by the option parser. The collection field should be initialized
- * with an appropriate collection instance.
- *
- * The fields corresponding to options are updated as their options
- * are processed. Any remaining positional arguments are returned as a
- * List<String>.
- *
- * Here's a simple example:
- *
- * // This doesn't need to be a separate class, if your application doesn't warrant it.
- * // Non-@Option fields will be ignored.
- * class Options {
- * @Option(names = { "-q", "--quiet" })
- * boolean quiet = false;
- *
- * // Boolean options require a long name if it's to be possible to explicitly turn them off.
- * // Here the user can use --no-color.
- * @Option(names = { "--color" })
- * boolean color = true;
- *
- * @Option(names = { "-m", "--mode" })
- * String mode = "standard; // Supply a default just by setting the field.
- *
- * @Option(names = { "-p", "--port" })
- * int portNumber = 8888;
- *
- * // There's no need to offer a short name for rarely-used options.
- * @Option(names = { "--timeout" })
- * double timeout = 1.0;
- *
- * @Option(names = { "-o", "--output-file" })
- * File output;
- *
- * // Multiple options are added to the collection.
- * // The collection field itself must be non-null.
- * @Option(names = { "-i", "--input-file" })
- * List<File> inputs = new ArrayList<File>();
- *
- * }
- *
- * class Main {
- * public static void main(String[] args) {
- * Options options = new Options();
- * List<String> inputFilenames = new OptionParser(options).parse(args);
- * for (String inputFilename : inputFilenames) {
- * if (!options.quiet) {
- * ...
- * }
- * ...
- * }
- * }
- * }
- *
- * See also:
- *
- * the getopt(1) man page
- * Python's "optparse" module (http://docs.python.org/library/optparse.html)
- * the POSIX "Utility Syntax Guidelines" (http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap12.html#tag_12_02)
- * the GNU "Standards for Command Line Interfaces" (http://www.gnu.org/prep/standards/standards.html#Command_002dLine-Interfaces)
- */
-public class OptionParser {
- private static final HashMap<Class<?>, Handler> handlers = new HashMap<Class<?>, Handler>();
- static {
- handlers.put(boolean.class, new BooleanHandler());
- handlers.put(Boolean.class, new BooleanHandler());
-
- handlers.put(byte.class, new ByteHandler());
- handlers.put(Byte.class, new ByteHandler());
- handlers.put(short.class, new ShortHandler());
- handlers.put(Short.class, new ShortHandler());
- handlers.put(int.class, new IntegerHandler());
- handlers.put(Integer.class, new IntegerHandler());
- handlers.put(long.class, new LongHandler());
- handlers.put(Long.class, new LongHandler());
-
- handlers.put(float.class, new FloatHandler());
- handlers.put(Float.class, new FloatHandler());
- handlers.put(double.class, new DoubleHandler());
- handlers.put(Double.class, new DoubleHandler());
-
- handlers.put(String.class, new StringHandler());
- handlers.put(File.class, new FileHandler());
- }
- Handler getHandler(Type type) {
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) type;
- Class rawClass = (Class<?>) parameterizedType.getRawType();
- if (!Collection.class.isAssignableFrom(rawClass)) {
- throw new RuntimeException("cannot handle non-collection parameterized type " + type);
- }
- Type actualType = parameterizedType.getActualTypeArguments()[0];
- if (!(actualType instanceof Class)) {
- throw new RuntimeException("cannot handle nested parameterized type " + type);
- }
- return getHandler(actualType);
- }
- if (type instanceof Class) {
- if (Collection.class.isAssignableFrom((Class) type)) {
- // could handle by just having a default of treating
- // contents as String but consciously decided this
- // should be an error
- throw new RuntimeException(
- "cannot handle non-parameterized collection " + type + ". " +
- "use a generic Collection to specify a desired element type");
- }
- return handlers.get((Class<?>) type);
- }
- throw new RuntimeException("cannot handle unknown field type " + type);
- }
-
- private final Object optionSource;
- private final HashMap<String, Field> optionMap;
-
- /**
- * Constructs a new OptionParser for setting the @Option fields of 'optionSource'.
- */
- public OptionParser(Object optionSource) {
- this.optionSource = optionSource;
- this.optionMap = makeOptionMap();
- }
-
- /**
- * Parses the command-line arguments 'args', setting the @Option fields of the 'optionSource' provided to the constructor.
- * Returns a list of the positional arguments left over after processing all options.
- */
- public List<String> parse(String[] args) {
- return parseOptions(Arrays.asList(args).iterator());
- }
-
- private List<String> parseOptions(Iterator<String> args) {
- final List<String> leftovers = new ArrayList<String>();
-
- // Scan 'args'.
- while (args.hasNext()) {
- final String arg = args.next();
- if (arg.equals("--")) {
- // "--" marks the end of options and the beginning of positional arguments.
- break;
- } else if (arg.startsWith("--")) {
- // A long option.
- parseLongOption(arg, args);
- } else if (arg.startsWith("-")) {
- // A short option.
- parseGroupedShortOptions(arg, args);
- } else {
- // The first non-option marks the end of options.
- leftovers.add(arg);
- break;
- }
- }
-
- // Package up the leftovers.
- while (args.hasNext()) {
- leftovers.add(args.next());
- }
- return leftovers;
- }
-
- private Field fieldForArg(String name) {
- final Field field = optionMap.get(name);
- if (field == null) {
- throw new RuntimeException("unrecognized option '" + name + "'");
- }
- return field;
- }
-
- private void parseLongOption(String arg, Iterator<String> args) {
- String name = arg.replaceFirst("^--no-", "--");
- String value = null;
-
- // Support "--name=value" as well as "--name value".
- final int equalsIndex = name.indexOf('=');
- if (equalsIndex != -1) {
- value = name.substring(equalsIndex + 1);
- name = name.substring(0, equalsIndex);
- }
-
- final Field field = fieldForArg(name);
- final Handler handler = getHandler(field.getGenericType());
- if (value == null) {
- if (handler.isBoolean()) {
- value = arg.startsWith("--no-") ? "false" : "true";
- } else {
- value = grabNextValue(args, name, field);
- }
- }
- setValue(optionSource, field, arg, handler, value);
- }
-
- // Given boolean options a and b, and non-boolean option f, we want to allow:
- // -ab
- // -abf out.txt
- // -abfout.txt
- // (But not -abf=out.txt --- POSIX doesn't mention that either way, but GNU expressly forbids it.)
- private void parseGroupedShortOptions(String arg, Iterator<String> args) {
- for (int i = 1; i < arg.length(); ++i) {
- final String name = "-" + arg.charAt(i);
- final Field field = fieldForArg(name);
- final Handler handler = getHandler(field.getGenericType());
- String value;
- if (handler.isBoolean()) {
- value = "true";
- } else {
- // We need a value. If there's anything left, we take the rest of this "short option".
- if (i + 1 < arg.length()) {
- value = arg.substring(i + 1);
- i = arg.length() - 1;
- } else {
- value = grabNextValue(args, name, field);
- }
- }
- setValue(optionSource, field, arg, handler, value);
- }
- }
-
- @SuppressWarnings("unchecked")
- private static void setValue(Object object, Field field, String arg, Handler handler, String valueText) {
-
- Object value = handler.translate(valueText);
- if (value == null) {
- final String type = field.getType().getSimpleName().toLowerCase();
- throw new RuntimeException("couldn't convert '" + valueText + "' to a " + type + " for option '" + arg + "'");
- }
- try {
- field.setAccessible(true);
- if (Collection.class.isAssignableFrom(field.getType())) {
- Collection collection = (Collection) field.get(object);
- collection.add(value);
- } else {
- field.set(object, value);
- }
- } catch (IllegalAccessException ex) {
- throw new RuntimeException("internal error", ex);
- }
- }
-
- // Returns the next element of 'args' if there is one. Uses 'name' and 'field' to construct a helpful error message.
- private String grabNextValue(Iterator<String> args, String name, Field field) {
- if (!args.hasNext()) {
- final String type = field.getType().getSimpleName().toLowerCase();
- throw new RuntimeException("option '" + name + "' requires a " + type + " argument");
- }
- return args.next();
- }
-
- // Cache the available options and report any problems with the options themselves right away.
- private HashMap<String, Field> makeOptionMap() {
- final HashMap<String, Field> optionMap = new HashMap<String, Field>();
- final Class<?> optionClass = optionSource.getClass();
- for (Field field : optionClass.getDeclaredFields()) {
- if (field.isAnnotationPresent(Option.class)) {
- final Option option = field.getAnnotation(Option.class);
- final String[] names = option.names();
- if (names.length == 0) {
- throw new RuntimeException("found an @Option with no name!");
- }
- for (String name : names) {
- if (optionMap.put(name, field) != null) {
- throw new RuntimeException("found multiple @Options sharing the name '" + name + "'");
- }
- }
- if (getHandler(field.getGenericType()) == null) {
- throw new RuntimeException("unsupported @Option field type '" + field.getType() + "'");
- }
- }
- }
- return optionMap;
- }
-
- static abstract class Handler {
- // Only BooleanHandler should ever override this.
- boolean isBoolean() {
- return false;
- }
-
- /**
- * Returns an object of appropriate type for the given Handle, corresponding to 'valueText'.
- * Returns null on failure.
- */
- abstract Object translate(String valueText);
- }
-
- static class BooleanHandler extends Handler {
- @Override boolean isBoolean() {
- return true;
- }
-
- Object translate(String valueText) {
- if (valueText.equalsIgnoreCase("true") || valueText.equalsIgnoreCase("yes")) {
- return Boolean.TRUE;
- } else if (valueText.equalsIgnoreCase("false") || valueText.equalsIgnoreCase("no")) {
- return Boolean.FALSE;
- }
- return null;
- }
- }
-
- static class ByteHandler extends Handler {
- Object translate(String valueText) {
- try {
- return Byte.parseByte(valueText);
- } catch (NumberFormatException ex) {
- return null;
- }
- }
- }
-
- static class ShortHandler extends Handler {
- Object translate(String valueText) {
- try {
- return Short.parseShort(valueText);
- } catch (NumberFormatException ex) {
- return null;
- }
- }
- }
-
- static class IntegerHandler extends Handler {
- Object translate(String valueText) {
- try {
- return Integer.parseInt(valueText);
- } catch (NumberFormatException ex) {
- return null;
- }
- }
- }
-
- static class LongHandler extends Handler {
- Object translate(String valueText) {
- try {
- return Long.parseLong(valueText);
- } catch (NumberFormatException ex) {
- return null;
- }
- }
- }
-
- static class FloatHandler extends Handler {
- Object translate(String valueText) {
- try {
- return Float.parseFloat(valueText);
- } catch (NumberFormatException ex) {
- return null;
- }
- }
- }
-
- static class DoubleHandler extends Handler {
- Object translate(String valueText) {
- try {
- return Double.parseDouble(valueText);
- } catch (NumberFormatException ex) {
- return null;
- }
- }
- }
-
- static class StringHandler extends Handler {
- Object translate(String valueText) {
- return valueText;
- }
- }
-
- static class FileHandler extends Handler {
- Object translate(String valueText) {
- return new File(valueText);
- }
- }
-}
diff --git a/tools/runner/java/vogar/Outcome.java b/tools/runner/java/vogar/Outcome.java
deleted file mode 100644
index 471f937..0000000
--- a/tools/runner/java/vogar/Outcome.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * An outcome of an action. Some actions may have multiple outcomes. For
- * example, JUnit tests have one outcome for each test method.
- */
-final class Outcome {
-
- private final String outcomeName;
- private final String actionName;
- private final Result result;
- private final List<String> outputLines;
-
- public Outcome(String outcomeName, String actionName, Result result,
- List<String> outputLines) {
- this.outcomeName = outcomeName;
- this.actionName = actionName;
- this.result = result;
- this.outputLines = outputLines;
- }
-
- public Outcome(String actionName, Result result, String outputLine) {
- this.outcomeName = actionName;
- this.actionName = actionName;
- this.result = result;
- this.outputLines = Collections.singletonList(outputLine);
- }
-
- public Outcome(String actionName, Result result, Throwable throwable) {
- this.outcomeName = actionName;
- this.actionName = actionName;
- this.result = result;
- this.outputLines = throwableToLines(throwable);
- }
-
- public String getName() {
- return outcomeName;
- }
-
- public String getActionName() {
- return actionName;
- }
-
- public Result getResult() {
- return result;
- }
-
- public List<String> getOutputLines() {
- return outputLines;
- }
-
- private static List<String> throwableToLines(Throwable t) {
- StringWriter writer = new StringWriter();
- PrintWriter out = new PrintWriter(writer);
- t.printStackTrace(out);
- return Arrays.asList(writer.toString().split("\\n"));
- }
-
- /**
- * Returns the action's suite name, such as java.lang.Integer or
- * java.lang.IntegerTest.
- */
- public String getSuiteName() {
- int split = split(outcomeName);
- return split == -1 ? "defaultpackage" : outcomeName.substring(0, split);
- }
-
- /**
- * Returns the specific action name, such as BitTwiddle or testBitTwiddle.
- */
- public String getTestName() {
- int split = split(outcomeName);
- return split == -1 ? outcomeName : outcomeName.substring(split + 1);
- }
-
- private static int split(String name) {
- int lastHash = name.indexOf('#');
- return lastHash == -1 ? name.lastIndexOf('.') : lastHash;
- }
-}
diff --git a/tools/runner/java/vogar/Result.java b/tools/runner/java/vogar/Result.java
deleted file mode 100644
index 45c88ce..0000000
--- a/tools/runner/java/vogar/Result.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-/**
- * The result of a test or benchmark execution.
- */
-public enum Result {
-
- /**
- * An action that cannot be run by this harness, such as a shell script.
- */
- UNSUPPORTED,
-
- COMPILE_FAILED,
- EXEC_FAILED,
- EXEC_TIMEOUT,
- ERROR,
- SUCCESS
-}
diff --git a/tools/runner/java/vogar/RunnerSpec.java b/tools/runner/java/vogar/RunnerSpec.java
deleted file mode 100644
index 8054b89..0000000
--- a/tools/runner/java/vogar/RunnerSpec.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.util.Set;
-import vogar.target.Runner;
-
-/**
- * Defines a runner for a type of Java code, such as a JUnit test, benchmark,
- * or class with main method.
- */
-public interface RunnerSpec {
-
- /**
- * Returns all actions in the given file or directory. If the returned set
- * is empty, no executable code of this kind were found.
- */
- Set<Action> findActions(File file);
-
- /**
- * Returns true if this runner can exercise {@code clazz}.
- *
- * @param className a fully qualified classname.
- */
- boolean supports(String className);
-
- /**
- * Return the class for the TestRunner
- */
- Class<? extends Runner> getRunnerClass();
-
- /**
- * Return the Java file for the TestRunner
- */
- File getSource();
-
- /**
- * Return the compile classpath for the TestRunner
- */
- Classpath getClasspath();
-}
diff --git a/tools/runner/java/vogar/Strings.java b/tools/runner/java/vogar/Strings.java
deleted file mode 100644
index d46d860..0000000
--- a/tools/runner/java/vogar/Strings.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package vogar;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * Utility methods for strings.
- */
-public class Strings {
-
- public static String readFile(File f) throws IOException {
- StringBuilder result = new StringBuilder();
- BufferedReader in =
- new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"));
- String line;
- while ((line = in.readLine()) != null) {
- result.append(line);
- result.append('\n');
- }
- in.close();
- return result.toString();
- }
-
- public static String join(Object[] objects, String delimiter) {
- return join(Arrays.asList(objects), delimiter);
- }
-
- public static String join(Iterable<?> objects, String delimiter) {
- Iterator<?> i = objects.iterator();
- if (!i.hasNext()) {
- return "";
- }
-
- StringBuilder result = new StringBuilder();
- result.append(i.next());
- while(i.hasNext()) {
- result.append(delimiter).append(i.next());
- }
- return result.toString();
- }
-
- public static String[] objectsToStrings(Object[] objects) {
- String[] result = new String[objects.length];
- int i = 0;
- for (Object o : objects) {
- result[i++] = o.toString();
- }
- return result;
- }
-
- public static String[] objectsToStrings(Collection<?> objects) {
- return objectsToStrings(objects.toArray());
- }
-}
diff --git a/tools/runner/java/vogar/TestProperties.java b/tools/runner/java/vogar/TestProperties.java
deleted file mode 100644
index d9a5b7b..0000000
--- a/tools/runner/java/vogar/TestProperties.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-/**
- * TestProperties is a common class of constants shared between the
- * Vogar on the host and TestRunner classes potentially running
- * on other devices.
- */
-final public class TestProperties {
-
- /**
- * The name of the test properties file within the {@code .jar} file.
- */
- public static final String FILE = "test.properties";
-
- /**
- * Name of the property giving the test's main class name. This class should
- * have a {@code public static void main(String[] args)} method.
- */
- public static final String TEST_CLASS = "testClass";
-
- /**
- * Name of the property giving the test's name, such as {@code
- * java.math.BigDecimal.PowTests}.
- */
- public static final String QUALIFIED_NAME = "qualifiedName";
-
- /**
- * Name of the property used by TestRunner to determine which
- * class to use as the Runner name. This class should implement
- * Runner.
- */
- public static final String RUNNER_CLASS = "runnerClass";
-
- /**
- * Name of the property used by TestActivity to the test directory.
- */
- public static final String DEVICE_RUNNER_DIR = "deviceRunnerDir";
-
- /**
- * Port to accept monitor connections on.
- */
- public static final String MONITOR_PORT = "monitorPort";
-
- private TestProperties() {}
-}
diff --git a/tools/runner/java/vogar/Threads.java b/tools/runner/java/vogar/Threads.java
deleted file mode 100644
index 35cc3ab..0000000
--- a/tools/runner/java/vogar/Threads.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-/**
- * Utility methods for working with threads.
- */
-public class Threads {
-
- public static ThreadFactory daemonThreadFactory() {
- return new ThreadFactory() {
- public Thread newThread(Runnable r) {
- Thread thread = new Thread(r, r.toString());
- thread.setDaemon(true);
- return thread;
- }
- };
- }
-
- public static ExecutorService threadPerCpuExecutor() {
- return Executors.newFixedThreadPool(
- Runtime.getRuntime().availableProcessors(), daemonThreadFactory());
- }
-}
diff --git a/tools/runner/java/vogar/Vm.java b/tools/runner/java/vogar/Vm.java
deleted file mode 100644
index 350b861..0000000
--- a/tools/runner/java/vogar/Vm.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import vogar.commands.Command;
-import vogar.target.TestRunner;
-
-/**
- * A Java-like virtual machine for compiling and running tests.
- */
-public abstract class Vm extends Mode {
-
- protected final List<String> additionalVmArgs;
- protected final List<String> targetArgs;
-
- Vm(Environment environment, File sdkJar, List<String> javacArgs,
- List<String> additionalVmArgs, List<String> targetArgs, int monitorPort,
- Classpath classpath) {
- super(environment, sdkJar, javacArgs, monitorPort, classpath);
- this.additionalVmArgs = additionalVmArgs;
- this.targetArgs = targetArgs;
- }
-
- /**
- * Returns a VM for action execution.
- */
- @Override protected Command createActionCommand(Action action) {
- return newVmCommandBuilder(action.getUserDir())
- .classpath(getRuntimeClasspath(action))
- .userDir(action.getUserDir())
- .debugPort(environment.debugPort)
- .vmArgs(additionalVmArgs)
- .mainClass(TestRunner.class.getName())
- .args(targetArgs)
- .build();
- }
-
- /**
- * Returns a VM for action execution.
- */
- protected abstract VmCommandBuilder newVmCommandBuilder(File workingDirectory);
-
- /**
- * Returns the classpath containing JUnit and the dalvik annotations
- * required for action execution.
- */
- protected abstract Classpath getRuntimeClasspath(Action action);
-
- /**
- * Builds a virtual machine command.
- */
- public static class VmCommandBuilder {
- private File temp;
- private Classpath classpath = new Classpath();
- private File workingDir;
- private File userDir;
- private Integer debugPort;
- private String mainClass;
- private PrintStream output;
- private List<String> vmCommand = Collections.singletonList("java");
- private List<String> vmArgs = new ArrayList<String>();
- private List<String> args = new ArrayList<String>();
-
- public VmCommandBuilder vmCommand(String... vmCommand) {
- this.vmCommand = Arrays.asList(vmCommand.clone());
- return this;
- }
-
- public VmCommandBuilder temp(File temp) {
- this.temp = temp;
- return this;
- }
-
- public VmCommandBuilder classpath(Classpath classpath) {
- this.classpath.addAll(classpath);
- return this;
- }
-
- public VmCommandBuilder workingDir(File workingDir) {
- this.workingDir = workingDir;
- return this;
- }
-
- public VmCommandBuilder userDir(File userDir) {
- this.userDir = userDir;
- return this;
- }
-
- public VmCommandBuilder debugPort(Integer debugPort) {
- this.debugPort = debugPort;
- return this;
- }
-
- public VmCommandBuilder mainClass(String mainClass) {
- this.mainClass = mainClass;
- return this;
- }
-
- public VmCommandBuilder output(PrintStream output) {
- this.output = output;
- return this;
- }
-
- public VmCommandBuilder vmArgs(String... vmArgs) {
- return vmArgs(Arrays.asList(vmArgs));
- }
-
- public VmCommandBuilder vmArgs(Collection<String> vmArgs) {
- this.vmArgs.addAll(vmArgs);
- return this;
- }
-
- public VmCommandBuilder args(String... args) {
- return args(Arrays.asList(args));
- }
-
- public VmCommandBuilder args(Collection<String> args) {
- this.args.addAll(args);
- return this;
- }
-
- public Command build() {
- Command.Builder builder = new Command.Builder();
- builder.args(vmCommand);
- builder.args("-classpath", classpath.toString());
- builder.args("-Duser.dir=" + userDir);
- if (workingDir != null) {
- builder.workingDirectory(workingDir);
- }
-
- if (temp != null) {
- builder.args("-Djava.io.tmpdir=" + temp);
- }
-
- if (debugPort != null) {
- builder.args("-Xrunjdwp:transport=dt_socket,address="
- + debugPort + ",server=y,suspend=y");
- }
-
- builder.args(vmArgs);
- builder.args(mainClass);
- builder.args(args);
-
- builder.tee(output);
-
- return builder.build();
- }
- }
-}
diff --git a/tools/runner/java/vogar/Vogar.java b/tools/runner/java/vogar/Vogar.java
deleted file mode 100644
index 1f6ef96..0000000
--- a/tools/runner/java/vogar/Vogar.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-import java.util.regex.Pattern;
-
-/**
- * Command line interface for running benchmarks and tests on dalvik.
- */
-public final class Vogar {
-
- static final File HOME = new File("dalvik/libcore/tools/runner");
- static final File HOME_JAVA = new File(HOME, "java");
-
- static final Pattern CLASS_NAME_PATTERN
- = Pattern.compile("(\\w+)(\\.\\w+)*\\.[A-Z]\\w*");
-
- private static class Options {
-
- private final Classpath classpath = Classpath.of(
- // TODO: we should be able to work with a shipping SDK, not depend on out/...
- new File("out/host/common/obj/JAVA_LIBRARIES/kxml2-2.3.0_intermediates/javalib.jar").getAbsoluteFile());
-
- private final List<File> actionFiles = new ArrayList<File>();
- private final List<String> actionClasses = new ArrayList<String>();
- private final List<String> targetArgs = new ArrayList<String>();
-
- @Option(names = { "--expectations" })
- private Set<File> expectationFiles = new LinkedHashSet<File>();
- {
- File[] files = new File("dalvik/libcore/tools/runner/expectations").listFiles();
- if (files != null) {
- expectationFiles.addAll(Arrays.asList(files));
- }
- }
-
- private static String MODE_DEVICE = "device";
- private static String MODE_HOST = "host";
- private static String MODE_ACTIVITY = "activity";
- @Option(names = { "--mode" })
- private String mode = MODE_DEVICE;
-
- @Option(names = { "--timeout" })
- private long timeoutSeconds = 10 * 60; // default is ten minutes;
-
- @Option(names = { "--monitor-timeout" })
- private long monitorTimeout = 10;
-
- @Option(names = { "--clean-before" })
- private boolean cleanBefore = true;
-
- @Option(names = { "--clean-after" })
- private boolean cleanAfter = true;
-
- @Option(names = { "--clean" })
- private boolean clean = true;
-
- @Option(names = { "--xml-reports-directory" })
- private File xmlReportsDirectory;
-
- @Option(names = { "--indent" })
- private String indent = " ";
-
- @Option(names = { "--verbose" })
- private boolean verbose;
-
- @Option(names = { "--stream" })
- private boolean stream;
-
- @Option(names = { "--color" })
- private boolean color = true;
-
- @Option(names = { "--debug" })
- private Integer debugPort;
-
- @Option(names = { "--device-runner-dir" })
- private File deviceRunnerDir = new File("/sdcard/dalvikrunner");
-
- @Option(names = { "--vm-arg" })
- private List<String> vmArgs = new ArrayList<String>();
-
- @Option(names = { "--java-home" })
- private File javaHome;
-
- @Option(names = { "--javac-arg" })
- private List<String> javacArgs = new ArrayList<String>();
-
- @Option(names = { "--sdk" })
- private File sdkJar = new File("/home/dalvik-prebuild/android-sdk-linux/platforms/android-2.0/android.jar");
-
- private void printUsage() {
- System.out.println("Usage: Vogar [options]... <actions>... [target args]...");
- System.out.println();
- System.out.println(" <actions>: .java files, .jar files, directories, or class names.");
- System.out.println(" These should be JUnit tests, jtreg tests, Caliper benchmarks");
- System.out.println(" or executable Java classes.");
- System.out.println();
- System.out.println(" [args]: arguments passed to the target process. This is only useful when");
- System.out.println(" the target process is a Caliper benchmark or main method.");
- System.out.println();
- System.out.println("GENERAL OPTIONS");
- System.out.println();
- System.out.println(" --mode <device|host|activity>: specify which environment to run the");
- System.out.println(" actions in. Options are on the device VM, on the host VM, and on");
- System.out.println(" device within an android.app.Activity.");
- System.out.println(" Default is: " + mode);
- System.out.println();
- System.out.println(" --clean: synonym for --clean-before and --clean-after (default).");
- System.out.println(" Disable with --no-clean if you want no files removed.");
- System.out.println();
- System.out.println(" --stream: stream output as it is emitted.");
- System.out.println();
- System.out.println(" --timeout <seconds>: maximum execution time of each action before the");
- System.out.println(" runner aborts it. Specifying zero seconds or using --debug will");
- System.out.println(" disable the execution timeout.");
- System.out.println(" Default is: " + timeoutSeconds);
- System.out.println();
- System.out.println(" --xml-reports-directory <path>: directory to emit JUnit-style");
- System.out.println(" XML test results.");
- System.out.println();
- System.out.println(" --sdk <android jar>: the API jar file to compile against.");
- System.out.println(" Usually this is <SDK>/platforms/android-<X.X>/android.jar");
- System.out.println(" where <SDK> is the path to an Android SDK path and <X.X> is");
- System.out.println(" a release version like 1.5.");
- System.out.println();
- System.out.println(" To test against APIs added since the latest SDK, use");
- System.out.println(" out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar");
- System.out.println();
- System.out.println(" Default is: " + sdkJar);
- System.out.println();
- System.out.println(" --verbose: turn on verbose output");
- System.out.println();
- System.out.println("TARGET OPTIONS");
- System.out.println();
- System.out.println(" --debug <port>: enable Java debugging on the specified port.");
- System.out.println(" This port must be free both on the device and on the local");
- System.out.println(" system. Disables the timeout specified by --timeout-seconds.");
- System.out.println();
- System.out.println(" --device-runner-dir <directory>: use the specified directory for");
- System.out.println(" on-device temporary files and code.");
- System.out.println(" Default is: " + deviceRunnerDir);
- System.out.println();
- System.out.println(" --vm-arg <argument>: include the specified argument when spawning a");
- System.out.println(" virtual machine. Examples: -Xint:fast, -ea, -Xmx16M");
- System.out.println();
- System.out.println(" --java-home <java_home>: execute the actions on the local workstation");
- System.out.println(" using the specified java home directory. This does not impact");
- System.out.println(" which javac gets used. When unset, java is used from the PATH.");
- System.out.println();
- System.out.println("EXOTIC OPTIONS");
- System.out.println();
- System.out.println(" --clean-before: remove working directories before building and");
- System.out.println(" running (default). Disable with --no-clean-before if you are");
- System.out.println(" using interactively with your own temporary input files.");
- System.out.println();
- System.out.println(" --clean-after: remove temporary files after running (default).");
- System.out.println(" Disable with --no-clean-after and use with --verbose if");
- System.out.println(" you'd like to manually re-run commands afterwards.");
- System.out.println();
- System.out.println(" --color: format output in technicolor.");
- System.out.println();
- System.out.println(" --expectations <file>: include the specified file when looking for");
- System.out.println(" action expectations. The file should include qualified action names");
- System.out.println(" and the corresponding expected output.");
- System.out.println(" Default is: " + expectationFiles);
- System.out.println();
- System.out.println(" --ident: amount to indent action result output. Can be set to ''");
- System.out.println(" (aka empty string) to simplify output parsing.");
- System.out.println(" Default is: '" + indent + "'");
- System.out.println();
- System.out.println(" --javac-arg <argument>: include the specified argument when invoking");
- System.out.println(" javac. Examples: --javac-arg -Xmaxerrs --javac-arg 1");
- System.out.println();
- System.out.println(" --monitor-timeout <seconds>: number of seconds to wait for the target");
- System.out.println(" process to launch. This can be used to prevent connection failures");
- System.out.println(" when dexopt is slow.");
- System.out.println();
- }
-
- private boolean parseArgs(String[] args) {
- List<String> actionsAndTargetArgs;
- try {
- actionsAndTargetArgs = new OptionParser(this).parse(args);
- } catch (RuntimeException e) {
- System.out.println(e.getMessage());
- return false;
- }
-
- //
- // Semantic error validation
- //
-
- boolean device;
- boolean vm;
- if (mode.equals(MODE_DEVICE)) {
- device = true;
- vm = true;
- } else if (mode.equals(MODE_HOST)) {
- device = false;
- vm = true;
- } else if (mode.equals(MODE_ACTIVITY)) {
- device = true;
- vm = false;
- } else {
- System.out.println("Unknown mode: " + mode);
- return false;
- }
-
-
- if (device) { // check device option consistency
- if (javaHome != null) {
- System.out.println("java home " + javaHome + " should not be specified for mode " + mode);
- return false;
- }
-
- } else { // check host (!device) option consistency
- if (javaHome != null && !new File(javaHome, "/bin/java").exists()) {
- System.out.println("Invalid java home: " + javaHome);
- return false;
- }
- }
-
- // check vm option consistency
- if (!vm) {
- if (!vmArgs.isEmpty()) {
- System.out.println("vm args " + vmArgs + " should not be specified for mode " + mode);
- return false;
- }
- }
-
- if (!sdkJar.exists()) {
- System.out.println("Could not find SDK jar: " + sdkJar);
- return false;
- }
-
- if (xmlReportsDirectory != null && !xmlReportsDirectory.isDirectory()) {
- System.out.println("Invalid XML reports directory: " + xmlReportsDirectory);
- return false;
- }
-
- if (!clean) {
- cleanBefore = false;
- cleanAfter = false;
- }
-
- //
- // Post-processing arguments
- //
-
- // disable timeout when debugging
- if (debugPort != null) {
- timeoutSeconds = 0;
- }
-
- // separate the actions and the target args
- int index = 0;
- for (; index < actionsAndTargetArgs.size(); index++) {
- String arg = actionsAndTargetArgs.get(index);
- if (arg.equals("--")) {
- index++;
- break;
- }
-
- File file = new File(arg);
- if (file.exists()) {
- if (arg.endsWith(".jar")) {
- classpath.addAll(file);
- } else {
- actionFiles.add(file);
- }
- } else if (CLASS_NAME_PATTERN.matcher(arg).matches()) {
- actionClasses.add(arg);
- } else {
- break;
- }
- }
-
- targetArgs.addAll(actionsAndTargetArgs.subList(index, actionsAndTargetArgs.size()));
-
- if (actionFiles.isEmpty() && actionClasses.isEmpty()) {
- System.out.println("No actions provided.");
- return false;
- }
-
- if (!targetArgs.isEmpty() && mode.equals(Options.MODE_ACTIVITY)) {
- System.out.println("Target args not supported with --mode activity");
- return false;
- }
-
- return true;
- }
- }
-
- private final Options options = new Options();
- private final File localTemp = new File("/tmp/dalvikrunner/" + UUID.randomUUID());
-
- private Vogar() {}
-
- private void run() {
- Console console = new Console(options.stream, options.indent, options.color);
- console.configureJavaLogging(options.verbose);
-
- int monitorPort;
- Mode mode;
- if (options.mode.equals(Options.MODE_DEVICE)) {
- monitorPort = 8787;
- mode = new DeviceDalvikVm(
- options.debugPort,
- options.sdkJar,
- options.javacArgs,
- monitorPort,
- localTemp,
- options.vmArgs,
- options.targetArgs,
- options.cleanBefore,
- options.cleanAfter,
- options.deviceRunnerDir,
- options.classpath);
- } else if (options.mode.equals(Options.MODE_HOST)) {
- monitorPort = 8788;
- mode = new JavaVm(
- options.debugPort,
- options.sdkJar,
- options.javacArgs,
- monitorPort,
- localTemp,
- options.javaHome,
- options.vmArgs,
- options.targetArgs,
- options.cleanBefore,
- options.cleanAfter,
- options.classpath);
- } else if (options.mode.equals(Options.MODE_ACTIVITY)) {
- monitorPort = 8787;
- mode = new ActivityMode(
- options.debugPort,
- options.sdkJar,
- options.javacArgs,
- monitorPort,
- localTemp,
- options.cleanBefore,
- options.cleanAfter,
- options.deviceRunnerDir,
- options.classpath);
- } else {
- System.out.println("Unknown mode mode " + options.mode + ".");
- return;
- }
-
- HostMonitor monitor = new HostMonitor(options.monitorTimeout);
-
- List<RunnerSpec> runnerSpecs = Arrays.asList(
- new JtregSpec(localTemp),
- new JUnitSpec(),
- new CaliperSpec(),
- new MainSpec());
-
- ExpectationStore expectationStore;
- try {
- expectationStore = ExpectationStore.parse(options.expectationFiles);
- } catch (IOException e) {
- System.out.println("Problem loading expectations: " + e);
- return;
- }
-
- XmlReportPrinter xmlReportPrinter = options.xmlReportsDirectory != null
- ? new XmlReportPrinter(options.xmlReportsDirectory, expectationStore)
- : null;
-
- Driver driver = new Driver(
- localTemp,
- mode,
- expectationStore,
- runnerSpecs,
- xmlReportPrinter,
- console,
- monitor,
- monitorPort,
- options.timeoutSeconds);
-
- driver.buildAndRun(options.actionFiles, options.actionClasses);
- }
-
- public static void main(String[] args) {
- Vogar vogar = new Vogar();
- if (!vogar.options.parseArgs(args)) {
- vogar.options.printUsage();
- return;
- }
- vogar.run();
- }
-}
diff --git a/tools/runner/java/vogar/XmlReportPrinter.java b/tools/runner/java/vogar/XmlReportPrinter.java
deleted file mode 100644
index 59db75d..0000000
--- a/tools/runner/java/vogar/XmlReportPrinter.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-import org.kxml2.io.KXmlSerializer;
-
-
-/**
- * Writes JUnit results to a series of XML files in a format consistent with
- * Ant's XMLJUnitResultFormatter.
- *
- * <p>Unlike Ant's formatter, this class does not report the execution time of
- * tests.
- *
- * TODO: unify this and com.google.coretests.XmlReportPrinter
- */
-public class XmlReportPrinter {
-
- private static final String TESTSUITE = "testsuite";
- private static final String TESTCASE = "testcase";
- private static final String ERROR = "error";
- private static final String FAILURE = "failure";
- private static final String ATTR_NAME = "name";
- private static final String ATTR_TIME = "time";
- private static final String ATTR_ERRORS = "errors";
- private static final String ATTR_FAILURES = "failures";
- private static final String ATTR_TESTS = "tests";
- private static final String ATTR_TYPE = "type";
- private static final String PROPERTIES = "properties";
- private static final String ATTR_CLASSNAME = "classname";
- private static final String TIMESTAMP = "timestamp";
- private static final String HOSTNAME = "hostname";
-
- /** the XML namespace */
- private static final String ns = null;
-
- private final File directory;
- private final ExpectationStore expectationStore;
-
- public XmlReportPrinter(File directory, ExpectationStore expectationStore) {
- this.directory = directory;
- this.expectationStore = expectationStore;
- }
-
- /**
- * Populates the directory with the report data from the completed tests.
- */
- public int generateReports(Collection<Outcome> results) {
- Map<String, Suite> suites = testsToSuites(results);
-
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
- TimeZone gmt = TimeZone.getTimeZone("GMT");
- dateFormat.setTimeZone(gmt);
- dateFormat.setLenient(true);
- String timestamp = dateFormat.format(new Date());
-
- for (Suite suite : suites.values()) {
- FileOutputStream stream = null;
- try {
- stream = new FileOutputStream(new File(directory, "TEST-" + suite.name + ".xml"));
-
- KXmlSerializer serializer = new KXmlSerializer();
- serializer.setOutput(stream, "UTF-8");
- serializer.startDocument("UTF-8", null);
- serializer.setFeature(
- "http://xmlpull.org/v1/doc/features.html#indent-output", true);
- suite.print(serializer, timestamp);
- serializer.endDocument();
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException ignored) {
- }
- }
- }
- }
-
- return suites.size();
- }
-
- private Map<String, Suite> testsToSuites(Collection<Outcome> outcomes) {
- Map<String, Suite> result = new LinkedHashMap<String, Suite>();
- for (Outcome outcome : outcomes) {
- if (outcome.getResult() == Result.UNSUPPORTED) {
- continue;
- }
-
- String suiteName = outcome.getSuiteName();
- Suite suite = result.get(suiteName);
- if (suite == null) {
- suite = new Suite(suiteName);
- result.put(suiteName, suite);
- }
-
- suite.outcomes.add(outcome);
-
- Expectation expectation = expectationStore.get(outcome);
- if (!expectation.matches(outcome)) {
- if (outcome.getResult() == Result.EXEC_FAILED) {
- suite.failuresCount++;
- } else {
- suite.errorsCount++;
- }
- }
- }
- return result;
- }
-
- class Suite {
- private final String name;
- private final List<Outcome> outcomes = new ArrayList<Outcome>();
- private int failuresCount;
- private int errorsCount;
-
- Suite(String name) {
- this.name = name;
- }
-
- void print(KXmlSerializer serializer, String timestamp) throws IOException {
- serializer.startTag(ns, TESTSUITE);
- serializer.attribute(ns, ATTR_NAME, name);
- serializer.attribute(ns, ATTR_TESTS, Integer.toString(outcomes.size()));
- serializer.attribute(ns, ATTR_FAILURES, Integer.toString(failuresCount));
- serializer.attribute(ns, ATTR_ERRORS, Integer.toString(errorsCount));
- serializer.attribute(ns, ATTR_TIME, "0");
- serializer.attribute(ns, TIMESTAMP, timestamp);
- serializer.attribute(ns, HOSTNAME, "localhost");
- serializer.startTag(ns, PROPERTIES);
- serializer.endTag(ns, PROPERTIES);
-
- for (Outcome outcome : outcomes) {
- print(serializer, outcome);
- }
-
- serializer.endTag(ns, TESTSUITE);
- }
-
- void print(KXmlSerializer serializer, Outcome outcome) throws IOException {
- serializer.startTag(ns, TESTCASE);
- serializer.attribute(ns, ATTR_NAME, outcome.getTestName());
- serializer.attribute(ns, ATTR_CLASSNAME, outcome.getSuiteName());
- serializer.attribute(ns, ATTR_TIME, "0");
-
- Expectation expectation = expectationStore.get(outcome);
- if (!expectation.matches(outcome)) {
- String result = outcome.getResult() == Result.EXEC_FAILED ? FAILURE : ERROR;
- serializer.startTag(ns, result);
- serializer.attribute(ns, ATTR_TYPE, outcome.getResult().toString());
- String text = sanitize(Strings.join(outcome.getOutputLines(), "\n"));
- serializer.text(text);
- serializer.endTag(ns, result);
- }
-
- serializer.endTag(ns, TESTCASE);
- }
-
- /**
- * Returns the text in a format that is safe for use in an XML document.
- */
- private String sanitize(String text) {
- return text.replace("\0", "<\\0>");
- }
- }
-}
diff --git a/tools/runner/java/vogar/commands/Aapt.java b/tools/runner/java/vogar/commands/Aapt.java
deleted file mode 100644
index 3778586..0000000
--- a/tools/runner/java/vogar/commands/Aapt.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.commands;
-
-import java.io.File;
-
-/**
- * An aapt (Android Asset Packaging Tool) command.
- */
-public final class Aapt {
-
- public void apk(File apk, File manifest) {
-
- // TODO: we should be able to work with a shipping SDK, not depend on out/...
- new Command.Builder()
- .args("aapt")
- .args("package")
- .args("-F")
- .args(apk)
- .args("-M")
- .args(manifest)
- .args("-I")
- .args("out/target/common/obj/APPS/framework-res_intermediates/package-export.apk")
- .execute();
- }
- public void add(File apk, File dex) {
- new Command.Builder()
- .args("aapt")
- .args("add")
- .args("-k")
- .args(apk)
- .args(dex)
- .execute();
- }
-}
diff --git a/tools/runner/java/vogar/commands/Adb.java b/tools/runner/java/vogar/commands/Adb.java
deleted file mode 100644
index fd746fa..0000000
--- a/tools/runner/java/vogar/commands/Adb.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.commands;
-
-import java.io.File;
-import java.util.List;
-import java.util.concurrent.TimeoutException;
-
-/**
- * An adb command.
- */
-public final class Adb {
-
- public void mkdir(File name) {
- new Command("adb", "shell", "mkdir", name.getPath()).execute();
- }
-
- public void rm(File name) {
- new Command("adb", "shell", "rm", "-r", name.getPath()).execute();
- }
-
- public void push(File local, File remote) {
- new Command("adb", "push", local.getPath(), remote.getPath())
- .execute();
- }
-
- public void install(File apk) {
- new Command("adb", "install", "-r", apk.getPath())
- .execute();
- }
-
- public void uninstall(String packageName) {
- new Command("adb", "uninstall", packageName)
- .execute();
- }
-
- public void forwardTcp(int localPort, int devicePort) {
- new Command("adb", "forward", "tcp:" + localPort, "tcp:" + devicePort)
- .execute();
- }
-
- public void waitForDevice() {
- new Command("adb", "wait-for-device").execute();
- }
-
- /**
- * Loop until we see a file on the device. For example, wait
- * result.txt appears.
- */
- public void waitForFile(File file, long timeoutSeconds) {
- waitFor(true, file, timeoutSeconds);
- }
-
- /**
- * Loop until we see a non-empty directory on the device. For
- * example, wait until /sdcard is mounted.
- */
- public void waitForNonEmptyDirectory(File path, long timeoutSeconds) {
- waitFor(false, path, timeoutSeconds);
- }
-
- private void waitFor(boolean file, File path, long timeoutSeconds) {
- final int millisPerSecond = 1000;
- final long start = System.currentTimeMillis();
- final long deadline = start + (millisPerSecond * timeoutSeconds);
-
- while (true) {
- final long remainingSeconds = ((deadline - System.currentTimeMillis())
- / millisPerSecond);
- String pathArgument = path.getPath();
- if (!file) {
- pathArgument += "/";
- }
- Command command = new Command("adb", "shell", "ls", pathArgument);
- List<String> output;
- try {
- output = command.executeWithTimeout(remainingSeconds);
- } catch (TimeoutException e) {
- throw new RuntimeException("Timed out after " + timeoutSeconds +
- " seconds waiting for file " + path, e);
- }
- try {
- Thread.sleep(millisPerSecond);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- if (file) {
- // for files, we expect one line of output that matches the filename
- if (output.size() == 1 && output.get(0).equals(path.getPath())) {
- return;
- }
- } else {
- // for a non empty directory, we just want any output
- if (!output.isEmpty()) {
- return;
- }
- }
- }
- }
-}
diff --git a/tools/runner/java/vogar/commands/Command.java b/tools/runner/java/vogar/commands/Command.java
deleted file mode 100644
index b861503..0000000
--- a/tools/runner/java/vogar/commands/Command.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.commands;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.logging.Logger;
-import vogar.Strings;
-import vogar.Threads;
-
-/**
- * An out of process executable.
- */
-public final class Command {
-
- private final Logger logger = Logger.getLogger(Command.class.getName());
-
- private final List<String> args;
- private final File workingDirectory;
- private final boolean permitNonZeroExitStatus;
- private final PrintStream tee;
- private volatile Process process;
-
- public Command(String... args) {
- this(Arrays.asList(args));
- }
-
- public Command(List<String> args) {
- this.args = new ArrayList<String>(args);
- this.workingDirectory = null;
- this.permitNonZeroExitStatus = false;
- this.tee = null;
- }
-
- private Command(Builder builder) {
- this.args = new ArrayList<String>(builder.args);
- this.workingDirectory = builder.workingDirectory;
- this.permitNonZeroExitStatus = builder.permitNonZeroExitStatus;
- this.tee = builder.tee;
- }
-
- public List<String> getArgs() {
- return Collections.unmodifiableList(args);
- }
-
- public void start() throws IOException {
- if (isStarted()) {
- throw new IllegalStateException("Already started!");
- }
-
- logger.fine("executing " + Strings.join(args, " "));
-
- ProcessBuilder processBuilder = new ProcessBuilder()
- .command(args)
- .redirectErrorStream(true);
- if (workingDirectory != null) {
- processBuilder.directory(workingDirectory);
- }
-
- process = processBuilder.start();
- }
-
- public boolean isStarted() {
- return process != null;
- }
-
- public List<String> gatherOutput()
- throws IOException, InterruptedException {
- if (!isStarted()) {
- throw new IllegalStateException("Not started!");
- }
-
- BufferedReader in = new BufferedReader(
- new InputStreamReader(process.getInputStream()));
- List<String> outputLines = new ArrayList<String>();
- String outputLine;
- while ((outputLine = in.readLine()) != null) {
- if (tee != null) {
- tee.println(outputLine);
- }
- outputLines.add(outputLine);
- }
-
- if (process.waitFor() != 0 && !permitNonZeroExitStatus) {
- StringBuilder message = new StringBuilder();
- for (String line : outputLines) {
- message.append("\n").append(line);
- }
- throw new CommandFailedException(args, outputLines);
- }
-
- return outputLines;
- }
-
- public List<String> execute() {
- try {
- start();
- return gatherOutput();
- } catch (IOException e) {
- throw new RuntimeException("Failed to execute process: " + args, e);
- } catch (InterruptedException e) {
- throw new RuntimeException("Interrupted while executing process: " + args, e);
- }
- }
-
- /**
- * Executes a command with a specified timeout. If the process does not
- * complete normally before the timeout has elapsed, it will be destroyed.
- *
- * @param timeoutSeconds how long to wait, or 0 to wait indefinitely
- * @return the command's output, or null if the command timed out
- */
- public List<String> executeWithTimeout(long timeoutSeconds)
- throws TimeoutException {
- if (timeoutSeconds == 0) {
- return execute();
- }
-
- try {
- return executeLater().get(timeoutSeconds, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- throw new RuntimeException("Interrupted while executing process: " + args, e);
- } catch (ExecutionException e) {
- throw new RuntimeException(e);
- } finally {
- destroy();
- }
- }
-
- /**
- * Executes the command on a new background thread. This method returns
- * immediately.
- *
- * @return a future to retrieve the command's output.
- */
- public Future<List<String>> executeLater() {
- ExecutorService executor = Executors.newFixedThreadPool(
- 1, Threads.daemonThreadFactory());
- Future<List<String>> result = executor.submit(new Callable<List<String>>() {
- public List<String> call() throws Exception {
- start();
- return gatherOutput();
- }
- });
- executor.shutdown();
- return result;
- }
-
- /**
- * Destroys the underlying process and closes its associated streams.
- */
- public void destroy() {
- if (process != null) {
- process.destroy();
- }
- }
-
- public static class Builder {
- private final List<String> args = new ArrayList<String>();
- private File workingDirectory;
- private boolean permitNonZeroExitStatus = false;
- private PrintStream tee = null;
-
- public Builder args(Object... objects) {
- for (Object object : objects) {
- args(object.toString());
- }
- return this;
- }
-
- public Builder args(String... args) {
- return args(Arrays.asList(args));
- }
-
- public Builder args(Collection<String> args) {
- this.args.addAll(args);
- return this;
- }
-
- /**
- * Sets the working directory from which the command will be executed.
- * This must be a <strong>local</strong> directory; Commands run on
- * remote devices (ie. via {@code adb shell}) require a local working
- * directory.
- */
- public Builder workingDirectory(File workingDirectory) {
- this.workingDirectory = workingDirectory;
- return this;
- }
-
- public Builder permitNonZeroExitStatus() {
- permitNonZeroExitStatus = true;
- return this;
- }
-
- public Builder tee(PrintStream printStream) {
- tee = printStream;
- return this;
- }
-
- public Command build() {
- return new Command(this);
- }
-
- public List<String> execute() {
- return build().execute();
- }
- }
-}
diff --git a/tools/runner/java/vogar/commands/CommandFailedException.java b/tools/runner/java/vogar/commands/CommandFailedException.java
deleted file mode 100644
index 8d1fa33..0000000
--- a/tools/runner/java/vogar/commands/CommandFailedException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.commands;
-
-import java.util.List;
-
-/**
- * Thrown when an out of process executable does not return normally.
- */
-public class CommandFailedException extends RuntimeException {
-
- private final List<String> args;
- private final List<String> outputLines;
-
- public CommandFailedException(List<String> args, List<String> outputLines) {
- super(formatMessage(args, outputLines));
- this.args = args;
- this.outputLines = outputLines;
- }
-
- public List<String> getArgs() {
- return args;
- }
-
- public List<String> getOutputLines() {
- return outputLines;
- }
-
- public static String formatMessage(List<String> args, List<String> outputLines) {
- StringBuilder result = new StringBuilder();
- result.append("Command failed:");
- for (String arg : args) {
- result.append(" ").append(arg);
- }
- for (String outputLine : outputLines) {
- result.append("\n ").append(outputLine);
- }
- return result.toString();
- }
-}
diff --git a/tools/runner/java/vogar/commands/Dx.java b/tools/runner/java/vogar/commands/Dx.java
deleted file mode 100644
index d2e3d00..0000000
--- a/tools/runner/java/vogar/commands/Dx.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.commands;
-
-import java.io.File;
-import java.util.logging.Logger;
-import vogar.Classpath;
-import vogar.Md5Cache;
-import vogar.Strings;
-
-/**
- * A dx command.
- */
-public final class Dx {
- private static final Logger logger = Logger.getLogger(Dx.class.getName());
- private static final Md5Cache DEX_CACHE = new Md5Cache("dex");
-
- /**
- * Converts all the .class files on 'classpath' into a dex file written to 'output'.
- */
- public void dex(File output, Classpath classpath) {
- output.getParentFile().mkdirs();
- File key = DEX_CACHE.makeKey(classpath);
- if (key != null && key.exists()) {
- logger.fine("dex cache hit for " + classpath);
- new Command.Builder().args("cp", key, output).execute();
- return;
- }
- /*
- * We pass --core-library so that we can write tests in the
- * same package they're testing, even when that's a core
- * library package. If you're actually just using this tool to
- * execute arbitrary code, this has the unfortunate
- * side-effect of preventing "dx" from protecting you from
- * yourself.
- *
- * Memory options pulled from build/core/definitions.mk to
- * handle large dx input when building dex for APK.
- */
- new Command.Builder()
- .args("dx")
- .args("-JXms16M")
- .args("-JXmx1536M")
- .args("--dex")
- .args("--output=" + output)
- .args("--core-library")
- .args(Strings.objectsToStrings(classpath.getElements()))
- .execute();
- DEX_CACHE.insert(key, output);
- }
-}
diff --git a/tools/runner/java/vogar/commands/Mkdir.java b/tools/runner/java/vogar/commands/Mkdir.java
deleted file mode 100644
index fc08f1b..0000000
--- a/tools/runner/java/vogar/commands/Mkdir.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.commands;
-
-import java.io.File;
-
-/**
- * A mkdir command.
- */
-public final class Mkdir {
-
- public void mkdirs(File directory) {
- new Command("mkdir", "-p", directory.getPath()).execute();
- }
-}
diff --git a/tools/runner/java/vogar/commands/Rm.java b/tools/runner/java/vogar/commands/Rm.java
deleted file mode 100644
index 425bb5d..0000000
--- a/tools/runner/java/vogar/commands/Rm.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.commands;
-
-import java.io.File;
-
-/**
- * A rm command.
- */
-public final class Rm {
-
- public void file(File file) {
- new Command.Builder()
- .args("rm")
- .args("-f")
- .args(file)
- .execute();
- }
-
- public void directoryTree(File directory) {
- new Command.Builder()
- .args("rm")
- .args("-rf")
- .args(directory)
- .execute();
- }
-}
diff --git a/tools/runner/java/vogar/target/CaliperRunner.java b/tools/runner/java/vogar/target/CaliperRunner.java
deleted file mode 100644
index 3336716..0000000
--- a/tools/runner/java/vogar/target/CaliperRunner.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.target;
-
-import com.google.caliper.Benchmark;
-import com.google.caliper.Runner;
-import vogar.Result;
-
-/**
- * Runs a <a href="http://code.google.com/p/caliper/">Caliper</a> benchmark.
- */
-public final class CaliperRunner implements vogar.target.Runner {
-
- private TargetMonitor monitor;
-
- public void init(TargetMonitor monitor, String actionName,
- Class<?> testClass) {
- this.monitor = monitor;
- }
-
- public void run(String actionName, Class<?> testClass, String[] args) {
- monitor.outcomeStarted(actionName, actionName);
- try {
- Runner.main(testClass.asSubclass(Benchmark.class), args);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- monitor.outcomeFinished(Result.SUCCESS);
- }
-}
diff --git a/tools/runner/java/vogar/target/JUnitRunner.java b/tools/runner/java/vogar/target/JUnitRunner.java
deleted file mode 100644
index f15cad3..0000000
--- a/tools/runner/java/vogar/target/JUnitRunner.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.target;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestResult;
-import junit.runner.BaseTestRunner;
-import junit.runner.TestSuiteLoader;
-import junit.textui.ResultPrinter;
-import vogar.Result;
-
-/**
- * Adapts a JUnit test for use by vogar.
- */
-public final class JUnitRunner implements Runner {
-
- private static final Pattern NAME_THEN_TEST_CLASS = Pattern.compile("(.*)\\(([\\w\\.$]+)\\)");
-
- private junit.textui.TestRunner testRunner;
- private Test junitTest;
-
- public void init(TargetMonitor monitor, String actionName, Class<?> testClass) {
- final TestSuiteLoader testSuiteLoader = new TestSuiteLoader() {
- public Class load(String suiteClassName) throws ClassNotFoundException {
- return JUnitRunner.class.getClassLoader().loadClass(suiteClassName);
- }
-
- public Class reload(Class c) {
- return c;
- }
- };
-
- testRunner = new junit.textui.TestRunner(
- new MonitoringResultPrinter(monitor, actionName)) {
- @Override public TestSuiteLoader getLoader() {
- return testSuiteLoader;
- }
- };
-
- this.junitTest = testRunner.getTest(testClass.getName());
- }
-
- public void run(String actionName, Class<?> testClass, String[] args) {
- testRunner.doRun(junitTest);
- }
-
- /**
- * Returns the vogar name like {@code tests.xml.DomTest#testFoo} for a test
- * with a JUnit name like {@code testFoo(tests.xml.DomTest)}.
- */
- private String getOutcomeName(Test test) {
- String testToString = test.toString();
-
- Matcher matcher = NAME_THEN_TEST_CLASS.matcher(testToString);
- if (matcher.matches()) {
- return matcher.group(2) + "#" + matcher.group(1);
- }
-
- return testToString;
- }
-
- /**
- * This result printer posts test names, output and exceptions to the
- * hosting process.
- */
- private class MonitoringResultPrinter extends ResultPrinter {
- private final TargetMonitor monitor;
- private final String actionName;
-
- private Test current;
- private Throwable failure;
-
- public MonitoringResultPrinter(TargetMonitor monitor,
- String actionName) {
- super(System.out);
- this.monitor = monitor;
- this.actionName = actionName;
- }
-
- @Override public void addError(Test test, Throwable t) {
- System.out.println(BaseTestRunner.getFilteredTrace(t));
- failure = t;
- }
-
- @Override public void addFailure(Test test, AssertionFailedError t) {
- System.out.println(BaseTestRunner.getFilteredTrace(t));
- failure = t;
- }
-
- @Override public void endTest(Test test) {
- if (current == null) {
- throw new IllegalStateException();
- }
- monitor.outcomeFinished(
- failure == null ? Result.SUCCESS : Result.EXEC_FAILED);
- current = null;
- failure = null;
- }
-
- @Override public void startTest(Test test) {
- if (current != null) {
- throw new IllegalStateException();
- }
- current = test;
- monitor.outcomeStarted(getOutcomeName(test), actionName);
- }
-
- @Override protected void printHeader(long runTime) {}
- @Override protected void printErrors(TestResult result) {}
- @Override protected void printFailures(TestResult result) {}
- @Override protected void printFooter(TestResult result) {}
- }
-}
diff --git a/tools/runner/java/vogar/target/JtregRunner.java b/tools/runner/java/vogar/target/JtregRunner.java
deleted file mode 100644
index 47090c5..0000000
--- a/tools/runner/java/vogar/target/JtregRunner.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.target;
-
-import java.lang.reflect.Method;
-import vogar.Result;
-
-/**
- * Runs a jtreg test.
- */
-public final class JtregRunner implements Runner {
-
- private Method main;
- private TargetMonitor monitor;
-
- public void init(TargetMonitor monitor, String actionName,
- Class<?> testClass) {
- this.monitor = monitor;
- try {
- main = testClass.getMethod("main", String[].class);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public void run(String actionName, Class<?> testClass, String[] args) {
- monitor.outcomeStarted(actionName, actionName);
- try {
- main.invoke(null, new Object[] { args });
- monitor.outcomeFinished(Result.SUCCESS);
- } catch (Throwable failure) {
- failure.printStackTrace();
- monitor.outcomeFinished(Result.EXEC_FAILED);
- }
- }
-}
diff --git a/tools/runner/java/vogar/target/MainRunner.java b/tools/runner/java/vogar/target/MainRunner.java
deleted file mode 100644
index d4e5dec..0000000
--- a/tools/runner/java/vogar/target/MainRunner.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.target;
-
-import java.lang.reflect.Method;
-import vogar.Result;
-
-/**
- * Runs a Java class with a main method.
- */
-public final class MainRunner implements Runner {
-
- private TargetMonitor monitor;
- private Method main;
-
- public void init(TargetMonitor monitor, String actionName,
- Class<?> testClass) {
- this.monitor = monitor;
- try {
- main = testClass.getMethod("main", String[].class);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public void run(String actionName, Class<?> testClass, String[] args) {
- monitor.outcomeStarted(actionName, actionName);
- try {
- main.invoke(null, new Object[] { args });
- } catch (Throwable ex) {
- ex.printStackTrace();
- }
- monitor.outcomeFinished(Result.SUCCESS);
- }
-}
diff --git a/tools/runner/java/vogar/target/Runner.java b/tools/runner/java/vogar/target/Runner.java
deleted file mode 100644
index a06ba1a..0000000
--- a/tools/runner/java/vogar/target/Runner.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.target;
-
-/**
- * Interface between the generic TestRunner and the more specific
- * backend implementations that know about specific types of tests.
- */
-public interface Runner {
-
- public void init(TargetMonitor monitor, String actionName,
- Class<?> testClass);
-
- public void run(String actionName, Class<?> testClass, String[] args);
-}
diff --git a/tools/runner/java/vogar/target/TargetMonitor.java b/tools/runner/java/vogar/target/TargetMonitor.java
deleted file mode 100644
index 1122caf..0000000
--- a/tools/runner/java/vogar/target/TargetMonitor.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.target;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
-import org.xmlpull.v1.XmlSerializer;
-import vogar.Result;
-
-/**
- * Accepts a connection for a host process to monitor this action.
- */
-class TargetMonitor {
-
- private static final int ACCEPT_TIMEOUT_MILLIS = 10 * 1000;
-
- private static final String ns = null; // no namespaces
- ServerSocket serverSocket;
- private Socket socket;
- private XmlSerializer serializer;
-
- public void await(int port) {
- if (socket != null) {
- throw new IllegalStateException();
- }
-
- try {
- serverSocket = new ServerSocket(port);
- serverSocket.setSoTimeout(ACCEPT_TIMEOUT_MILLIS);
- serverSocket.setReuseAddress(true);
- socket = serverSocket.accept();
-
- serializer = XmlPullParserFactory.newInstance().newSerializer();
- serializer.setOutput(socket.getOutputStream(), "UTF-8");
- serializer.startDocument("UTF-8", null);
- serializer.startTag(ns, "vogar-monitor");
- } catch (IOException e) {
- throw new RuntimeException("Failed to accept a monitor on localhost:" + port, e);
- } catch (XmlPullParserException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void outcomeStarted(String outcomeName, String actionName) {
- try {
- serializer.startTag(ns, "outcome");
- serializer.attribute(ns, "name", outcomeName);
- serializer.attribute(ns, "action", actionName);
- serializer.flush();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void output(String text) {
- try {
- serializer.text(text);
- serializer.flush();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void outcomeFinished(Result result) {
- try {
- serializer.startTag(ns, "result");
- serializer.attribute(ns, "value", result.name());
- serializer.endTag(ns, "result");
- serializer.endTag(ns, "outcome");
- serializer.flush();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void close() {
- try {
- serializer.endTag(ns, "vogar-monitor");
- serializer.endDocument();
- socket.close();
- serverSocket.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- socket = null;
- serverSocket = null;
- serializer = null;
- }
-}
diff --git a/tools/runner/java/vogar/target/TestRunner.java b/tools/runner/java/vogar/target/TestRunner.java
deleted file mode 100644
index 9419e6f..0000000
--- a/tools/runner/java/vogar/target/TestRunner.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.target;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-import java.util.Properties;
-import vogar.TestProperties;
-
-/**
- * Runs an action, in process on the target.
- */
-public class TestRunner {
-
- protected final Properties properties;
-
- protected final String qualifiedName;
- protected final Class<?> testClass;
- protected final Class<?> runnerClass;
- protected final int monitorPort;
-
- protected TestRunner() {
- properties = loadProperties();
- qualifiedName = properties.getProperty(TestProperties.QUALIFIED_NAME);
- testClass = classProperty(TestProperties.TEST_CLASS, Object.class);
- runnerClass = classProperty(TestProperties.RUNNER_CLASS, Runner.class);
- monitorPort = Integer.parseInt(properties.getProperty(TestProperties.MONITOR_PORT));
- }
-
- protected static Properties loadProperties() {
- Properties properties = new Properties();
- try {
- InputStream propertiesStream = TestRunner.class.getResourceAsStream(
- "/" + TestProperties.FILE);
- if (propertiesStream == null) {
- throw new RuntimeException(TestProperties.FILE + " missing!");
- }
- properties.load(propertiesStream);
- return properties;
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- private Class<?> classProperty(String propertyName, Class<?> superClass) {
- String className = properties.getProperty(propertyName);
- if (className == null) {
- throw new IllegalArgumentException("Could not find property for " +
- propertyName);
- }
- try {
- Class<?> klass = Class.forName(className);
- if (!superClass.isAssignableFrom(klass)) {
- throw new IllegalArgumentException(
- className + " can not be assigned to " + Runner.class);
- }
- return klass;
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void run(String... args) {
- final TargetMonitor monitor = new TargetMonitor();
- monitor.await(monitorPort);
-
- PrintStream monitorPrintStream = new PrintStream(System.out) {
- @Override public void print(String str) {
- super.print(str);
- monitor.output(str);
- }
- };
- System.setOut(monitorPrintStream);
- System.setErr(monitorPrintStream);
-
- Runner runner;
- try {
- runner = (Runner) runnerClass.newInstance();
- } catch (InstantiationException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- runner.init(monitor, qualifiedName, testClass);
- runner.run(qualifiedName, testClass, args);
-
- monitor.close();
- }
-
-
-
- public static void main(String[] args) {
- new TestRunner().run(args);
- }
-}
diff --git a/tools/runner/lib/TestActivity.java b/tools/runner/lib/TestActivity.java
deleted file mode 100644
index 6e6d09f..0000000
--- a/tools/runner/lib/TestActivity.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package vogar.target;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-import android.widget.TextView;
-import vogar.Threads;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * Runs a user-supplied {@code main(String[] args)} method
- * in the context of an Android activity. The result of the method
- * (success or exception) is reported to a file where Dalvik
- * Runner can pick it up.
- */
-public class TestActivity extends Activity {
-
- private final static String TAG = "TestActivity";
-
- private TextView view;
-
- @Override public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- this.view = new TextView(this);
- log("TestActivity starting...");
- setContentView(view);
-
- ExecutorService executor = Executors.newFixedThreadPool(
- 1, Threads.daemonThreadFactory());
- executor.submit(new Runnable() {
- public void run() {
- new TestRunner().run();
- }
- });
- executor.shutdown();
- }
-
- private void log(String message) {
- Log.i(TAG, message);
- view.append(message + "\n");
- }
-}
diff --git a/tools/runner/lib/caliper.jar b/tools/runner/lib/caliper.jar
deleted file mode 100644
index 690630e..0000000
--- a/tools/runner/lib/caliper.jar
+++ /dev/null
Binary files differ
diff --git a/tools/runner/lib/caliper.jar.txt b/tools/runner/lib/caliper.jar.txt
deleted file mode 100644
index d645695..0000000
--- a/tools/runner/lib/caliper.jar.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/tools/runner/lib/guava.jar b/tools/runner/lib/guava.jar
deleted file mode 100644
index 39adc7f..0000000
--- a/tools/runner/lib/guava.jar
+++ /dev/null
Binary files differ
diff --git a/tools/runner/lib/guava.jar.txt b/tools/runner/lib/guava.jar.txt
deleted file mode 100644
index d645695..0000000
--- a/tools/runner/lib/guava.jar.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/tools/runner/lib/javatest.jar b/tools/runner/lib/javatest.jar
deleted file mode 100644
index f550f44..0000000
--- a/tools/runner/lib/javatest.jar
+++ /dev/null
Binary files differ
diff --git a/tools/runner/lib/jh.jar b/tools/runner/lib/jh.jar
deleted file mode 100644
index e5748fb..0000000
--- a/tools/runner/lib/jh.jar
+++ /dev/null
Binary files differ
diff --git a/tools/runner/lib/jsr305.jar b/tools/runner/lib/jsr305.jar
deleted file mode 100644
index 57a62c1..0000000
--- a/tools/runner/lib/jsr305.jar
+++ /dev/null
Binary files differ
diff --git a/tools/runner/lib/jsr305.jar.txt b/tools/runner/lib/jsr305.jar.txt
deleted file mode 100644
index 6736681..0000000
--- a/tools/runner/lib/jsr305.jar.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2007-2009, JSR305 expert group
-All rights reserved.
-
-http://www.opensource.org/licenses/bsd-license.php
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of the JSR305 expert group nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
diff --git a/tools/runner/lib/jtreg.jar b/tools/runner/lib/jtreg.jar
deleted file mode 100644
index 452453a..0000000
--- a/tools/runner/lib/jtreg.jar
+++ /dev/null
Binary files differ
diff --git a/tools/runner/test-dalvik-runner.sh b/tools/runner/test-dalvik-runner.sh
deleted file mode 100755
index 287e8d9..0000000
--- a/tools/runner/test-dalvik-runner.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Test Dalvik Runner by exercising the various modes and various types of tests
-#
-# You can run this as follows
-
-# $ANDROID_BUILD_TOP/dalvik/libcore/tools/runner/test-dalvik-runner.sh
-
-modes="host device activity"
-
-# TODO: include dummy examples of each kind of 'runnable' we support,
-# for test purposes instead of relying on external paths.
-test_jtreg=/home/dalvik-prebuild/openjdk-6/jdk/test/java/util/HashMap/
-test_junit=dalvik/libcore/logging/src/test/java/org/apache/harmony/logging/tests/java/util/logging/FilterTest.java
-test_caliper=/home/bdc/benchmarks/caliper/caliper-read-only/src/examples/ArraySortBenchmark.java
-test_main=external/junit/src/junit/textui/TestRunner.java
-tests="$test_jtreg $test_junit $test_caliper $test_main"
-
-cd $ANDROID_BUILD_TOP
-. ./build/envsetup.sh
-m core-tests junit caliper snod && adb reboot bootloader && fastboot flashall && adb wait-for-device
-# when the device first comes up /sdcard is not mounted
-while [ -z "`adb shell ls /sdcard | tr -d '\r\n'`" ] ; do sleep 1; done
-mmm dalvik/libcore/tools/runner
-
-#verbose=--verbose
-#clean=--no-clean-after
-extras="$verbose $clean"
-
-dalvik_runner="java -cp out/host/linux-x86/framework/dalvik_runner.jar vogar.Vogar"
-
-for mode in $modes; do
- for test in $tests; do
- command="$dalvik_runner --mode $mode $extras $test"
- echo RUNNING $command
- $command
- done
-done
diff --git a/tools/runner/vogar b/tools/runner/vogar
deleted file mode 100755
index 470b029..0000000
--- a/tools/runner/vogar
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# m core-tests junit caliper snod && adb reboot bootloader && fastboot flashall && adb wait-for-device
-# mmm dalvik/libcore/tools/runner
-
-android_root=`dirname $0`/../../../..
-cd ${android_root}
-
-classpath=${android_root}/out/host/linux-x86/framework/dalvik_runner.jar
-exec java -cp $classpath vogar.Vogar "$@"
-