1#!/bin/sh
2# Copyright 2014 The Chromium OS Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6# Tests emerging all the ebuilds that use vboot_reference either as an
7# ebuild dependency or by checking out the code and compiling it in a
8# different ebuild. This is meant to be run from the chroot as part of testing
9# a new change in vboot_reference.
10
11# Required ebuilds:
12TEST_EBUILDS="
13  sys-boot/chromeos-bootimage
14  sys-boot/chromeos-u-boot
15  sys-boot/coreboot
16  sys-boot/depthcharge
17  chromeos-base/chromeos-cryptohome
18  chromeos-base/chromeos-ec
19  chromeos-base/chromeos-installer
20  chromeos-base/chromeos-initramfs
21  chromeos-base/chromeos-login
22  chromeos-base/update_engine
23  chromeos-base/vboot_reference
24  chromeos-base/verity
25"
26
27set -e
28
29# Check running inside the chroot.
30if [ ! -e /etc/cros_chroot_version ]; then
31  echo "You must run this inside the chroot." >&2
32  exit 1
33fi
34
35# Detect the target board.
36if [ "x${BOARD}" == "x" ]; then
37  if [ -e ~/trunk/src/scripts/.default_board ]; then
38    BOARD="`cat ~/trunk/src/scripts/.default_board`"
39  else
40    echo "You must pass BOARD environment variable or set a default board." >&2
41    exit 1
42  fi
43fi
44
45VBOOT_REF_DIR="$(dirname "$0")"
46echo "Running tests for board '${BOARD}' from ${VBOOT_REF_DIR}"
47
48cd "${VBOOT_REF_DIR}"
49
50echo "Running make runtests..."
51make runtests -j32
52
53echo "Removing build artifacts."
54rm -rf build build-main
55
56echo "Running emerge tests (runs cros_workon start)."
57# Ignore errors about already working on those repos.
58cros_workon-${BOARD} start ${TEST_EBUILDS} || true
59
60USE=depthcharge emerge-${BOARD} ${TEST_EBUILDS}
61