flatcar-scripts/autotest_lib.sh
2010-03-23 21:16:33 -07:00

57 lines
1.5 KiB
Bash

# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Provides common commands for dealing running/building autotest
. "$(dirname "$0")/common.sh"
get_default_board
DEFINE_string board "$DEFAULT_BOARD" \
"The board for which you are building autotest"
function check_board() {
local board_names=""
local index=1
local found=0
local board_basename=$(echo "${FLAGS_board}" |cut -d '_' -f 1)
for overlay_path in "${SRC_ROOT}"/overlays/overlay-*
do
local overlay=$(basename "${overlay_path}")
local board="${overlay#overlay-}"
board_names[index]="${board}"
index+=1
if [ "${board_basename}" == "${board}" ]
then
found=1
fi
done
if [ ${found} -eq 0 ]
then
echo "You are required to specify a supported board from the command line."
echo "Supported boards are:"
for board in ${board_names[@]}
do
echo ${board}
done
exit 0
fi
}
# Populates the chroot's /usr/local/autotest/$FLAGS_board directory based on
# the given source directory.
# args:
# $1 - original source directory
# $2 - target directory
function update_chroot_autotest() {
local original=$1
local target=$2
echo "Updating chroot Autotest from ${original} to ${target}..."
sudo mkdir -p "${target}"
sudo chmod 777 "${target}"
cp -fpru ${original}/{client,conmux,server,tko,utils,global_config.ini,shadow_config.ini} ${target}
}