/art/tests are a list of officially maintained tests that used to test art (let’s focus on run-tests rather than gtests)
These tests can be run on either the host machine or the target device, can run only one or multiple ones
For example, the general workflow is
setup global environment and launch a target
. build/envsetup.sh
lunch aosp_x86-eng
build testing dependencies (e.g., installing and starting jack server, a java to dex compilation toolchain, which is deprecated, but stilled used as default toolchain of /art/test/run-test, see below)
if test on host: m test-art-host-run-test-dependencies
if test on target: m test-art-target-run-test-dependencies
run specified tests on host or target
single on host: ./art/test.py --host -r -t 001-HelloWorld
single on target: ./art/test.py --target -r -t 001-HelloWorld
all on host: ./art/test.py --host -r
all on target: ./art/test.py --target -r
/art/test.py
The topmost test scripts is /art/test.py and the invocation chain is
/art/test/testrunner/testrunner.py is used to run multiple tests
see help: ./art/test/testrunner/testrunner.py -h
/art/test/run-test builds, runs, and checks a single test's output
by default, it invokes /art/test/etc/default-build, /art/test/etc/default-run (delegating to /art/test/etc/run-test-jar), /art/test/etc/default-check to build, run, and check results of a single test, respectively
however, users can write their own build, run, or check commands by creating "build", "run", or "check" scripts under their test directories
see help: ./art/test/run-test -h
By default, /art/test/run-test compiles the java to dex using the Jack toolchain, one can configure it to use javac-dx by --build-with-javac-dx option
/art/test/etc/run-test-jar invokes /out/host/linux-x86/bin/dalvikvm if testing on host, otherwise, the art apex module on the target
libarttest
libarttest is an advanced library that is used by ART's test. This library defines advanced JNI methods that can operate ART's behavior like ensuring a method is JIT compiled before running (ensureJITCompiled()), ensuring all methods are deoptimized (deoptimizeAll()). These methods are separatedly defined in different tests and aggregated as a single libarttest library. For these methods, please check the libarttest target defined in /art/test's blueprint Android.bp.
Interesting methods include:
hasJit(): test whether JIT is enabled
getCompilerFilter(): get the compiler-filter compilation policy.
ensureJitCompiled(): ensure a method is JIT compiled
deoptimizeAll():
isAotCompiled(): whether the method is AOT compiled
isInterpreted(): is a method is running in INT mode
libarttest is always the first argument to all tests' main method. Hence, any test can run System.loadLibrary(args[0]) to load the library.
/art/tests
/art/tests
are a list of officially maintained tests that used to test art (let’s focus on run-tests rather than gtests). build/envsetup.sh
lunch aosp_x86-eng
m test-art-host-run-test-dependencies
m test-art-target-run-test-dependencies
./art/test.py --host -r -t 001-HelloWorld
./art/test.py --target -r -t 001-HelloWorld
./art/test.py --host -r
./art/test.py --target -r
/art/test.py
/art/test.py
and the invocation chain is/art/test/testrunner/testrunner.py
is used to run multiple tests./art/test/testrunner/testrunner.py -h
/art/test/run-test
builds, runs, and checks a single test's output/art/test/etc/default-build
,/art/test/etc/default-run
(delegating to/art/test/etc/run-test-jar
),/art/test/etc/default-check
to build, run, and check results of a single test, respectively./art/test/run-test -h
/art/test/run-test
compiles the java to dex using the Jack toolchain, one can configure it to use javac-dx by--build-with-javac-dx
option/art/test/etc/run-test-jar
invokes/out/host/linux-x86/bin/dalvikvm
if testing on host, otherwise, the art apex module on the targetlibarttest
libarttest
is an advanced library that is used by ART's test. This library defines advanced JNI methods that can operate ART's behavior like ensuring a method is JIT compiled before running (ensureJITCompiled()
), ensuring all methods are deoptimized (deoptimizeAll()
). These methods are separatedly defined in different tests and aggregated as a singlelibarttest
library. For these methods, please check thelibarttest
target defined in/art/test
's blueprintAndroid.bp
.Interesting methods include:
hasJit()
: test whether JIT is enabledgetCompilerFilter()
: get the compiler-filter compilation policy.ensureJitCompiled()
: ensure a method is JIT compileddeoptimizeAll()
:isAotCompiled()
: whether the method is AOT compiledisInterpreted()
: is a method is running in INT modelibarttest
is always the first argument to all tests' main method. Hence, any test can runSystem.loadLibrary(args[0])
to load the library.References