Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Unified Diff: src/scripts/run_remote_tests.sh

Issue 1548002: Add -b option to run_remote_tests to build tests before running (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/run_remote_tests.sh
diff --git a/src/scripts/run_remote_tests.sh b/src/scripts/run_remote_tests.sh
index a323b89f77f98b151d54dc90375275be997988ef..2fb07a503f2a4afac3126db15f16cb323aaab706 100755
--- a/src/scripts/run_remote_tests.sh
+++ b/src/scripts/run_remote_tests.sh
@@ -13,6 +13,7 @@
. "$(dirname $0)/autotest_lib.sh"
. "$(dirname $0)/remote_access.sh"
+DEFINE_boolean build ${FLAGS_FALSE} "Build tests as well as running them" b
DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c
DEFINE_boolean cleanup ${FLAGS_FALSE} "Clean up temp directory"
DEFINE_integer iterations 1 "Iterations to run every top level test" i
@@ -20,6 +21,8 @@ DEFINE_string prepackaged_autotest "" "Use this prepackaged autotest dir"
DEFINE_string results_dir_root "" "alternate root results directory"
DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v
+RAN_ANY_TESTS=${FLAGS_FALSE}
+
# Check if our stdout is a tty
function is_a_tty() {
local stdout=$(readlink /proc/$$/fd/1)
@@ -48,7 +51,8 @@ function echo_color() {
}
function cleanup() {
- if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then
+ if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]] || \
+ [[ ${RAN_ANY_TESTS} -eq ${FLAGS_FALSE} ]]; then
rm -rf "${TMP}"
else
echo ">>> Details stored under ${TMP}"
@@ -119,6 +123,27 @@ function learn_board() {
}
+# Determine if a control is for a client or server test. Echos
+# either "server" or "client".
+# Arguments:
+# $1 - control file path
+function read_test_type() {
+ local control_file=$1
+ # Assume a line starts with TEST_TYPE =
+ local type=$(egrep '^[[:space:]]*TEST_TYPE[[:space:]]*=' "${control_file}" \
petkov 2010/03/29 21:37:38 You could use egrep -m1 instead of piping through
+ | head -1)
+ if [[ -z "${type}" ]]; then
+ echo_color "red" ">>> Unable to find TEST_TYPE line in ${control_file}"
+ exit 1
+ fi
+ type=$(python -c "${type}; print TEST_TYPE.lower()")
+ if [[ "${type}" != "client" ]] && [[ "${type}" != "server" ]]; then
+ echo_color "red" ">>> Unknown type of test (${type}) in ${control_file}"
petkov 2010/03/29 21:37:38 Consider using die, warn, etc. from common.sh inst
+ exit 1
+ fi
+ echo ${type}
+}
+
function main() {
cd $(dirname "$0")
@@ -167,7 +192,6 @@ function main() {
-name control \) | egrep -v "~$" | egrep "${test_request}")
if [[ -z "${finds}" ]]; then
echo_color "red" ">>> Cannot find match for \"${test_request}\""
- FLAGS_cleanup=${FLAGS_TRUE}
exit 1
fi
local matches=$(echo "${finds}" | wc -l)
@@ -181,7 +205,6 @@ function main() {
echo ""
echo ">>> Disambiguate by copy-and-pasting the whole path above" \
"instead of passing \"${test_request}\"."
- FLAGS_cleanup=${FLAGS_TRUE}
exit 1
fi
for i in $(seq 1 $FLAGS_iterations); do
@@ -190,6 +213,12 @@ function main() {
done
echo ""
+
+ if [[ -z "${control_files_to_run}" ]]; then
+ echo_color "red" ">>> Found no control files"
+ exit 1
+ fi
+
echo_color "yellow" ">>> Running the following control files:"
for CONTROL_FILE in ${control_files_to_run}; do
echo_color "yellow" " * " "${CONTROL_FILE}"
@@ -201,20 +230,47 @@ function main() {
mkdir -p "${FLAGS_results_dir_root}"
+ if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then
+ # Create a list of files to build based on all the client tests
+ # the user has specified. If they have specified at least one
+ # that is a server test, offer to build all client tests since
+ # it's quite hard to know what client tests a server test might
+ # use.
+ local build_param=""
+ for control_file in ${control_files_to_run}; do
+ control_file=$(remove_quotes "${control_file}")
+ local type=$(read_test_type "${control_file}")
+ if [[ "${type}" == "server" ]]; then
+ build_param=""
+ break
+ fi
+ if [[ -n "${build_param}" ]]; then
+ build_param="${build_param},"
+ fi
+ local simple_path=$(basename $(dirname $control_file))
+ build_param="${build_param}${simple_path}"
ericli 2010/03/29 21:33:22 I think it needs to be seperated by comma, if ther
+ done
+ local enter_chroot=""
+ if [[ ${INSIDE_CHROOT} -eq 0 ]]; then
+ enter_chroot="./enter_chroot.sh --"
+ fi
+ if [[ -n "${build_param}" ]]; then
+ build_param="--build=${build_param}"
+ fi
+ echo ""
+ echo_color "yellow" ">>> Building autotest: " \
+ "./build_autotest.sh --board=${FLAGS_board} ${build_param}"
+ ${enter_chroot} ./build_autotest.sh --board=${FLAGS_board} ${build_param}
+ fi
+
for control_file in ${control_files_to_run}; do
# Assume a line starts with TEST_TYPE =
control_file=$(remove_quotes "${control_file}")
- local type=$(egrep '^[[:space:]]*TEST_TYPE[[:space:]]*=' "${control_file}" \
- | head -1)
- if [[ -z "${type}" ]]; then
- echo_color "red" ">>> Unable to find TEST_TYPE line in ${control_file}"
- exit 1
- fi
- type=$(python -c "${type}; print TEST_TYPE.lower()")
+ local type=$(read_test_type "${control_file}")
local option
- if [ "${type}" == "client" ]; then
+ if [[ "${type}" == "client" ]]; then
option="-c"
- elif [ "${type}" == "server" ]; then
+ elif [[ "${type}" == "server" ]]; then
option="-s"
else
echo_color "red" ">>> Unknown type of test (${type}) in ${control_file}"
@@ -231,6 +287,7 @@ function main() {
verbose="--verbose"
fi
+ RAN_ANY_TESTS=${FLAGS_TRUE}
${autoserv} -m "${FLAGS_remote}" "${option}" "${control_file}" \
-r "${results_dir}" ${verbose}
local test_status="${results_dir}/status.log"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698