xref: /aosp_15_r20/external/autotest/docs/faft-how-to-run-doc.md (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1*9c5db199SXin Li# How to run FAFT (Fully Automated Firmware Test) {#faft-how-to-run}
2*9c5db199SXin Li
3*9c5db199SXin Li_Self-link: [go/faft-running](https://goto.google.com/faft-running)_
4*9c5db199SXin Li
5*9c5db199SXin Li[TOC]
6*9c5db199SXin Li
7*9c5db199SXin Li## FAFT Overview {#faft-overview}
8*9c5db199SXin Li
9*9c5db199SXin Li[FAFT] (Fully Automated Firmware Tests) is a collection of tests and related
10*9c5db199SXin Liinfrastructure that exercise and verify capabilities of ChromeOS.
11*9c5db199SXin LiThe features tested by FAFT are implemented through low-level software
12*9c5db199SXin Li(firmware/BIOS) and hardware. FAFT evolved from SAFT
13*9c5db199SXin Li(Semi-Automated Firmware Tests) and you can locate tests in the [FAFT suite]
14*9c5db199SXin Liin the Autotest tree as directories with the prefix `firmware_`.
15*9c5db199SXin Li
16*9c5db199SXin LiThe founding principles of FAFT are:
17*9c5db199SXin Li
18*9c5db199SXin Li- Fully automated, no human intervention required
19*9c5db199SXin Li- Real test of physical hardware, like USB plug-in, Ctrl-D key press
20*9c5db199SXin Li- High test coverage of complicated verified boot flows
21*9c5db199SXin Li- Easy to integrate with existing test infrastructure (e.g. test lab, continuous testing, etc).
22*9c5db199SXin Li
23*9c5db199SXin LiTo access some of these low-level capabilities, the tests require a
24*9c5db199SXin Li[servod] instance running and executing controls with the help of physical
25*9c5db199SXin Li[servo] board ([servo v2], [servo v4] with [servo micro] or [servo v4 Type-C])
26*9c5db199SXin Li
27*9c5db199SXin LiThe servo board is connected directly to the DUT (Device Under Test) to enable
28*9c5db199SXin Liaccess to low-level hardware interfaces, as well as staging areas for backup
29*9c5db199SXin Lisoftware (on a USB drive).
30*9c5db199SXin Li
31*9c5db199SXin LiThe [FAFT framework] runs the tests with a tool called [test that] and it is
32*9c5db199SXin Libased on a client-server architecture, where the client runs on the DUT and
33*9c5db199SXin Lithe server runs on the host machine.
34*9c5db199SXin Li
35*9c5db199SXin LiThe tests may corrupt various states in the EC, firmware, and kernel to verify
36*9c5db199SXin Lirecovery processes. In these cases you can almost always use FAFT to restore
37*9c5db199SXin Lithe system to its original state.
38*9c5db199SXin LiThe FAFT suite of tests can be invoked locally or remotely.
39*9c5db199SXin LiThis document describes how to set up the local configuration only.
40*9c5db199SXin Li
41*9c5db199SXin LiThe ChromeOS firmware controls, among other things, the initial setup of the
42*9c5db199SXin Lisystem hardware during the boot process. They are necessarily complicated,
43*9c5db199SXin Liproviding reliability against various corruption scenarios and security to
44*9c5db199SXin Liensure trusted software is controlling the system. Currently, the purpose of
45*9c5db199SXin LiFAFT is to exercise EC firmware and BIOS firmware functionality and performance.
46*9c5db199SXin Li
47*9c5db199SXin Li## Hardware Setup {#hardware-setup}
48*9c5db199SXin Li
49*9c5db199SXin Li### General requirements
50*9c5db199SXin Li
51*9c5db199SXin LiThe firmware running on the system needs to be able to deal with the
52*9c5db199SXin Lisignatures on the disks, so when testing your own local ChromeOS build
53*9c5db199SXin Lisigned with dev keys, install dev signed firmware as well.
54*9c5db199SXin Li
55*9c5db199SXin LiThe setup requires a USB drive: Pick the fastest option that you can
56*9c5db199SXin Lireasonably employ but even more than that, ensure that it's reliable!
57*9c5db199SXin LiIf the drive is quirky in manual use, FAFT will definitely be confused
58*9c5db199SXin Libecause it won't be able to deal with extraordinary circumstances.
59*9c5db199SXin Li
60*9c5db199SXin LiThe OS image installed on the USB drive MUST NOT be a recovery image. FAFT
61*9c5db199SXin Liswitches pretty often between normal and dev mode, and the transition into
62*9c5db199SXin Lidev mode is done by going through the recovery screen. With a recovery
63*9c5db199SXin Liimage present, it will do a recovery instead of going through the dev
64*9c5db199SXin Limode transition flow.
65*9c5db199SXin Li
66*9c5db199SXin LiThe OS on the USB drive and on the disk must be a test image. If not, it
67*9c5db199SXin Liwill lack important tooling for running the tests: If you see messages
68*9c5db199SXin Lithat `rsync` can't be found you're not using a test image and while
69*9c5db199SXin Lithis step will work (albeit slowly because the fallback is to scp files
70*9c5db199SXin Liindividually), running the DUT's side of the tests will fail because
71*9c5db199SXin Linon-test ChromeOS lacks a suitable python interpreter.
72*9c5db199SXin Li
73*9c5db199SXin Li### ServoV4 Type-A with Micro {#servov4-typea-micro}
74*9c5db199SXin Li
75*9c5db199SXin LiThe hardware configuration for running FAFT on a servo v4 Type-A
76*9c5db199SXin Liwith servo micro includes:
77*9c5db199SXin Li
78*9c5db199SXin Li- A test controller (your host workstation with a working chroot environment)
79*9c5db199SXin Li- The test device (a device / DUT that can boot ChromeOS)
80*9c5db199SXin Li- A servo board
81*9c5db199SXin Li- Related cables and components
82*9c5db199SXin Li    - servo-micro cable
83*9c5db199SXin Li    - USB type-A to USB micro cable for DUT connection (~ 2' in length)
84*9c5db199SXin Li    - USB type-A to USB micro cable for test controller connection (~ 4' - 6' in length)
85*9c5db199SXin Li    - Ethernet cable
86*9c5db199SXin Li    - USB drive (flashed with the appropriate OS image)
87*9c5db199SXin Li
88*9c5db199SXin LiFigure 1 shows a diagram of how to connect the latest debug boards,
89*9c5db199SXin LiservoV4 Type-A and servo micro, to the test controller, DUT, and network.
90*9c5db199SXin LiIt is important to ensure the DUT is powered off
91*9c5db199SXin Libefore plugging in cables and components to the servo.
92*9c5db199SXin Li
93*9c5db199SXin Li![Figure1](assets/faft_rc_typeA.png)
94*9c5db199SXin Li
95*9c5db199SXin Li**Figure 1.Diagram of hardware configuration for a ServoV4 Type-A with servo micro.**
96*9c5db199SXin Li
97*9c5db199SXin LiDetails of servoV4 Type-A with micro connections:
98*9c5db199SXin Li
99*9c5db199SXin Li1. Connect one end (micro USB) of the servo micro to servoV4 using a micro USB to USB cable.
100*9c5db199SXin Li2. Connect the servo micro to the debug header on the chrome device.
101*9c5db199SXin Li3. Connect the USB type A cable of the servoV4 to the DUT.
102*9c5db199SXin Li4. Prepare a USB flash drive with valid ChromeOS image and plug into the USB port of the servo as shown in the diagram.
103*9c5db199SXin Li5. Connect the micro USB port of the servo to the host machine (typically your workstation).
104*9c5db199SXin Li6. Connect an Ethernet cable to the Ethernet jack of the servo that goes to the a network reachable from the network that your host machine is on.
105*9c5db199SXin Li
106*9c5db199SXin Li### ServoV4 Type-C {#servov4-typec}
107*9c5db199SXin Li
108*9c5db199SXin LiThe hardware configuration for running FAFT with a servo v4 type-C includes:
109*9c5db199SXin Li
110*9c5db199SXin Li- A test controller (your host workstation with a working chroot environment)
111*9c5db199SXin Li- The test device (a device / DUT that can boot ChromeOS)
112*9c5db199SXin Li- A servo board
113*9c5db199SXin Li- Related cables and components
114*9c5db199SXin Li    - USB type-A to USB micro cable for test controller connection (~ 4' - 6' in length)
115*9c5db199SXin Li    - Ethernet cable
116*9c5db199SXin Li    - USB drive (flashed with the appropriate OS image)
117*9c5db199SXin Li
118*9c5db199SXin LiFigure 2 shows a diagram of how to connect a servoV4 Type-C, to the test
119*9c5db199SXin Licontroller, DUT, and network. It is important to ensure the DUT is powered off
120*9c5db199SXin Libefore plugging in cables and components to the servo and DUT.
121*9c5db199SXin Li
122*9c5db199SXin Li![Figure2](assets/faft_rc_typec.png)
123*9c5db199SXin Li
124*9c5db199SXin Li**Figure 2.Diagram of hardware configuration for a ServoV4 Type-C.**
125*9c5db199SXin Li
126*9c5db199SXin LiDetails of servoV4 Type-C connections in Figure 2:
127*9c5db199SXin Li
128*9c5db199SXin Li1. Connect the USB Type-C cable of the servoV4 to the DUT.
129*9c5db199SXin Li2. Prepare a USB flash drive with valid ChromeOS image and plug into the USB port of the servo as shown in the diagram.
130*9c5db199SXin Li3. Connect the micro USB port of the servo to the host machine (typically your workstation).
131*9c5db199SXin Li4. Connect an Ethernet cable to the Ethernet jack of the servo that goes to the a network reachable from the network that your host machine is on.
132*9c5db199SXin Li
133*9c5db199SXin Li### ServoV4 Type-C with servo micro {#servov4-typec-micro}
134*9c5db199SXin Li
135*9c5db199SXin LiMake sure to use the following servo type and configuration
136*9c5db199SXin Lifor running the faft_pd suite or the faft_cr50 suite (note: the cr50 suite
137*9c5db199SXin Lirequires special images so is not runnable outside of Google).  This setup
138*9c5db199SXin Lirequires servod to be in "DUAL_V4" mode.  You should generally only use this
139*9c5db199SXin Lisetup for faft_pd and faft_cr50, faft_ec and faft_bios do not expect servod to
140*9c5db199SXin Libe in DUAL_V4 mode.
141*9c5db199SXin Li
142*9c5db199SXin Li![Figure3](assets/faft_rc_pd_typeC.png)
143*9c5db199SXin Li
144*9c5db199SXin Li**Figure 3.Diagram of hardware configuration for a ServoV4 Type-C with servo micro.**
145*9c5db199SXin Li
146*9c5db199SXin LiDetails about FAFT PD's ServoV4 Type-C + servo micro setup (Figure 3):
147*9c5db199SXin Li
148*9c5db199SXin Li- The suite should only be run on devices released in 2019 and forward.
149*9c5db199SXin Li- The charger connected to the servo must have support for 5V, 12V, and 20V.
150*9c5db199SXin Li- The servo v4 and servo micro cable must be updated to their latest FW:
151*9c5db199SXin Li    - Servo_v4: servo_v4_v2.3.30-b35860984
152*9c5db199SXin Li    - servo micro: servo_micro_v2.3.30-b35960984
153*9c5db199SXin Li
154*9c5db199SXin LiTo check or upgrade the FW on the servo v4 and servo micro, respectively, before kicking off the FAFT PD suite:
155*9c5db199SXin Li
156*9c5db199SXin Li- Have the servo v4 connected to your workstation/labstation along with the servo micro connected to the servo.
157*9c5db199SXin Li- Run the following commands on chroot one after the other:
158*9c5db199SXin Li    - sudo servo_updater -b servo_v4
159*9c5db199SXin Li    - sudo servo_updater -b servo_micro
160*9c5db199SXin Li
161*9c5db199SXin Li### (Deprecated) ServoV2 {#servov2-deprecated}
162*9c5db199SXin Li
163*9c5db199SXin Li(Deprecated) The following photo shows the details how to connect the older,
164*9c5db199SXin Lideprecated servo v2 board to the test controller, test device, and network.
165*9c5db199SXin Li
166*9c5db199SXin Li![Figure4](assets/faft_rc_servov2_deprecated.jpg)
167*9c5db199SXin Li
168*9c5db199SXin Li**Figure 4.Diagram of hardware configuration for a ServoV2 board.**
169*9c5db199SXin Li
170*9c5db199SXin LiDetails of servo v2 connections:
171*9c5db199SXin Li
172*9c5db199SXin Li1. Connect one end(ribbon cable) of the flex cable to servoV2 and the other end to the debug header on the chrome device.
173*9c5db199SXin Li2. Connect DUT_HUB_IN(micro USB port) of the servo to the DUT.
174*9c5db199SXin Li3. Prepare a USB flash drive with valid ChromeOS image and plug into the USB port of the servo as shown in the photo.
175*9c5db199SXin Li4. Connect the micro USB port of the servo to the host machine(workstation or a labstation).
176*9c5db199SXin Li5. Connect an Ethernet cable to the Ethernet jack of the servo.
177*9c5db199SXin Li
178*9c5db199SXin Li### Installing Test Image onto USB Stick {#image-onto-usb}
179*9c5db199SXin Li
180*9c5db199SXin LiAfter the hardware components are correctly connected,
181*9c5db199SXin Liprepare and install a test Chromium OS image:
182*9c5db199SXin Li
183*9c5db199SXin Li1. Build the binary (chromiumos_test_image.bin) with build_image test, or fetch the file from a buildbot.
184*9c5db199SXin Li2. Load the test image onto a USB drive (use cros flash).
185*9c5db199SXin Li3. Insert the USB drive into the servo board, as shown in the photo.
186*9c5db199SXin Li4. Install the test image onto the internal disk by booting from the USB drive and running chromeos-install.
187*9c5db199SXin Li
188*9c5db199SXin Li## Running Tests {#faft-running-tests}
189*9c5db199SXin Li
190*9c5db199SXin LiFAFT tests are written in two different frameworks: Autotest and Tast.
191*9c5db199SXin Li
192*9c5db199SXin LiAutotest tests are run using the `test_that` command, described below. Tast tests are run using the `tast run` command, which is documented at [go/tast-running](http://chromium.googlesource.com/chromiumos/platform/tast/+/HEAD/docs/running_tests.md).
193*9c5db199SXin Li
194*9c5db199SXin Li### Setup Confirmation {#setup-confirmation}
195*9c5db199SXin Li
196*9c5db199SXin LiTo run Autotest tests, use the `test_that` tool, which does not automatically
197*9c5db199SXin Listart a `servod` process for communicating with the servo board. Running FAFT
198*9c5db199SXin Liis easiest with `servod` and `test_that` running in separate terminals inside
199*9c5db199SXin Lithe SDK, using either multiple SDK instances (`cros_sdk --enter --no-ns-pid`)
200*9c5db199SXin Lior a tool such as `screen` inside an SDK instance. Before running any tests, go
201*9c5db199SXin Liinto the chroot:
202*9c5db199SXin Li
203*9c5db199SXin Li1.  Make sure your tools are up to date.
204*9c5db199SXin Li    1.  Run `repo sync -j8`
205*9c5db199SXin Li    2.  Run `./update_chroot`
206*9c5db199SXin Li2.  (chroot 1) Run `$ sudo servod --board=$BOARD` where `$BOARD` is the code name of the board you are testing. For example: `$ sudo servod --board=eve`
207*9c5db199SXin Li3.  Go into a second chroot
208*9c5db199SXin Li4.  (chroot 2) Run the `firmware_FAFTSetup` test to verify basic functionality and ensure that your setup is correct.
209*9c5db199SXin Li5.  If test_that is in `/usr/bin`, the syntax is `$ /usr/bin/test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=$BOARD $DUT_IP firmware_FAFTSetup`
210*9c5db199SXin Li6.  Run the `firmware.Pre.normal` test to verify tast tests are working also. `tast run --var=servo=localhost:9999 $DUT_IP firmware.Pre.normal`
211*9c5db199SXin Li
212*9c5db199SXin LiYou can omit the --autotest_dir if you have built packages for the board and want to use the build version of the tests, i.e.:
213*9c5db199SXin Li
214*9c5db199SXin Li(chroot) `$ ./build_packages --board=$BOARD` where `$BOARD` is the code name of the board under test
215*9c5db199SXin Li(chroot) `$ /usr/bin/test_that --board=$BOARD $DUT_IP firmware_FAFTSetup`
216*9c5db199SXin Li
217*9c5db199SXin Li### Sample Commands {#sample-commands}
218*9c5db199SXin Li
219*9c5db199SXin LiA few sample invocations of launching Autotest tests against a DUT:
220*9c5db199SXin Li
221*9c5db199SXin LiRunning FAFT test with test case name
222*9c5db199SXin Li
223*9c5db199SXin Li- `$ /usr/bin/test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=$BOARD $DUT_IP f:.*DevMode/control`
224*9c5db199SXin Li
225*9c5db199SXin LiSome tests can be run in either normal mode or dev mode, specify the control file
226*9c5db199SXin Li
227*9c5db199SXin Li- `$ /usr/bin/test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=$BOARD $DUT_IP f:.*TryFwB/control.dev`
228*9c5db199SXin Li
229*9c5db199SXin LiFAFT can install ChromeOS image from the USB when image filename is specified
230*9c5db199SXin Li
231*9c5db199SXin Li- `$ /usr/bin/test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=$BOARD $DUT_IP --args "image=$IMAGE_FILE" f:.*RecoveryButton/control.normal`
232*9c5db199SXin Li
233*9c5db199SXin LiTo update the firmware using the shellball in the image, specify the argument firmware_update=1
234*9c5db199SXin Li
235*9c5db199SXin Li- `$ /usr/bin/test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=$BOARD $DUT_IP --args "image=$IMAGE_FILE firmware_update=1" f:.*RecoveryButton/control.normal`
236*9c5db199SXin Li
237*9c5db199SXin LiRun the entire faft_bios suite
238*9c5db199SXin Li
239*9c5db199SXin Li- `$ /usr/bin/test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=$BOARD $DUT_IP suite:faft_bios`
240*9c5db199SXin Li
241*9c5db199SXin LiRun the entire faft_ec suite
242*9c5db199SXin Li
243*9c5db199SXin Li- `$ /usr/bin/test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=$BOARD $DUT_IP suite:faft_ec`
244*9c5db199SXin Li
245*9c5db199SXin LiRun the entire faft_pd suite
246*9c5db199SXin Li
247*9c5db199SXin Li- `$ /usr/bin/test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=$BOARD $DUT_IP suite:faft_pd`
248*9c5db199SXin Li
249*9c5db199SXin LiTo run servod in a different host, specify the servo_host and servo_port arguments.
250*9c5db199SXin Li
251*9c5db199SXin Li- `$ /usr/bin/test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=$BOARD $DUT_IP --args "servo_host=$SERVO_HOST servo_port=$SERVO_PORT" suite:faft_ec`
252*9c5db199SXin Li
253*9c5db199SXin LiTo run multiple servo boards on the same servo host (labstation), use serial and port number.
254*9c5db199SXin Li
255*9c5db199SXin Li- `$ sudo servod --board=$BOARD --port $port_number --serial $servo_serial_number`
256*9c5db199SXin Li- `$ /usr/bin/test_that --autotest_dir ~/trunk/src/third_party/autotest/files/ --board=$BOARD $DUT_IP --args "servo_host=localhost servo_port=$port_number faft_iterations=5000" f:.*firmware_ConsecutiveBoot/control`
257*9c5db199SXin Li
258*9c5db199SXin Li### Running Against DUTs With Tunnelled SSH
259*9c5db199SXin Li
260*9c5db199SXin LiIf you have ssh tunnels setup for your DUT and servo host (for example, via
261*9c5db199SXin Li[SSH watcher](https://chromium.googlesource.com/chromiumos/platform/dev-util/+/HEAD/contrib/sshwatcher),
262*9c5db199SXin Lithe syntax (with the assumption that your DUT's network interface and your servo
263*9c5db199SXin Lihost's network interface is tunnelled to 2203 and servod is listening on port
264*9c5db199SXin Li9901 on your servo host) for running tests is:
265*9c5db199SXin Li
266*9c5db199SXin Li- `$ test_that localhost:2222 --args="servo_host=localhost servo_host_ssh_port=2223 servo_port=9901 use_icmp=false" $TESTS`
267*9c5db199SXin Li- `$ tast run -build=false -var=servo=127.0.0.1:9901:ssh:2223 127.0.0.1:2222  $TESTS`
268*9c5db199SXin Li
269*9c5db199SXin LiNote that for tast, you will likely need to manually start servod.  Note that
270*9c5db199SXin Lithe tast invocation is a bit unintuitive, as the servo port in the first port
271*9c5db199SXin Lireference is the real servo port on the servo host, not the redirected one,
272*9c5db199SXin Libecause TAST ssh's to the servohost and tunnels it's own port.  If you don't
273*9c5db199SXin Lineed to run commands on the servo host you can also use
274*9c5db199SXin Liservo=localhost:${LOCAL_SERVO_PORT}:nossh
275*9c5db199SXin Li
276*9c5db199SXin Li## Running FAFT on a new kernel {#faft-kernel-next}
277*9c5db199SXin Li
278*9c5db199SXin LiThe lab hosts shown in go/cros-testing-kernelnext provide a static environment
279*9c5db199SXin Lifor FAFT to be executed continuously and the recommendation is to pursue the
280*9c5db199SXin Lisustainable approach of using these DUTs for kernel-next FAFT execution.
281*9c5db199SXin Li
282*9c5db199SXin LiLocal execution via go/faft-running may be required to debug layers of
283*9c5db199SXin Liaccumulated problems in boards where end-to-end integration tests lack an
284*9c5db199SXin Lieffective continuous execution. Install a kernelnext image onto the test USB
285*9c5db199SXin Listick and ensure that a kernelnext image is also installed in the DUT prior
286*9c5db199SXin Lito running FAFT. The test_that commands to execute tests on a DUT with a
287*9c5db199SXin Likernelnext OS are the same.
288*9c5db199SXin Li
289*9c5db199SXin LiThe key point is to ensure that the USB and DUT contain a kernelnext image.
290*9c5db199SXin Li
291*9c5db199SXin Li## Frequently Asked Questions (FAQ) {#faq}
292*9c5db199SXin Li
293*9c5db199SXin LiQ: All of my FAFT tests are failing. What should I do?
294*9c5db199SXin Li
295*9c5db199SXin Li- A1: Run `firmware_FAFTSetup` as a single test. Once it fails, check the log and determine which step failed and why.
296*9c5db199SXin Li- A2: Check that the servo has all the wired connections and a USB drive with the valid OS plugged in.  A missing USB drive is guaranteed to make `firmware_FAFTSetup` fail.
297*9c5db199SXin Li
298*9c5db199SXin LiQ: A few of my FAFT tests failed, but most tests are passing. What should I do?
299*9c5db199SXin Li
300*9c5db199SXin Li- A1: Re-run the failed tests and try to isolate between flaky infrastructure, an actual firmware bug, or non-firmware bugs.
301*9c5db199SXin Li- A2: See if you were running FAFT without the AC charger connected.  The DUT's battery may have completely drained during the middle of the FAFT suite.
302*9c5db199SXin Li
303*9c5db199SXin LiQ: I still need help. Who can help me?
304*9c5db199SXin Li
305*9c5db199SXin Li- A: Try joining the [FAFT-users chromium.org mailing list](https://groups.google.com/a/chromium.org/forum/#!forum/faft-users) and asking for help. Be sure to include logs and test details in your request for help.
306*9c5db199SXin Li
307*9c5db199SXin LiQ: I got an error while running FAFT: `AutoservRunError: command execution error:  sudo -n which flash_ec` . What's wrong?
308*9c5db199SXin Li
309*9c5db199SXin Li- A: Run `sudo emerge chromeos-ec` inside your chroot.
310*9c5db199SXin Li
311*9c5db199SXin LiQ: All tests are failing to run, saying that python was not found.
312*9c5db199SXin Li   What's wrong?
313*9c5db199SXin Li
314*9c5db199SXin Li- A: This happens when the stateful partition that holds Python is wiped by a
315*9c5db199SXin Li  powerwash.
316*9c5db199SXin Li
317*9c5db199SXin Li  It is usually caused by the stateful filesystem becoming corrupted, since
318*9c5db199SXin Li  ChromeOS performs a powerwash instead of running `fsck` like a standard
319*9c5db199SXin Li  Linux distribution would.
320*9c5db199SXin Li
321*9c5db199SXin LiQ: What causes filesystem corruption?
322*9c5db199SXin Li
323*9c5db199SXin Li- A1: Most cases of corruption are triggered by a test performing an EC reset,
324*9c5db199SXin Li  because the current sync logic in Autotest doesn't fully guarantee that all
325*9c5db199SXin Li  writes have been completed, especially on USB storage devices.
326*9c5db199SXin Li
327*9c5db199SXin Li- A2: If the outer stateful partition (`/mnt/stateful_partition`) becomes full,
328*9c5db199SXin Li  the inner loop-mounted DM device (`/mnt/stateful_partition/encrypted`)
329*9c5db199SXin Li  will encounter write errors, likely corrupting the filesystem.
330*9c5db199SXin Li
331*9c5db199SXin Li  Note: Running out of space only tends to happens when running FAFT tests that
332*9c5db199SXin Li  leave the DUT running from the USB disk, and only if the image's
333*9c5db199SXin Li  [stateful partition is too small].
334*9c5db199SXin Li
335*9c5db199SXin LiQ: Can I compare the results obtained with a Type-C servo to those obtained with a Type-A servo + micro?
336*9c5db199SXin Li
337*9c5db199SXin Li- A: When running tests with a Type-C servo, it is recommended to to rerun a failure using the Type-A setup to do a fast check prior to digging deeper, i.e. before connecting a USB analyzer or probing the signals.
338*9c5db199SXin Li
339*9c5db199SXin LiQ: How can I obtain a device for a local FAFT execution?
340*9c5db199SXin Li
341*9c5db199SXin Li- A: The lab is a good source of devices for FAFT per go/cros-testing-kernelnext. If DUTs are not available or cannot be repaired by the lab team, request a DUT for development via go/hwrequest.
342*9c5db199SXin Li
343*9c5db199SXin Li\[FAFT suite\]: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/main/server/site_tests/ <br>
344*9c5db199SXin Li\[servo\]: https://chromium.googlesource.com/chromiumos/third_party/hdctools/+/refs/heads/main/README.md#Power-Measurement <br>
345*9c5db199SXin Li\[servo v2\]: https://chromium.googlesource.com/chromiumos/third_party/hdctools/+/refs/heads/main/docs/servo_v2.md <br>
346*9c5db199SXin Li\[servo v4\]: https://chromium.googlesource.com/chromiumos/third_party/hdctools/+/refs/heads/main/docs/servo_v4.md <br>
347*9c5db199SXin Li\[servo micro\]: https://chromium.googlesource.com/chromiumos/third_party/hdctools/+/refs/heads/main/docs/servo_micro.md <br>
348*9c5db199SXin Li\[servo v4 Type-C\]: https://chromium.googlesource.com/chromiumos/third_party/hdctools/+/refs/heads/main/docs/servo_v4.md#Type_C-Version <br>
349*9c5db199SXin Li\[stateful partition is too small\]: https://crrev.com/c/1935408 <br>
350*9c5db199SXin Li\[FAFT\]: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/refs/heads/main/docs/faft-design-doc.md <br>
351*9c5db199SXin Li\[FAFT framework\]: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/refs/heads/main/docs/faft-code.md <br>
352*9c5db199SXin Li\[servod\]: https://chromium.googlesource.com/chromiumos/third_party/hdctools/+/refs/heads/main/docs/servod.md <br>
353*9c5db199SXin Li\[test that\]: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/refs/heads/main/docs/test-that.md <br>
354