# DX Converter Test Suite

Version 1.0

Copyright © 2008 The Android Open Source Project

## Overview

This directory contains a test suite for the DX converter. It tests the capabilities of the DX converter in a black-box manner, based on the usual specifications for `.class` files. The suite does both functional and verifier tests. Regarding the latter, the DX converter has only limited bytecode verification capabilities, but the combination of DX and the Dalvik VM is supposed to perform bytecode verification equivalent to that done in other virtual machines. Please see

            docs/dalvik/java-constraints.html
            docs/dalvik/verifier.html

for further details.

## How to build

The test suite is normally included in a full build of the Android project. If it needs to be built individually, a simple

            make dx-tests

or an

            mm

in this directory will do.

## How to run

The suite can be invoked by executing

            dx-tests

from any location, assuming the suite has been built. This will run all tests. If you want to limit the suite to the test cases corresponding to a single instruction, you can specifiy the mnemonic as a parameter. For example

            dx-tests anewarray

executes the tests for the `anewarray` instruction. Please see the corresponding specification for all the mnemonics. Two additional parameters are possible that don't represent instructions. These run sanity checks for the suite itself and general verifier tests, respectively:

            dx-tests sanity
            dx-tests verifier

The suite is normally run for the fast version of the interpreter. To run it for the portable interpreter, pass `--portable` as the first parameter. Passing `--help` results in a brief overview of the options.

The suite is compatible with both emulator and simulator builds. For an emulator build, please make sure you have either an emulator running or a device attached via USB before invoking the test suite.

The suite might easily take 30 minutes or more for execution, depending on the environment. It will generate a full HTML report with details on all test cases. While running, console output is produced to give a quick impression of the progress and results. For both types of output, each individual test results falls into one of the following categories:

Type in report | Type on console | Description
--- | --- | ---
Success | . | The test case passed successfully.
Functional failure | F | A functional (normal or boundary) or an exception test case failed.
Verifier failure | V | A verifier test case failed. Either the verifier accepted some invalid piece of code or it rejected a valid one.
Warning | W | A verifier test case threw `VerifyError`, where a different VM would have thrown a different exception. This is specified Dalvik behavior, though, hence just the warning.