blob: 507474ea993cc58d856704cc15a1a5f5001277b7 [file] [log] [blame] [view]
Scott Grahamf94d84d2017-06-26 18:24:401# Checking out and building on Fuchsia
2
David Dorwinfe186dd2022-05-20 18:35:133***If you have followed the instructions below and are still having trouble,
4see [Contact information](README.md#contact-information).***
Scott Grahamf94d84d2017-06-26 18:24:405
Fabrice de Gans-Riberi4468e912019-08-23 23:43:546[TOC]
7
Scott Grahamf94d84d2017-06-26 18:24:408## System requirements
9
Zijie Hebd2aca072024-11-06 19:35:2710Building and running on Linux is officially supported, mac build is not. If you
11are willing to run emulator based tests locally, KVM is required. You may check
12if `/dev/kvm` exists on the system, or follow the [Enable KVM](#enable-kvm)
13section.
Scott Grahamf94d84d2017-06-26 18:24:4014
Zijie Hebd2aca072024-11-06 19:35:27151. Follow up [chromium for linux](../linux/build_instructions.md) to setup
16chromium environment.
Scott Grahamf94d84d2017-06-26 18:24:4017
Zijie Hebd2aca072024-11-06 19:35:27182. Edit your `.gclient` to add `fuchsia` to the `target_os` list. The file
Fabrice de Gansf941df7e2021-11-23 21:33:1419 should look similar to this:
20
21 ```
22 solutions = [
23 {
24 "url": "https://chromium.googlesource.com/chromium/src.git",
25 "managed": False,
26 "name": "src",
27 "custom_deps": {},
28 "custom_vars": {}
29 }
30 ]
31 target_os = ['fuchsia']
32 ```
33
342. Run `gclient sync`
Zijie Hebd2aca072024-11-06 19:35:2735
Fabrice de Gansf941df7e2021-11-23 21:33:14363. Create a build directory:
37
38 ```shell
39 $ gn gen out/fuchsia --args="is_debug=false dcheck_always_on=true is_component_build=false target_os=\"fuchsia\""
40 ```
41
Takuto Ikuta7e616372024-05-15 06:00:4242 You can add many of the usual GN arguments like `use_remoteexec = true`. In
Fabrice de Gansf941df7e2021-11-23 21:33:1443 particular, when working with devices, consider using `is_debug = false` and
44 `is_component_build = false` since debug and component builds can drastically
45 increase run time and used space.
46
Zijie Hebd2aca072024-11-06 19:35:27474. Build the target as you would for any other platform, you may specify the
48targets to build at the end of the command line:
Fabrice de Gansf941df7e2021-11-23 21:33:1449```shell
Zijie Hebd2aca072024-11-06 19:35:2750$ autoninja -C out/fuchsia
Fabrice de Gansf941df7e2021-11-23 21:33:1451```
52
Zijie Hebd2aca072024-11-06 19:35:27535. Most of the gtests based tests can be executed via
54`out/fuchsia/bin/run_***_unittests`, e.g.
Scott Grahamf94d84d2017-06-26 18:24:4055```shell
Zijie Hebd2aca072024-11-06 19:35:2756$ out/fuchsia/bin/run_base_unittests
Scott Grahamf94d84d2017-06-26 18:24:4057```
Zijie Hebd2aca072024-11-06 19:35:2758 It starts a fresh new emulator instance and executes the tests on it under
59 the hood. Also see the [Running test suites](#running-test-suites) section
60 for other types of tests.
Scott Grahamf94d84d2017-06-26 18:24:4061
Zijie Hebd2aca072024-11-06 19:35:2762## Enable KVM
Wezc03808e2018-11-06 06:27:3563Under Linux, if your host and target CPU architectures are the same (e.g. you're
64building for Fuchsia/x64 on a Linux/x64 host) then you can benefit from QEMU's
65support for the KVM hypervisor:
66
Jaeheon Yi9eaf5b522021-10-01 23:17:56671. Install the KVM module for your kernel, to get a /dev/kvm device.
682. Ensure that your system has a "kvm" group, and it owns /dev/kvm. You can do
Zijie Hebd2aca072024-11-06 19:35:2769 that by installing the QEMU system common package: `$ sudo apt-get
Jaeheon Yi9eaf5b522021-10-01 23:17:5670 install qemu-system-common`
713. Add users to the "kvm" group, and have them login again, to pick-up the new
Zijie Hebd2aca072024-11-06 19:35:2772 group.
73```shell
74$ sudo adduser <user> kvm
75$ exit [log in again]
76```
Wezc03808e2018-11-06 06:27:3577
Zijie Hebd2aca072024-11-06 19:35:2778## Running test suites
Fabrice de Gans-Ribericfa0fb7d82019-07-02 18:23:0979
Chong Guae2c09a2023-01-11 17:07:4580There are four types of tests available to run on Fuchsia:
Scott Grahamf94d84d2017-06-26 18:24:4081
Jaeheon Yi9eaf5b522021-10-01 23:17:56821. [Gtests](gtests.md)
832. [GPU integration tests](gpu_testing.md)
843. [Blink tests](web_tests.md)
Chong Guae2c09a2023-01-11 17:07:45854. [Webpage tests](webpage_tests.md)
Scott Grahamf94d84d2017-06-26 18:24:4086
Chong Gu4749ec12021-02-17 01:41:0687Check the documentations to learn more about how to run these tests.
Fabrice de Gansf941df7e2021-11-23 21:33:1488
David Dorwinbadcdae2023-02-03 04:03:1789Documentation for the underlying testing scripts work can be found
Zijie Hebd2aca072024-11-06 19:35:2790[here](test_scripts.md).