chromeos_config_boards: add puff-macrophage into scribe_boards

BUG=b:167746716
TEST=./config/refresh_generated_files

Change-Id: I1d51e24839b037b06fbc2ba15b948af8c52e1a10
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2415039
Reviewed-by: David Burger <dburger@chromium.org>
Commit-Queue: YH Lin <yueherngl@chromium.org>
Tested-by: YH Lin <yueherngl@chromium.org>
2 files changed
tree: 9adf59ba772ce8d7232c6dfa03c0de1bfff332f9
  1. .dir-locals.el
  2. .env
  3. .gitignore
  4. .style.yapf
  5. .vpython
  6. .vscode/
  7. AUTHORS
  8. LICENSE
  9. OWNERS
  10. OWNERS.au
  11. OWNERS.build
  12. OWNERS.chrome
  13. OWNERS.ci
  14. OWNERS.kernel
  15. OWNERS.testplatform
  16. PRESUBMIT.cfg
  17. PRESUBMIT.py
  18. README.chromium
  19. README.md
  20. __init__.py
  21. api/
  22. bin/
  23. cbuildbot/
  24. cidb/
  25. cli/
  26. codereview.settings
  27. config/
  28. conftest.py
  29. contrib/
  30. cros/
  31. cros_bisect/
  32. docs/
  33. infra/
  34. lib/
  35. licensing/
  36. navbar.md
  37. pylintrc
  38. pytest.ini
  39. run_pytest
  40. run_tests
  41. scripts/
  42. service/
  43. signing/
  44. ssh_keys/
  45. test/
  46. third_party/
  47. utils/
  48. venv/
README.md

Chromite Development: Starter Guide

Objective

This doc tries to give an overview and head start to anyone just starting out on Chromite development.

Background

Before you get started on Chromite, we recommend that you go through ChromeOS developer guides at external (first) and then goto/chromeos-building for internal. The Gerrit starter guide may also be helpful. You should flash a built image on a test device (Ask around for one!).

Chromite was intended to be the unified codebase for anything related to building ChromeOS/ChromiumOS. Currently, it is the codebase responsible for several things including: building the OS from the requisite packages for the necessary board (parallel_emerge), driving the infrastructure build workflow (CBuildBot), hosting a Google App Engine App, and providing utility functions for various scripts scattered around ChromeOS repositories. It is written for the most part in Python with some Bash sprinkled in.

Directory Overview

You can use Code Search to lookup things in Chromite or ChromeOS in general. You can add a ChromeOS filter to only show files from CrOS repositories by going to CS Settings and adding a new Saved query: “package:^chromeos” named “chromeos”.

chromite/api

The Chromite API for the CI system. The API exposes a subset of the chromite functionality that needs to be strictly maintained as much as possible.

chromite/cbuildbot

CBuildBot is the collection of entire code that runs on both the parent and the child build machines. It kicks off the individual stages in a particular build. It is a configurable bot that builds ChromeOS. More details on CBuildBot can be found in this tech talk (slides).

chromite/cbuildbot/builders

This folder contains configurations of the different builders in use. Each has its own set of stages to run usually called under RunStages function. Most builders used regularly are derived from SimpleBuilder class.

chromite/cbuildbot/stages

Each file here has implementations of stages in the build process grouped by similarity. Each stage usually has PerformStage as its primary function.

chromite/docs

Additional documentation.

chromite/lib

Code here is expected to be imported whenever necessary throughout Chromite.

chromite/scripts

Unlike lib, code in scripts will not and should not be imported anywhere. Instead they are executed as required in the build process. Each executable is linked to either wrapper.py or virtualenv_wrapper.py. Some of these links are in chromite/bin. The wrapper figures out the directory of the executable script and the $PYTHONPATH. Finally, it invokes the correct Python installation by moving up the directory structure to find which git repo is making the call.

chromite/service

These files act as the centralized business logic for processes, utilizing lib for the implementation details. Any process that's implemented in chromite should generally have an entry point somewhere in a service such that it can be called from a script, the API, or anywhere else in lib where the process may be useful.

chromite/third_party

This folder contains all the third_party python libraries required by Chromite. You need a very strong reason to add any library to the current list. Please confirm with the owners beforehand.

chromite/utils

This folder contains smaller, generic utility functionality that is not tied to any specific entities in the codebase that would make them more at home in a lib module.

chromite/infra

This folder contains the chromite-specific infra repos.

chromite/test

This folder contains test-only utilities and helper functions used to make writing tests in other modules easier.

chromite/*

There are smaller folders with miscellaneous functions like config, licencing, cidb, etc.

Testing your Chromite changes

Before any testing, you should check your code for lint errors with:

$ cros lint <filename>

Unit Tests

Chromite now uses pytest for running and writing unit tests. All new code & tests should be written with the expectation to be run under pytest.

Pytest is responsible for running unit tests under Python 3, with the legacy unit test runner scripts/run_tests responsible for running unit tests under Python 2.

Running Chromite's unit tests

Chromite has two unit test runners: scripts/run_pytest and scripts/run_tests, and two top-level entry points to the unit test suite: run_pytest and run_tests.

Every Python file in Chromite is accompanied by a corresponding *_unittest.py file. Running a particular file's unit tests is best done via

~/trunk/chromite $ ./run_pytest example_file_unittest.py

scripts/run_pytest

This script initializes a Python 3 virtualenv with necessary test dependencies and runs pytest inside that virtualenv over all tests in Chromite, with the configuration specified in pytest.ini. The default configuration runs tests in parallel and skips some tests known to be flaky or take a very long time.

scripts/run_tests

This script was the unit test runner prior to Chromite transitioning to using pytest. It is responsible for running unit tests under Python 2 while Chromite is in the process of migrating to Python 3. Once Chromite runs under Python 3 only, this script will be deprecated and removed.

Tests will not run in a standalone git checkout of chromite. Use the repo-based flow described above to obtain a functional-testing environment.

run_pytest

This top-level script is a convenience wrapper for scripts/run_pytest and has identical behavior.

run_tests

This top-level script runs both scripts/run_tests and scripts/run_pytest as a convenience wrapper for the full testing run done in the CQ. This script accepts no arguments, so if you want to customize test run behavior you should run one of scripts/run_pytest or scripts/run_tests directly.

Writing unit tests

As of writing this document (April 2020), Chromite is still in the process of migrating to run entirely under Python 3. New *_unittest.py files can assume that they are run on Python 3 only, but existing files must maintain backwards compatibility unless marked with a sys.version assertion at the top of the file.

Chromite‘s unit tests make use of pytest fixtures. Fixtures that are defined in a conftest.py file are visible to tests in the same directory and all child directories. If it’s unclear where a test function is getting an argument from, try searching for a fixture with that argument's name in a conftest.py file.

Be sure to consult pytest's excellent documentation for guidance on how to take advantage of the features pytest offers when writing unit tests.

Unit tests must clean up after themselves and in particular must not leak child processes after running. There is no guaranteed order in which tests are run or that tests are even run in the same process.

Pre-CQ

Once you mark your CL as Commit-Queue +1 on the Chromium Gerrit, the PreCQ will pick up your change and fire few preset config runs as a precursor to CQ.

Commit Queue

This is the final step in getting your change pushed. CQ is the most comprehensive of all tests. Once a CL is verified by CQ, it is merged into the codebase.

How does ChromeOS build work?

Refer to these talk slides on ChromeOS Build Overview.