OSDN Git Service

Remove TestRunner.success field / Make postCompileTest return void
authorBrian Carlstrom <bdc@google.com>
Wed, 10 Feb 2010 07:28:11 +0000 (23:28 -0800)
committerBrian Carlstrom <bdc@google.com>
Wed, 10 Feb 2010 18:25:49 +0000 (10:25 -0800)
commit7fbc39c5ee01b54902c37357d966faabe52d5d9f
tree2a0366c64c297e5815b999d399ba3a5793138208
parent0fe1457b8a723398f9ded90e7ba96799eeb2940c
Remove TestRunner.success field / Make postCompileTest return void

SUMMARY:
- Change TestRunner subclasses to instead implement a Runner interface
- Cleanup runtime classpath generation
- Misc improvements

DETAILS:

Change TestRunner subclasses to instead implement a Runner interface

    *Runner classes now implement the new Runner interface instead of
    extending TestRunner. prepareTest/test now take a "Class
    testClass" instead of accessing a "String testClass" from the
    superclass. This also means that all their "static void main"
    methods are removed and replaced with a single main method in
    TestRunner. TestActivity can now instantiate a TestRunner and call
    its "boolean run()" method to execute tests and retrieve their
    SUCCESS/FAILURE status via the return value, allowing the removeal
    of TestRunner.success. Mode now needs to explicitly include
    TestRunner.java in the list of code to compile because it no
    longer is implicitly found by compiling its former subclasses.

java/dalvik/runner/TestRunner.java
java/dalvik/runner/Runner.java
java/dalvik/runner/CaliperRunner.java
java/dalvik/runner/JUnitRunner.java
java/dalvik/runner/JtregRunner.java
java/dalvik/runner/MainRunner.java
java/dalvik/runner/Mode.java

    CodeFinder.getRunnerClass now returns a Runner, not a TestRunner

java/dalvik/runner/CodeFinder.java
java/dalvik/runner/JUnitFinder.java
java/dalvik/runner/CaliperFinder.java
java/dalvik/runner/JtregFinder.java
java/dalvik/runner/MainFinder.java

    Similarly, TestRun.runnerClass is now a Runner, not a TestRunner

java/dalvik/runner/TestRun.java

    Move logic to run a test based on TestProperties.RUNNER_CLASS from
    TestActivity to TestRunner since its now used in all cases, not
    just the Activity case. TestActivity.ActivityRunner remains the
    one subclass of TestRunner, accessing the TestRunner.run(...)
    logic via super.run(...), allowing it to maintain its special
    result file writing logic.

java/dalvik/runner/TestActivity.java
java/dalvik/runner/TestRunner.java

    Moved writing of TestProperties.RUNNER_CLASS from ActivityMode now
    that it is used for all Modes.

java/dalvik/runner/ActivityMode.java
java/dalvik/runner/Mode.java

    Since CaliperRunner now has a "Class testClass", it uses the more
    strongly typed Runner.main(Class<? extends Benchmark>, ...)  API.

java/dalvik/runner/CaliperRunner.java

    Fixing javadoc TestRunner->Runner
java/dalvik/runner/TestProperties.java

    Adding new Runner class to the build.

Android.mk

Cleanup runtime classpath generation

    Changed Mode.postCompileTest to return void instead of Classpath
    to match Most.postCompileTestRunner. Removed passing test
    classpath from compile to run via TestRun.testClasspath. Instead,
    Vm.getRuntimeSupportClasspath now is used to compute full
    classpath, instead of using the old TestRun.getTestClasspath in
    Mode. Mode.compileTest now uses a boolean to indicate compilation
    success, instead of null/non-null Classpath. TestRun.testClasspath
    is now replaced with TestRun.testCompiled which is used to track
    compilation success. In retrospect, it seems like using the
    absense of a Classpath as an indication of compilation
    success/failure seems like somewhat of a hack.

java/dalvik/runner/Mode.java
java/dalvik/runner/ActivityMode.java
java/dalvik/runner/DeviceDalvikVm.java
java/dalvik/runner/JavaVm.java
java/dalvik/runner/TestRun.java

    New deviceDexFile to make sure dex file name generation stays
    consistent between build time and compile time.

java/dalvik/runner/DeviceDalvikVm.java

    Changed MainRunner implementation to more closely match JtregRunner
java/dalvik/runner/MainRunner.java

Misc improvements

    Changed TestActivity to use a shutdown hook to catch when a test
    calls System.exit so we can be sure to write a result file and not
    simply wait for the timeout to catch our failure to return.

java/dalvik/runner/TestActivity.java

    Changed Mkdir.mkdirs to use new Command().execute to get automatic
    logging of command execution with --verbose

java/dalvik/runner/Mkdir.java

    Improved javadoc

java/dalvik/runner/Mode.java

    Fixed apparently misplaced @SuppressWarnings("unchecked")
java/dalvik/runner/OptionParser.java

    Enabling warnings as errors and turning on unchecked warnings.

Android.mk

    Made sure test script works with fresh device and improved logging

test-dalvik-runner.sh
24 files changed:
libcore/tools/runner/Android.mk
libcore/tools/runner/java/dalvik/runner/ActivityMode.java
libcore/tools/runner/java/dalvik/runner/CaliperFinder.java
libcore/tools/runner/java/dalvik/runner/CaliperRunner.java
libcore/tools/runner/java/dalvik/runner/CodeFinder.java
libcore/tools/runner/java/dalvik/runner/DeviceDalvikVm.java
libcore/tools/runner/java/dalvik/runner/Driver.java
libcore/tools/runner/java/dalvik/runner/JUnitFinder.java
libcore/tools/runner/java/dalvik/runner/JUnitRunner.java
libcore/tools/runner/java/dalvik/runner/JavaVm.java
libcore/tools/runner/java/dalvik/runner/JtregFinder.java
libcore/tools/runner/java/dalvik/runner/JtregRunner.java
libcore/tools/runner/java/dalvik/runner/MainFinder.java
libcore/tools/runner/java/dalvik/runner/MainRunner.java
libcore/tools/runner/java/dalvik/runner/Mkdir.java
libcore/tools/runner/java/dalvik/runner/Mode.java
libcore/tools/runner/java/dalvik/runner/OptionParser.java
libcore/tools/runner/java/dalvik/runner/Runner.java [new file with mode: 0644]
libcore/tools/runner/java/dalvik/runner/TestActivity.java
libcore/tools/runner/java/dalvik/runner/TestProperties.java
libcore/tools/runner/java/dalvik/runner/TestRun.java
libcore/tools/runner/java/dalvik/runner/TestRunner.java
libcore/tools/runner/java/dalvik/runner/Vm.java
libcore/tools/runner/test-dalvik-runner.sh