xref: /aosp_15_r20/art/test/README.chroot_vm.md (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
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```
19Install SSH keys on the VM:
20```
21art/tools/buildbot-vm.sh install-keys
22```
23Boot the VM (login is `$ART_TEST_SSH_USER`, password is `ubuntu`):
24```
25art/tools/buildbot-vm.sh boot
26```
27Now you have the shell (no need to enter password every time as we've installed
28SSH keys on the VM):
29```
30art/tools/buildbot-vm.sh connect
31```
32To power off the VM, do:
33```
34art/tools/buildbot-vm.sh quit
35```
36To speed up SSH access, set `UseDNS no` in /etc/ssh/sshd_config on the VM (and
37apply other tweaks described in https://jrs-s.net/2017/07/01/slow-ssh-logins).
38
39# Run ART tests
40```
41This is done in the same way as you would run tests in chroot on device (except
42for a few extra environment variables):
43
44export ANDROID_SERIAL=nonexistent
45export ART_TEST_SSH_USER=ubuntu
46export ART_TEST_SSH_HOST=localhost
47export ART_TEST_SSH_PORT=10001
48export ART_TEST_ON_VM=true
49
50. ./build/envsetup.sh
51lunch armv8-trunk_staging-eng  # or aosp_riscv64-trunk_staging-userdebug, etc.
52art/tools/buildbot-build.sh --target # --installclean
53
54art/tools/buildbot-cleanup-device.sh
55
56# The following two steps can be skipped for faster iteration, but it doesn't
57# always track and update dependencies correctly (e.g. if only an assembly file
58# has been modified).
59art/tools/buildbot-setup-device.sh
60art/tools/buildbot-sync.sh
61
62art/test/run-test --chroot $ART_TEST_CHROOT --64 --interpreter -O 001-HelloWorld
63art/test.py --target -r --ndebug --no-image --64 --interpreter  # specify tests
64art/tools/run-gtests.sh
65
66art/tools/buildbot-cleanup-device.sh
67```
68Both test.py and run-test scripts can be used. Tweak options as necessary.
69
70# Limitations
71
72Limitations are mostly related to the absence of system properties on the Linux.
73They are not really needed for ART tests, but they are used for test-related
74things, e.g. to find out if the tests should run in debug configuration (option
75`ro.debuggable`). Therefore debug configuration is currently broken.
76