• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:enable +full:- +full:test +full:- +full:bundles

27 At a high level, tests are organized in test cases, each test case being either
28 server or client, with one main .py file named the same as the test case, and
30 test, autotest expects tests to be placed in a monolithic file structure
33 - `/client/tests/`
34 - `/client/site_tests/`
35 - `/server/tests/`
36 - `/server/site_tests/`
38 Each test directory has to have at least a control file, but typically also has
39 a main job module (named the same as the test case). Furthermore, if it needs
45 test cases in this structure in a single large source repository as upstream
49 - Having confidential (publicly inaccessible) tests or generally per-test ACLs
51 - Storing test cases along with the project they wrap around, because the test
52 requires binaries built as a by-product of the project’s own build system.
58 which test cases require what dependencies, in addition to being able to
66 ![ebuild workflow](./assets/atest-diagram.png)
70 repository, rather from a staging read-only install location. This leads to
73 - Source may live in an arbitrary location or can be generated on the fly.
74 Anything that can be created as an ebuild (shell script) can be a test source.
75 (cros-workon may be utilised, introducing a fairly standard Chromium OS
77 - The staging location (`/build/${board}/usr/local/autotest/`) may not be
80 - Propagating source changes requires an emerge step.
85 …tion is available at http://www.chromium.org/chromium-os/how-tos-and-troubleshooting/portage-build
87 An **autotest ebuild** is an ebuild that produces test cases and installs them into
90 - Obtain the source - This is generally (but not necessarily) provided by
91 ‘cros-workon’ eclass. It could also work with the more standard tarball
93 - Prepare test cases - This includes, but is not limited to preprocessing any
96 `setup()` function of the appropriate test. Typically, this is not needed.
97 - Call autotest to "build" all sources and subsequently install them - This
99 bundles up all the necessary code to install into the intermediate location.
105 - Location variables define the paths to directories containing the test
108 - `AUTOTEST_{CLIENT,SERVER}_{TESTS,SITE_TESTS}`
109 - `AUTOTEST_{DEPS,PROFILERS,CONFIG}`
114 - List variables (`AUTOTEST_*_LIST`) define the list of deps, profilers,
116 - IUSE test list specification TESTS=, is a USE_EXPANDed specification of
132 - one ebuild with IUSE_TESTS="+tests_A +tests_B"
133 - two different ebuilds, one with IUSE_TESTS="+tests_A", the other with
143 Fundamentally, a test has two main phases:
145 - `run_*()` - This is is the main part that performs all testing and is
147 - `setup()` - This function, present in the test case’s main .py file is
148 supposed to prepare the test for running. This includes building any
152 test cases/deps involved. This is supposed to prepare everything. Typically,
153 this will invoke make on a Makefile present in the test’s src/ directory, but
156 **Note**, however, that `setup()` is implicitly called many times as test
164 in the host chroot and on the target board to properly support the test. Any
167 cross-compiled again and dynamically chosen while running on target.
171 tests are being run from the intermediate read-only location.
173 Given the above, building is as easy as **emerge**-ing the autotest ebuild that
174 contains our test.
176 $ emerge-${board} ${test_ebuild}
180 [FAQ](#Q1_What-autotest-ebuilds-are-out-there_) full list):
182 - chromeos-base/autotest-tests - The main ebuild handling most of autotest.git
184 - chromeos-base/autotest-tests-* - Various ebuilds that build other parts of
186 - chromeos-base/chromeos-chrome - chrome tests; the tests that are part of
191 Test cases built by ebuilds generally come in large bundles. Sometimes, only a
194 [USE_EXPANDed](http://devmanual.gentoo.org/general-concepts/use-flags/index.html)
198 disabled (-), specified directly in the ebuild, that can be manually overridden
201 - Non-Incremental - Simply override the default selection by an entirely new
203 test and don’t want to waste time building the others.
205 $ TESTS="test1 test2" emerge-${board} ${ebuild}
207 - Incremental - All USE_EXPAND flags are also accessible as USE flags, with
209 enable/disable tests in addition to the defaults. This can be useful if you
210 aim to enable a test that is disabled by default and want to test locally.
212 $ USE="test_to_be_enabled -test_to_be_disabled" emerge-${board} \
216 supported by portage: "tests_*" to select all tests at once (or - to
217 de-select).
219 **NOTE**: Both Incremental and Non-Incremental methods can be set/overriden by
227 [test-enabled image](#W4_Create-and-run-a-test-enabled-image-on-your-device).
231 - Run sets of tests manually - Use case: Developing test cases
233 Take your local test sources, modify them, and then attempt to run them on a
235 that the machine is imaged to a test image, and the image contains all the
238 - Verify a given image - Use case: Developing the projects subject to testing
240 Take an image, re-image the target device and run a test suite on it. This
241 requires either use of build-time autotest artifacts or their reproduction
247 …s://chromium.googlesource.com/chromiumos/third_party/autotest/+/refs/heads/main/docs/test-that.md).
249 ### Running tests in a VM - cros_run_test
253 to test using the Smoke suite.
256 [here](https://chromium.googlesource.com/chromiumos/docs/+/main/cros_vm.md#Run-an-autotest-in-the-V…
258 - `cros_run_test` starts up a VM and runs autotests using the port
259 - specified (defaults to 9222). As an example:
261 $ cros_run_test --autotest=suite:smoke \
262 --image-path=<my_image_to_start or don't set to use most recent build> \
263 --board=amd64-generic
265 - The emulator command line redirects localhost port 9222 to the emulated
267 actually listen on this port you must create & boot a test image.
268 - You can then run tests on the correct ssh port with something like
270 $ test_that --board=x86-generic localhost:9222 'f:.*platform_BootPerf/control'
272 - To set the sudo password run set_shared_user_password. Then within the
273 emulator you can press Ctrl-Alt-T to get a terminal, and sudo using this
276 $ ssh -p 9222 root@localhost
278 - Warning: After
280 'betty' is the only board regularly run through pre-CQ and CQ VMTest and so
281 is the most likely to work at ToT. 'betty' is based on 'amd64-generic',
282 so 'amd64-generic' is likely to also work for most (non-ARC) tests.
288 [autotest-results-logs](https://www.chromium.org/chromium-os/testing/test-code-labs/autotest-client
290 ### Interpreting test results
301 22:44:32 INFO | GOOD ---- Autotest.install timestamp=1263509072 localtime=Jan 14 22:44:32
303 22:44:36 INFO | START ---- ---- timestamp=1263509075 localtime=Jan 14 14:44:35
305 22:44:36 INFO | Bundling /usr/local/autotest/client/tests/sleeptest into test-sleeptest.tar.bz2
308 22:44:42 INFO | END GOOD ---- ---- timestamp=1263509082 localtime=Jan 14 14:44:42
319 This directory will contain a directory per test run. Each directory contains
320 the logs pertaining to that test run.
324 ${TEST}/debug/client.DEBUG - the most detailed output from running the
325 client-side test
329 Suites provide a mechanism to group tests together in test groups. They also
334 Please refer to the [suites documentation](https://www.chromium.org/chromium-os/testing/test-suites…
338 ### Writing a test
341 … the [Developer FAQ](http://www.chromium.org/chromium-os/testing/autotest-developer-faq#TOC-Writin…
348 For a test to be fully functional in Chromium OS, it has to be associated with
353 ### Making a new test work with ebuilds
359 - Categorisation - Grouping similar tests together, possibly with deps they
361 - Parallelisation - Multiple independent ebuilds can build entirely in
363 - Dependency tracking - Larger bundles of tests depend on more system
364 packages without proper resolution which dependency belongs to which test.
372 After choosing the proper ebuild to add your test into, the test (in the form
375 entirely. As with all USE flags, prepending it with + means the test will be
376 enabled by default, and should be the default, unless you want to keep the test
381 **chromeos-base/autotest-all** package, which is a meta-ebuild depending on all
382 autotest ebuild packages that can be built. autotest-all is used by the build
388 Autotest uses deps to provide a de-facto dependencies into the ecosystem. A dep
389 is a directory in ‘**client/deps**’ with a structure similar to a test case
390 without a control file. A test case that depends on a dep will invoke the dep’s
396 automatically detect these and make them an inter-package dependencies on the
398 [provided](#Ebuild-setup_autotest-eclass) by the same ebuild that builds test
400 the dep ebuild and the test ebuild that uses it. An **autotest-deponly**
406 - chrome_test - Intending to use any of the test binaries produced by chrome.
407 - pyauto_dep - Using pyauto for your code.
409 ### Test naming conventions
415 That convention names the directory containing the test code. It also names
416 the .py file containing the test code, and the class of the Autotest test.
418 If there's only one control file, it's named control. The test's NAME in the
422 If there are multiple control files for a test, they are named
428 ### W1. Develop and iterate on a test
433 $ export TESTS=”<the test cases to iterate on>”
434 $ EBUILD=<the ebuild that contains TEST>
439 $ cros_workon --board=${board} start ${EBUILD}
447 4. Build test (TESTS= is not necessary if you exported it before)
449 $ emerge-$board $EBUILD
451 5. Run test to make sure it works before you touch it
458 $ cros_workon --board=${board} stop ${EBUILD}
461 ### W2. Creating a test - steps and checklist
463 When creating a test, the following steps should be done/verified.
465 1. Create the actual test directory, main test files/sources, at least one
469 $ cros_workon --board=${board} start <package>
471 3. Add the new test into the IUSE_TESTS list of 9999 ebuild
474 $ TESTS=<test> emerge-$board <package>
478 $ test_that <IP> <test>
481 7. Commit test source first, when it is safely in, commit the 9999 ebuild
485 $ cros_workon --board=${board} stop <package>
489 Removing a test from one ebuild and adding to another in the same revision
490 causes portage file collisions unless counter-measures are taken. Generally,
494 1. We have ebuild **foo-0.0.1-r100** with **test** and would like to split
495 that test off into ebuild **bar-0.0.1-r1**.
497 - both ebuilds are using cros-workon (because it’s likely the case).
498 - foo is used globally (eg. autotest-all depends on it), rather than just
500 2. Remove **test** from foo-{0.0.1-r100,9999}; uprev foo-0.0.1-r100 (to -r101)
501 3. Create bar-9999 (making a copy of foo and replacing IUSE_TESTS may be a good
502 start), with IUSE_TESTS containing just the entry for **test**
503 4. Verify package dependencies of test. Make bar-9999 only depend on what is
504 needed for test, remove the dependencies from foo-9999, unless they are
506 5. Add a blocker. Since bar installs files owned by foo-0.0.1-r100 and earlier,
509 RDEPEND="!<=foo-0.0.1-r100"
512 chromeos-base/autotest-all-0.0.1
516 7. Change the dependency of foo in chromeos-base/autotest-all-0.0.1 to be
519 RDEPEND=">foo-0.0.1-r100"
521 8. Uprev (move) autotest-all-0.0.1-rX symlink by one.
524 ### W4. Create and run a test-enabled image on your device
527 which is for example "x86-generic").
531 $ ./build_packages --board=${BOARD}
533 3. Build test image.
535 $ ./build_image --board=${BOARD} test
539 currently running a previously built Chromium OS image modded for test, or
545 - If you choose to use a USB boot, you first put the image on USB and run
548 $ ./image_to_usb.sh --to /dev/sdX --board=${BOARD} \
549 --image_name=chromiumos_test_image.bin
551 - Alternatively, if you happen to already have a machine running an image
552 modified for test and you know its IP address (${REMOTE_IP}), you can
556 $ ./image_to_live.sh --remote=${REMOTE_IP} \
557 --image=`./get_latest_image.sh \
558 --board=${BOARD}`/chromiumos_test_image.bin
573 $ for dir in $(portageq-${board} envvar PORTDIR_OVERLAY); do
574 find . -name '*.ebuild' | xargs grep "inherit.*autotest" | grep "9999" | \
575 cut -f1 -d: | \
576 sed -e 's/.*\/\([^/]*\)\/\([^/]*\)\/.*\.ebuild/\1\/\2/'
582 ### Q2: I see a test of the name ‘greattests_TestsEverything’ in build output/logs/whatever! How do…
591 $ equery-$board hasuse $use_search
593 * [I-O] [ ] some_ebuild_package_name:0
598 **Alternatively**, you can run a pretended emerge (emerge -p) of all autotest
601 $ emerge -p ${all_ebuilds_from_Q1} |grep -C 10 “${use_search}”
608 (at the time of this writing) are also ‘cros-workon’, and for those, this
612 $ ebuild $(equery-$board which $ebuild_search) info
623 $ emerge-$board -pv ${ebuild_name}
627 [ebuild R ] foo-foo_version to /build/$board/ USE="autox hardened tpmtools
628 xset -buildcheck -opengles" TESTS="enabled_test1 enabled_test2 ... enabled_testN
629 -disabled_test1 ...disabled_testN" 0 kB [1]
635 $ equery-$board uses ${ebuild_name}
636 [ Legend : U - final flag setting for installation]
637 [ : I - package is installed with flag ]
639 * Found these USE flags for chromeos-base/autotest-tests-9999:
646 - - opengles : <unknown>
648 - - tests_disabled_test : <unknown>
651 ### Q5: I’m working on some test sources, how do I know which ebuilds to cros_workon start in order…
659 $ equery-$board belongs /build/${board}/usr/local/autotest/client/site_tests/foo_bar/foo_bar.py
661 chromeos-base/autotest-tests-9999 (<filename>)
664 DON’T forget to do equery-$board. Just equery will also work, only never
669 {server,client}/{test,site_tests,deps,profilers,config}), it belongs to
670 chromeos-base/autotest. Individual test case will each belong to a particular
675 ### Q6: I created a test, added it into ebuild, emerged it, and I’m getting access denied failures.…
677 Your test’s `setup()` function (which runs on the host before being uploaded) is
678 probably trying to write into the read-only intermediate location. See
679 [explanation](#Building-tests).