For Testers‎ > ‎

FAFT

FAFT (Fully Automated Firmware Tests) is a collection of tests and related infrastructure that exercise and verify capabilities of Chrome OS. The features tested by FAFT are implemented through low-level software (firmware/BIOS) and hardware. FAFT evolved from SAFT (Semi-Automated Firmware Tests) and you can locate tests in the FAFT suite in the Autotest tree as directories with the prefix firmware_. 

The founding principles of FAFT are:

  • Fully automated, no human intervention required
  • Real test of physical hardware, like USB plug-in, Ctrl-D key press
  • High test coverage of complicated verified boot flows
  • Easy to integrate with existing test infrastructure (e.g. test lab, continuous testing, etc).

To access some of these low-level capabilities, the tests require a servo board (servo v2servo v4 with servo micro or servo v4 Type-C). The servo board is connected directly to the DUT (Device Under Test) to enable access to low-level hardware interfaces, as well as staging areas for backup software (on a USB drive).  The tests may corrupt various states in the EC, firmware, and kernel to verify recovery processes. In these cases you can almost always use FAFT to restore the system to its original state.

The FAFT suite of tests can be invoked locally or remotely. This document describes how to set up the local configuration only.

The Chrome OS firmware controls, among other things, the initial setup of the system hardware during the boot process. They are necessarily complicated, providing reliability against various corruption scenarios and security to ensure trusted software is controlling the system. Currently, the purpose of FAFT is to exercise EC firmware and BIOS firmware functionality and performance.


Setting up the Hardware

The hardware configuration for running FAFT on a servo v4 Type-A with servo micro includes:
  • a test controller (your host workstation with a working chroot environment)
  • the test device (a device / DUT that can boot Chrome OS)
  • a servo board
  • related cables and components
    • servo-micro cable
    • USB type-A to USB micro cable for DUT connection (~ 2' in length)
    • USB type-A to USB micro cable for test controller connection (~ 4' - 6' in length)
    • Ethernet cable
    • USB drive (flashed with the appropriate OS image)

Figure 1 shows a diagram of how to connect the latest debug boards, servoV4 Type-A and servo micro, to the test controller, DUT, and network. It is important to ensure the DUT is powered off before plugging in cables and components to the servo. Note: Do not use a type C servo (but using a type A servo v4 with a converter to type C is fine. A pure type C setup will put the security chip into debug mode).


Figure 1. Diagram of hardware configuration for a ServoV4 Type-A with servo micro


Details of servoV4 connections:
  1. Connect one end (micro USB) of the servo micro to servoV4 using a micro USB to USB cable. Connect the servo micro to the debug header on the chrome device.
  2. Connect the USB type A cable of the servoV4 to the DUT.
  3. Prepare a USB flash drive with valid Chrome OS image and plug into the USB port of the servo as shown in the diagram.
  4. Connect the micro USB port of the servo to the host machine (typically your workstation).
  5. 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.


The hardware configuration for running FAFT with a servo v4 type-C is experimental and includes:
  • a test controller (your host workstation with a working chroot environment)
  • the test device (a device / DUT that can boot Chrome OS)
  • a servo board
  • related cables and components
    • USB type-A to USB micro cable for test controller connection (~ 4' - 6' in length)
    • Ethernet cable
    • USB drive (flashed with the appropriate OS image)

Figure 2 shows a diagram of how to connect a servoV4 Type-C, to the test controller, DUT, and network. It is important to ensure the DUT is powered off before plugging in cables and components to the servo and DUT.

Note: This configuration is in the experimental stage


Figure 2. Diagram of hardware configuration for a ServoV4 Type-C


Details of servoV4 Type-C connections in Figure 2:
  1. Connect the USB Type-C cable of the servoV4 to the DUT.
  2. Prepare a USB flash drive with valid Chrome OS image and plug into the USB port of the servo as shown in the diagram.
  3. Connect the micro USB port of the servo to the host machine (typically your workstation).
  4. 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.


The following photo shows the details how to connect the older, deprecated servo v2 board to the test controller, test device, and network.


Details of servo v2 connections:
  1. Connect one end(ribbon cable) of the flex cable to servoV2 and the other end to the debug header on the chrome device.
  2. Connect DUT_HUB_IN(micro USB port) of the servo to the DUT.
  3. Prepare a USB flash drive with valid Chrome OS image and plug into the USB port of the servo as shown in the photo.
  4. Connect the micro USB port of the servo to the host machine(workstation or a labstation).
  5. Connect an Ethernet cable to the Ethernet jack of the servo.

Setting up the USB Stick, and Confirming the Setup

After the hardware components are correctly connected, prepare and install a test Chromium OS image:

  1. Build the binary (chromiumos_test_image.bin) with build_image test, or fetch the file from a buildbot.
  2. Load the test image onto a USB drive (use cros flash).
  3. Insert the USB drive into the servo board, as shown in the photo. 
  4. Install the test image onto the internal disk by booting from the USB drive and running chromeos-install.
To run FAFT you use the test_that tool, which does not automatically start a servod process for communicating with the servo board. Before running any tests:
  1. Run $ sudo servod --board=$BOARD --no-ns-pid where $BOARD is the code name of the board you are testing. For example: $ sudo servod --board=eve 
  2. Run the firmware_FAFTSetup test to verify basic functionality and ensure that your setup is correct. If test_that is in /usr/bin, the syntax is $ /usr/bin/test_that --board=$BOARD $DUT_IP firmware_FAFTSetup

Running Tests

To run FAFT on a Chromebook:

  1. Running FAFT test with test case name
    $ /usr/bin/test_that --board=$BOARD $DUT_IP f:.*DevMode/control

  2. Some tests can be run in either normal mode or dev mode, specify the control file
    $ /usr/bin/test_that --board=$BOARD $DUT_IP f:.*TryFwB/control.dev

  3. FAFT can install Chrome OS image from the USB when image filename is specified
    $ /usr/bin/test_that --board=$BOARD $DUT_IP --args "image=$IMAGE_FILE" f:.*RecoveryButton/control.normal

  4. To update the firmware using the shellball in the image, specify the argument firmware_update=1
    $ /usr/bin/test_that --board=$BOARD $DUT_IP --args "image=$IMAGE_FILE firmware_update=1" f:.*RecoveryButton/control.normal

  5. Run the entire faft_bios suite:
    $ /usr/bin/test_that --board=$BOARD $DUT_IP suite:faft_bios

  6. Run the entire faft_ec suite
    $ /usr/bin/test_that --board=$BOARD $DUT_IP suite:faft_ec
To run servod in a different host, specify the servo_host and servo_port arguments.

    $ /usr/bin/test_that --board=$BOARD $DUT_IP --args "servo_host=$SERVO_HOST servo_port=$SERVO_PORT" suite:faft_lv1

To run multiple servo boards on the same servo host, use serial and port number.

        $ sudo servod --board=$BOARD --port $port_number --serial $servo_serial_number
    $ /usr/bin/test_that --board=$BOARD $DUT_IP --args "servo_host=localhost servo_port=$port_number faft_iterations=5000" f:.*firmware_ConsecutiveBoot/control

FAQ

Q: All of my FAFT tests are failing. What should I do?
A1: Run firmware_FAFTSetup as a single test. Once it fails, check the log and determine which step failed and why.
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.

Q: A few of my FAFT tests failed, but most tests are passing. What should I do?
A1: Re-run the failed tests and try to isolate between flaky infrastructure, an actual firmware bug, or non-firmware bugs.
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.

Q: I still need help. Who can help me?
A: Try joining the FAFT-users chromium.org mailing list and asking for help. Be sure to include logs and test details in your request for help.

Q: I got an error while running FAFT: AutoservRunError: command execution error:  sudo -n which flash_ec . What's wrong?
A: Run sudo emerge chromeos-ec inside your chroot.
Comments