mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-29 22:42:10 +01:00
fixup autoupdate for new build system
- write board is to /etc/lsb-release - send board id to omaha - require board to find latest image Review URL: http://codereview.chromium.org/633001
This commit is contained in:
parent
a221aab08c
commit
7111b4f204
@ -4,24 +4,30 @@
|
|||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
# This script makes autotest client tests inside a chroot environment. The idea
|
# This script makes autotest client tests inside an Ubuntu chroot
|
||||||
# is to compile any platform-dependent autotest client tests in the build
|
# environment. The idea is to compile any platform-dependent autotest
|
||||||
# environment, since client systems under test lack the proper toolchain.
|
# client tests in the build environment, since client systems under
|
||||||
|
# test lack the proper toolchain.
|
||||||
#
|
#
|
||||||
# The user can later run autotest against an ssh enabled test client system, or
|
# The user can later run autotest against an ssh enabled test client system, or
|
||||||
# install the compiled client tests directly onto the rootfs image.
|
# install the compiled client tests directly onto the rootfs image, using
|
||||||
|
# mod_image_for_test.sh.
|
||||||
|
|
||||||
. "$(dirname "$0")/common.sh"
|
. "$(dirname "$0")/common.sh"
|
||||||
. "$(dirname $0)/autotest_lib.sh"
|
. "$(dirname "$0")/autotest_lib.sh"
|
||||||
|
|
||||||
# Script must be run inside the chroot
|
# Script must be run inside the chroot
|
||||||
assert_inside_chroot
|
assert_inside_chroot
|
||||||
|
|
||||||
DEFAULT_TESTS_LIST="all"
|
DEFAULT_CONTROL=client/site_tests/setup/control
|
||||||
|
|
||||||
DEFINE_string build "${DEFAULT_TESTS_LIST}" \
|
DEFINE_string control "${DEFAULT_CONTROL}" \
|
||||||
"a comma seperated list of autotest client tests to be prebuilt." b
|
"Setup control file -- path relative to the destination autotest directory" c
|
||||||
DEFINE_boolean prompt $FLAGS_TRUE "Prompt user when building all tests"
|
DEFINE_string board "" \
|
||||||
|
"Board name for the target you are building if using portage build system"
|
||||||
|
|
||||||
|
DEFINE_string board "" \
|
||||||
|
"The board for which you are building autotest"
|
||||||
|
|
||||||
# More useful help
|
# More useful help
|
||||||
FLAGS_HELP="usage: $0 [flags]"
|
FLAGS_HELP="usage: $0 [flags]"
|
||||||
@ -31,38 +37,43 @@ FLAGS "$@" || exit 1
|
|||||||
eval set -- "${FLAGS_ARGV}"
|
eval set -- "${FLAGS_ARGV}"
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
check_board
|
AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files"
|
||||||
|
# Destination in chroot to install autotest.
|
||||||
|
AUTOTEST_DEST="/usr/local/autotest/${FLAGS_board}"
|
||||||
|
|
||||||
# build default pre-compile client tests list.
|
# If new build system flag passed, use ebuild and exit
|
||||||
ALL_TESTS="compilebench,dbench,disktest,ltp,unixbench"
|
if [ -n "${FLAGS_board}" ]; then
|
||||||
for SITE_TEST in ../third_party/autotest/files/client/site_tests/*
|
sudo GCLIENT_ROOT="${GCLIENT_ROOT}" FLAGS_control=${FLAGS_control} \
|
||||||
do
|
"emerge-${FLAGS_board}" -a chromeos-base/autotest
|
||||||
if [ -d ${SITE_TEST} ]
|
exit 0
|
||||||
then
|
|
||||||
ALL_TESTS="${ALL_TESTS},${SITE_TEST:48}"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ${FLAGS_build} == ${DEFAULT_TESTS_LIST} ]
|
|
||||||
then
|
|
||||||
if [ ${FLAGS_prompt} -eq ${FLAGS_TRUE} ]
|
|
||||||
then
|
|
||||||
echo -n "You want to pre-build all client tests and it may take a long time"
|
|
||||||
echo " to finish. "
|
|
||||||
read -p "Are you sure you want to continue?(N/y)" answer
|
|
||||||
answer=${answer:0:1}
|
|
||||||
if [ "${answer}" != "Y" ] && [ "${answer}" != "y" ]
|
|
||||||
then
|
|
||||||
echo "Use --build to specify tests you like to pre-compile."
|
|
||||||
echo -n "E.g.: ./enter_chroot.sh \"./build_autotest.sh "
|
|
||||||
echo "--build=system_SAT\""
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
TEST_LIST=${ALL_TESTS}
|
|
||||||
else
|
|
||||||
TEST_LIST=${FLAGS_build}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GCLIENT_ROOT="${GCLIENT_ROOT}" TEST_LIST=${TEST_LIST} \
|
# Copy a local "installation" of autotest into the chroot, to avoid
|
||||||
"emerge-${FLAGS_board}" chromeos-base/autotest
|
# polluting the src dir with tmp files, results, etc.
|
||||||
|
update_chroot_autotest "${CHROOT_TRUNK_DIR}/src/third_party/autotest/files" \
|
||||||
|
"${AUTOTEST_DEST}"
|
||||||
|
|
||||||
|
# Create python package init files for top level test case dirs.
|
||||||
|
function touchInitPy() {
|
||||||
|
local dirs=${1}
|
||||||
|
for base_dir in $dirs
|
||||||
|
do
|
||||||
|
local sub_dirs="$(find ${base_dir} -maxdepth 1 -type d)"
|
||||||
|
for sub_dir in ${sub_dirs}
|
||||||
|
do
|
||||||
|
touch ${sub_dir}/__init__.py
|
||||||
|
done
|
||||||
|
touch ${base_dir}/__init__.py
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
cd ${AUTOTEST_DEST}
|
||||||
|
touchInitPy client/tests client/site_tests
|
||||||
|
touch __init__.py
|
||||||
|
|
||||||
|
# Export GCLIENT_ROOT so that tests have access to the source and build trees
|
||||||
|
export GCLIENT_ROOT
|
||||||
|
|
||||||
|
# run the magic test setup script.
|
||||||
|
echo "Building tests using ${FLAGS_control}..."
|
||||||
|
client/bin/autotest ${FLAGS_control}
|
||||||
|
|||||||
@ -10,7 +10,19 @@
|
|||||||
# The path to common.sh should be relative to your script's location.
|
# The path to common.sh should be relative to your script's location.
|
||||||
. "$(dirname "$0")/common.sh"
|
. "$(dirname "$0")/common.sh"
|
||||||
|
|
||||||
IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images"
|
DEFINE_string board "" "The name of the board to check for images."
|
||||||
|
|
||||||
|
# Parse command line flags
|
||||||
|
FLAGS "$@" || exit 1
|
||||||
|
eval set -- "${FLAGS_ARGV}"
|
||||||
|
|
||||||
|
# Check on the board that they are trying to set up.
|
||||||
|
if [ -z "$FLAGS_board" ] ; then
|
||||||
|
echo "Error: --board required."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}"
|
||||||
# Default to the most recent image
|
# Default to the most recent image
|
||||||
DEFAULT_FROM="${IMAGES_DIR}/`ls -t $IMAGES_DIR | head -1`"
|
DEFAULT_FROM="${IMAGES_DIR}/`ls -t $IMAGES_DIR | head -1`"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user