1#!/bin/bash
2#
3# Copyright 2017 Google Inc. All Rights Reserved.
4#
5# This is a generic ChromeOS package/image test setup script. It is meant to
6# be used for either the object file or package bisection tools. This script
7# is intended to be used with host object bisection, to bisect the object
8# files in a host package.  Since it deals with a host package, there is no
9# building an image or flashing a device -- just building the host package
10# itself.
11#
12# This script is intended to be used by binary_search_state.py, as
13# part of the binary search triage on ChromeOS objects and packages. It should
14# return '0' if the setup succeeds; and '1' if the setup fails (the image
15# could not build or be flashed).
16#
17
18export PYTHONUNBUFFERED=1
19
20source common/common.sh
21
22
23if [[ "${BISECT_MODE}" == "OBJECT_MODE" ]]; then
24  echo "EMERGING ${BISECT_PACKAGE}"
25  sudo -E emerge ${BISECT_PACKAGE}
26  emerge_status=$?
27
28  if [[ ${emerge_status} -ne 0 ]] ; then
29    echo "emerging ${BISECT_PACKAGE} returned a non-zero status: $emerge_status"
30    exit 1
31  fi
32
33  exit 0
34fi
35
36
37exit 0
38