DalvikRunner can run a test as an android.app.Activity & PathClassLoader.toString change
SUMMARY:
- PathClassLoader.toString prints path
- DalvikRunner --mode activity now working
- new DalvikRunner --no-clean vs --no-clean-after behavior
DETAILS
Dalvik runtime change
Changed PathClassLoader.toString to print the class loaders path
Also fixed variable name in commented out debug code
libcore/dalvik/src/main/java/dalvik/system/PathClassLoader.java
Dalvik Runner changes
Mode is the new abstract superclass of the existing Vm
class. ActivityMode is for the new Mode of running as a Activity
on the device. Vm is now a subclass of Mode and its JavaVm and
DeviceDalvikVm still exist although some code has been refactored
into the new Environment clases (see below)
libcore/tools/runner/java/dalvik/runner/Mode.java
libcore/tools/runner/java/dalvik/runner/ActivityMode.java
libcore/tools/runner/java/dalvik/runner/DeviceDalvikVm.java
libcore/tools/runner/java/dalvik/runner/JavaVm.java
libcore/tools/runner/java/dalvik/runner/Vm.java
Environment and its subclasses EnvironmentHost and
EnvironmentDevice allow us to reuse some common code between the
two different device modes (ActivityMode and
DeviceDalvikVm). Basically code that was more about where and how
to do things based on where the code was running as opposed to how
the code was running moved to the Environment classes. For
example, prepare() logic for /sdcard/ and ADB code in general.
libcore/tools/runner/java/dalvik/runner/DeviceDalvikVm.java
libcore/tools/runner/java/dalvik/runner/Environment.java
libcore/tools/runner/java/dalvik/runner/EnvironmentDevice.java
libcore/tools/runner/java/dalvik/runner/EnvironmentHost.java
libcore/tools/runner/java/dalvik/runner/JavaVm.java
libcore/tools/runner/java/dalvik/runner/Vm.java
Adding new files
libcore/tools/runner/Android.mk
Aapt is a wrapper for "aapt" similar to Adb and Dx
libcore/tools/runner/java/dalvik/runner/Aapt.java
Added Adb.install and Adb.uninstall methods
Changed from using File.toString to File.getPath for clarity
libcore/tools/runner/java/dalvik/runner/Adb.java
CodeFinder has been extended so that Driver can ask finders what
they need to build and run, specifically through the new
getRunnerJava and getRunnerClasspath. (As part of this
NamingPatternCodeFinder's runnerClass was changed to
getRunnerClass for consistency with the superclass.) This was
important for running as an Activity because we want to minimize
what we pack into the APK file because of the "dx --dex" runtime
and not just pull in all possible runners and supporting
libraries. TestRun objects also hold onto this information from
their finders.
libcore/tools/runner/java/dalvik/runner/Driver.java
libcore/tools/runner/java/dalvik/runner/CodeFinder.java
libcore/tools/runner/java/dalvik/runner/CaliperFinder.java
libcore/tools/runner/java/dalvik/runner/JUnitFinder.java
libcore/tools/runner/java/dalvik/runner/JtregFinder.java
libcore/tools/runner/java/dalvik/runner/MainFinder.java
libcore/tools/runner/java/dalvik/runner/NamingPatternCodeFinder.java
libcore/tools/runner/java/dalvik/runner/TestRun.java
TestRunner TestRunner's className is now testClass to clarifiy it
from the runnerClass.
libcore/tools/runner/java/dalvik/runner/TestRunner.java
libcore/tools/runner/java/dalvik/runner/CaliperRunner.java
libcore/tools/runner/java/dalvik/runner/JUnitRunner.java
libcore/tools/runner/java/dalvik/runner/JtregRunner.java
libcore/tools/runner/java/dalvik/runner/MainRunner.java
Classpath now has a Collection.of and Collection.addAll that take
a Collection<File> instead if just a File...
libcore/tools/runner/java/dalvik/runner/Classpath.java
Added Command.args(File arg) to avoid a lot of
args(file.getPath())
libcore/tools/runner/java/dalvik/runner/Command.java
Option --clean has expanded to --clean-before, --clean-after, and
--clean. Now --no-clean will remove nothing as Elliot
requested. --no-clean-after is now what is useful for
DalvikRunner debuggin. Default is still to clean before and
after.
libcore/tools/runner/java/dalvik/runner/DalvikRunner.java
Moved Vm.DALVIK_RUNNER_HOME to DalvikRunner.HOME.
/tmp/<UUID> paths are now /tmp/dalvikrunner/<UUID> paths are easier cleanup.
libcore/tools/runner/java/dalvik/runner/DalvikRunner.java
Driver was changed to use a ExecutorCompletionService around the
ExecutorService so that exceptions from the execute threads could
be reported on the main thread.
libcore/tools/runner/java/dalvik/runner/Driver.java
We now build the testrunner before the test so that its classes
will be around to be packed into APK files.
libcore/tools/runner/java/dalvik/runner/Driver.java
Dx.dex now takes File arguments instread of Strings. Dx.dex also
needs to pass additional memory arguments to not run out of memory
building the big dex for the APK. The values I used where from the
build/core/definitions.mk
libcore/tools/runner/java/dalvik/runner/Dx.java
postCompile was split into postCompileTestRunner and
postCompileTest because the packaging requires are very different
in each case for ActivityMode. Specifically, the test runner is
not post-packaged seperately, but packaged in the APK with each
test.
libcore/tools/runner/java/dalvik/runner/ActivityMode.java
libcore/tools/runner/java/dalvik/runner/DeviceDalvikVm.java
libcore/tools/runner/java/dalvik/runner/JavaVm.java
libcore/tools/runner/java/dalvik/runner/Vm.java
Changed testClass to test to avoid collision with new superclass field
libcore/tools/runner/java/dalvik/runner/JtregRunner.java
libcore/tools/runner/java/dalvik/runner/MainRunner.java
Added @SuppressWarnings("unchecked")
libcore/tools/runner/java/dalvik/runner/OptionParser.java
New android.app.Activity based on Elliot's TestAPK. It encapsulates an
ActivityRunner that invokes the appropriate TestRunner based on test.properties.
libcore/tools/runner/java/dalvik/runner/TestActivity.java
New class that shared contains (old and some new) between the
DalvikRunner and the TestRunner.
libcore/tools/runner/java/dalvik/runner/TestProperties.java
Regression test script for debugging the matrix of various
DalvikRunner modes and test types:
libcore/tools/runner/test-dalvik-runner.sh