|
Examples
example vogar commands
ActionsVogar accepts .java files, .jar files, directories, and class names as arguments to actions. It prepares the code for execution and then executes each action in its own VM. vogar dalvik/libcore/xml/src/test/java/tests/xml/DomTest.java vogar xmltests.jar tests.xml.DomTest OutputVogar is a command line application. Vogar can emit XML compatible with Ant's JUnitReport task and continuous integration tools like Hudson. Use --xml-reports-directory to specify a directory where XML files should be written. What to runJUnit testsWrite some JUnit tests. Every project includes a bunch of these. vogar <android>/dalvik/libcore/xml/src/test/java/tests/xml/DomTest.java Caliper benchmarksYou'll need a benchmark to run. Caliper includes some in its src/examples directory. Then point vogar at a benchmark. Be sure to include the --stream option, which forces output to be printed: vogar --stream <caliper>/test/examples/EnumSetContainsBenchmark.java Executable Java ProgramsVogar can run Java programs that have a public static void main(String[] args) method. vogar scratch/Main.java jtreg testsWrite or download some jtreg tests! OpenJDK includes a large suite of tests for finding bugs in core class libraries. Then point vogar at a source directory containing tests. vogar <openjdk>/test/java/util/TreeMap/ Vogar doesn't support prebuilt jtreg tests. Where to run itRunning on a local Java VMUse --mode jvm to target a JVM on the local machine. You can optionally also specify --java-home to target a specific JVM: vogar \
--mode jvm \
--java-home /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/
<actions>Running on local Harmony VMDownload and build Apache Harmony. Then run: vogar \
--mode jvm \
--java-home <harmony>/target/hdk/jdk/ \
<actions>Running on a Dalvik VMYou'll need an Android SDK and a device or emulator. If you have multiple devices, run adb devices, and set the ANDROID_SERIAL environment variable to the target's device ID. The device or emulator should be reachable via adb, so commands like adb ls should work. Make sure your PATH environment variable includes Android development tools like: adb and dx. You can enter this at the command line for one-time-use, or add it to ~/.bashrc for durable use. export PATH=<sdk>/platform-tools/:<sdk>/tools/:$PATH Specify --mode device when launching vogar: vogar \ --mode device \ <actions> If your device doesn't have an SD card, vogar can be configured to use another directory with the option --device-runner-dir /data/vogar. If you're running Caliper benchmarks, see Caliper on Android for some important gotchas. Running in an Android ActivityThis is a variant of running on a Dalvik VM, so all of its setup applies. But instead of running on a bare JVM, code run as an activity participates in the Android application lifecycle. It inherits the same environment as real Android applications. This is most useful for running code that interacts with environment facets like class loaders and system properties. vogar \ --mode activity \ <actions> More OptionsFull option descriptions are available in the online help. vogar --help |