mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-25 23:51:07 +02:00
parent
c9317eac02
commit
431a7904ef
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# Provides common commands for dealing running/building autotest
|
# Provides common commands for dealing running/building autotest
|
||||||
|
|
||||||
# Populates the chroot's /usr/local/autotest directory based on
|
# Populates the chroot's /usr/local/autotest/$FLAGS_board directory based on
|
||||||
# the given source directory.
|
# the given source directory.
|
||||||
# args:
|
# args:
|
||||||
# $1 - original source directory
|
# $1 - original source directory
|
||||||
|
@ -24,6 +24,9 @@ DEFAULT_CONTROL=client/site_tests/setup/control
|
|||||||
DEFINE_string control "${DEFAULT_CONTROL}" \
|
DEFINE_string control "${DEFAULT_CONTROL}" \
|
||||||
"Setup control file -- path relative to the destination autotest directory" c
|
"Setup control file -- path relative to the destination autotest directory" c
|
||||||
|
|
||||||
|
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]"
|
||||||
|
|
||||||
@ -34,7 +37,7 @@ set -e
|
|||||||
|
|
||||||
AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files"
|
AUTOTEST_SRC="${GCLIENT_ROOT}/src/third_party/autotest/files"
|
||||||
# Destination in chroot to install autotest.
|
# Destination in chroot to install autotest.
|
||||||
AUTOTEST_DEST="/usr/local/autotest"
|
AUTOTEST_DEST="/usr/local/autotest/${FLAGS_board}"
|
||||||
|
|
||||||
# Copy a local "installation" of autotest into the chroot, to avoid
|
# Copy a local "installation" of autotest into the chroot, to avoid
|
||||||
# polluting the src dir with tmp files, results, etc.
|
# polluting the src dir with tmp files, results, etc.
|
||||||
|
@ -10,29 +10,12 @@
|
|||||||
# 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"
|
|
||||||
# Default to the most recent image
|
|
||||||
DEFAULT_FROM="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)"
|
|
||||||
|
|
||||||
# Script can be run either inside or outside the chroot.
|
|
||||||
if [ $INSIDE_CHROOT -eq 1 ]
|
|
||||||
then
|
|
||||||
# Inside the chroot, so output to usb.img in the same dir as the other
|
|
||||||
# images.
|
|
||||||
DEFAULT_TO="${DEFAULT_FROM}/usb.img"
|
|
||||||
DEFAULT_TO_HELP="Destination file for USB image."
|
|
||||||
AUTOTEST_SRC=/usr/local/autotest
|
|
||||||
else
|
|
||||||
# Outside the chroot, so output to the default device for a usb key.
|
|
||||||
DEFAULT_TO="/dev/sdb"
|
|
||||||
DEFAULT_TO_HELP="Destination device for USB keyfob."
|
|
||||||
AUTOTEST_SRC=${DEFAULT_CHROOT_DIR}/usr/local/autotest
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
DEFINE_string from "$DEFAULT_FROM" \
|
DEFINE_string board "" "Board for which the image was built"
|
||||||
|
DEFINE_string from "" \
|
||||||
"Directory containing rootfs.image and mbr.image"
|
"Directory containing rootfs.image and mbr.image"
|
||||||
DEFINE_string to "$DEFAULT_TO" "$DEFAULT_TO_HELP"
|
DEFINE_string to "" "$DEFAULT_TO_HELP"
|
||||||
DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" "y"
|
DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" "y"
|
||||||
DEFINE_boolean install_autotest $FLAGS_FALSE \
|
DEFINE_boolean install_autotest $FLAGS_FALSE \
|
||||||
"Whether to install autotest to the stateful partition."
|
"Whether to install autotest to the stateful partition."
|
||||||
@ -41,9 +24,38 @@ DEFINE_boolean install_autotest $FLAGS_FALSE \
|
|||||||
FLAGS "$@" || exit 1
|
FLAGS "$@" || exit 1
|
||||||
eval set -- "${FLAGS_ARGV}"
|
eval set -- "${FLAGS_ARGV}"
|
||||||
|
|
||||||
|
# Inside the chroot, so output to usb.img in the same dir as the other
|
||||||
|
# Script can be run either inside or outside the chroot.
|
||||||
|
if [ $INSIDE_CHROOT -eq 1 ]
|
||||||
|
then
|
||||||
|
AUTOTEST_SRC="/usr/local/autotest/${FLAGS_board}"
|
||||||
|
else
|
||||||
|
AUTOTEST_SRC="${DEFAULT_CHROOT_DIR}/usr/local/autotest/${FLAGS_board}"
|
||||||
|
fi
|
||||||
|
|
||||||
# Die on any errors.
|
# Die on any errors.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# If from isn't explicitly set
|
||||||
|
if [ -z "$FLAGS_from" ]; then
|
||||||
|
IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}"
|
||||||
|
FLAGS_from="${IMAGES_DIR}/$(ls -t $IMAGES_DIR 2>&-| head -1)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If to isn't explicitly set
|
||||||
|
if [ -z "$FLAGS_to" ]; then
|
||||||
|
# Script can be run either inside or outside the chroot.
|
||||||
|
if [ $INSIDE_CHROOT -eq 1 ]
|
||||||
|
then
|
||||||
|
# Inside the chroot, so output to usb.img in the same dir as the other
|
||||||
|
# images.
|
||||||
|
FLAGS_to="${FLAGS_from}/usb.img"
|
||||||
|
else
|
||||||
|
# Outside the chroot, so output to the default device for a usb key.
|
||||||
|
FLAGS_to="/dev/sdb"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Convert args to paths. Need eval to un-quote the string so that shell
|
# Convert args to paths. Need eval to un-quote the string so that shell
|
||||||
# chars like ~ are processed; just doing FOO=`readlink -f $FOO` won't work.
|
# chars like ~ are processed; just doing FOO=`readlink -f $FOO` won't work.
|
||||||
FLAGS_from=`eval readlink -f $FLAGS_from`
|
FLAGS_from=`eval readlink -f $FLAGS_from`
|
||||||
|
@ -24,6 +24,7 @@ DEFINE_string machine_desc "" "Machine description used in database"
|
|||||||
DEFINE_string build_desc "" "Build description used in database"
|
DEFINE_string build_desc "" "Build description used in database"
|
||||||
DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c
|
DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c
|
||||||
DEFINE_string results_dir_root "" "alternate root results directory"
|
DEFINE_string results_dir_root "" "alternate root results directory"
|
||||||
|
DEFINE_string board "" "Desired board you are running the test against"
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then
|
if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then
|
||||||
@ -115,7 +116,7 @@ function main() {
|
|||||||
# is just modifying scripts, they take effect without having to wait
|
# is just modifying scripts, they take effect without having to wait
|
||||||
# for the laborious build_autotest.sh command.
|
# for the laborious build_autotest.sh command.
|
||||||
local original="${GCLIENT_ROOT}/src/third_party/autotest/files"
|
local original="${GCLIENT_ROOT}/src/third_party/autotest/files"
|
||||||
local autotest_dir="${FLAGS_chroot}/usr/local/autotest"
|
local autotest_dir="${FLAGS_chroot}/usr/local/autotest/${FLAGS_board}"
|
||||||
update_chroot_autotest "${original}" "${autotest_dir}"
|
update_chroot_autotest "${original}" "${autotest_dir}"
|
||||||
|
|
||||||
local autoserv="${autotest_dir}/server/autoserv"
|
local autoserv="${autotest_dir}/server/autoserv"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user