1# ART chroot-based testing on a Linux VM
2
3This doc describes how to set up a Linux VM and how to run ART tests on it.
4
5## Set up the VM
6
7Use script art/build/buildbot-vm.sh. It has various commands (actions) described
8below. First, set up some environment variables used by the script (change as
9you see fit):
10```
11export ART_TEST_SSH_USER=ubuntu
12export ART_TEST_SSH_HOST=localhost
13export ART_TEST_SSH_PORT=10001
14```
15Create the VM (download it and do some initial setup):
16```
17art/tools/buildbot-vm.sh create
18```
19Boot the VM (login is `$ART_TEST_SSH_USER`, password is `ubuntu`):
20```
21art/tools/buildbot-vm.sh boot
22```
23Configure SSH (enter `yes` to add VM to `known_hosts` and then the password):
24```
25art/tools/buildbot-vm.sh setup-ssh
26```
27Now you have the shell (no need to enter password every time):
28```
29art/tools/buildbot-vm.sh connect
30```
31To power off the VM, do:
32```
33art/tools/buildbot-vm.sh quit
34```
35To speed up SSH access, set `UseDNS no` in /etc/ssh/sshd_config on the VM (and
36apply other tweaks described in https://jrs-s.net/2017/07/01/slow-ssh-logins).
37
38# Run ART tests
39```
40This is done in the same way as you would run tests in chroot on device (except
41for a few extra environment variables):
42
43export ANDROID_SERIAL=nonexistent
44export ART_TEST_SSH_USER=ubuntu
45export ART_TEST_SSH_HOST=localhost
46export ART_TEST_SSH_PORT=10001
47export ART_TEST_ON_VM=true
48
49. ./build/envsetup.sh
50lunch armv8-trunk_staging-eng  # or aosp_riscv64-trunk_staging-userdebug, etc.
51art/tools/buildbot-build.sh --target # --installclean
52
53art/tools/buildbot-cleanup-device.sh
54
55# The following two steps can be skipped for faster iteration, but it doesn't
56# always track and update dependencies correctly (e.g. if only an assembly file
57# has been modified).
58art/tools/buildbot-setup-device.sh
59art/tools/buildbot-sync.sh
60
61art/test/run-test --chroot $ART_TEST_CHROOT --64 --interpreter -O 001-HelloWorld
62art/test.py --target -r --ndebug --no-image --64 --interpreter  # specify tests
63art/tools/run-gtests.sh
64
65art/tools/buildbot-cleanup-device.sh
66```
67Both test.py and run-test scripts can be used. Tweak options as necessary.
68
69# Limitations
70
71Limitations are mostly related to the absence of system properties on the Linux.
72They are not really needed for ART tests, but they are used for test-related
73things, e.g. to find out if the tests should run in debug configuration (option
74`ro.debuggable`). Therefore debug configuration is currently broken.
75