Index: src/scripts/run_remote_tests.sh |
diff --git a/src/scripts/run_remote_tests.sh b/src/scripts/run_remote_tests.sh |
index 820e583b9ae92cb3551146e2aad2a75673017f11..6958bc0fab40c2653bf0eb2ec5665901217faee6 100755 |
--- a/src/scripts/run_remote_tests.sh |
+++ b/src/scripts/run_remote_tests.sh |
@@ -21,8 +21,7 @@ DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v |
DEFINE_boolean update_db ${FLAGS_FALSE} "Put results in autotest database" u |
DEFINE_string machine_desc "" "Machine description used in database" |
DEFINE_string build_desc "" "Build description used in database" |
-DEFINE_string results_dir_root "" \ |
- "Directory to place individual autoserv results files (default to TMP)" |
+DEFINE_string chroot_dir "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c |
function cleanup() { |
if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then |
@@ -30,6 +29,10 @@ function cleanup() { |
else |
echo "Left temporary files at ${TMP}" |
fi |
+ if [[ -n "${SSH_AGENT_PID}" ]] |
+ then |
+ kill ${SSH_AGENT_PID} 2>/dev/null |
+ fi |
} |
# Returns an error if the test_result_file has text which indicates |
@@ -102,39 +105,39 @@ function main() { |
set -e |
+ AUTOTEST_INSTALL_DIR="${DEFAULT_CHROOT_DIR}/usr/local/autotest" |
+ |
# Set global TMP for remote_access.sh's sake |
TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) |
- if [[ -z "${FLAGS_results_dir_root}" ]]; then |
- FLAGS_results_dir_root="${TMP}" |
- fi |
- |
rm -f "${FLAGS_output_file}" |
trap cleanup EXIT |
- cp -r "${SRC_ROOT}/third_party/autotest/files" "${TMP}/autotest" |
- |
+ # Check for installed autotest. |
+ local autoserv="${AUTOTEST_INSTALL_DIR}/server/autoserv" |
+ if [[ ! -f "${autoserv}" ]]; then |
+ echo "Cannot find autotest in build dir. Run build_autotest.sh" |
+ exit 1 |
+ fi |
+ |
local control_files_to_run="" |
- local any_failures=0 |
# Now search for tests which unambiguously include the given identifier |
- local search_path=$(echo ${TMP}/autotest/{client,server}/{tests,site_tests}) |
+ local search_path=$(echo ${AUTOTEST_INSTALL_DIR}/{client,server}/{tests,site_tests}) |
petkov
2010/01/27 17:12:06
80 chars
seano
2010/01/27 19:51:47
Done.
|
for test_request in $FLAGS_ARGV; do |
test_request=$(remove_quotes "${test_request}") |
! finds=$(find ${search_path} -type f -name control | \ |
egrep "${test_request}") |
if [[ -z "${finds}" ]]; then |
echo "Can not find match for ${test_request}" |
- any_failures=1 |
- continue |
+ exit 1 |
fi |
local matches=$(echo "${finds}" | wc -l) |
if [[ ${matches} -gt 1 ]]; then |
echo "${test_request} is ambiguous:" |
echo "${finds}" |
- any_failures=1 |
- continue |
+ exit 1 |
fi |
for i in $(seq 1 $FLAGS_iterations); do |
control_files_to_run="${control_files_to_run} '${finds}'" |
@@ -149,8 +152,6 @@ function main() { |
if [[ -z "${FLAGS_machine_desc}" ]]; then |
FLAGS_machine_desc="${FLAGS_remote}" |
fi |
- |
- local autoserv="${TMP}/autotest/server/autoserv" |
for control_file in ${control_files_to_run}; do |
# Assume a line starts with TEST_TYPE = |
@@ -169,20 +170,15 @@ function main() { |
echo "Running ${type} test ${control_file}" |
local short_name=$(basename $(dirname "${control_file}")) |
local start_time=$(date '+%s') |
- local results_dir_name="${short_name},${FLAGS_machine_desc},${start_time}" |
- local results_dir="${FLAGS_results_dir_root}/${results_dir_name}" |
+ local results_dir="${TMP}/${short_name},${FLAGS_machine_desc},${start_time}" |
rm -rf "${results_dir}" |
local verbose="" |
if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then |
verbose="--verbose" |
fi |
- if ! ${autoserv} -m "${FLAGS_remote}" "${option}" "${control_file}" \ |
- -r "${results_dir}" ${verbose}; then |
- echo "Autoserv run of ${control_file} failed." | \ |
- tee -a "${FLAGS_output_file}" |
- any_failures=1 |
- continue |
- fi |
+ TODO call from correct install dir |
petkov
2010/01/27 15:46:26
This needs to be a comment? Also, TODO(seano)...
seano
2010/01/27 19:51:47
Done.
|
+ ${autoserv} -m "${FLAGS_remote}" "${option}" "${control_file}" \ |
+ -r "${results_dir}" ${verbose} |
local test_status="${results_dir}/status" |
local test_result_dir="${results_dir}/${short_name}" |
local keyval_file="${test_result_dir}/results/keyval" |
@@ -214,8 +210,6 @@ function main() { |
done |
echo "Output stored to ${FLAGS_output_file}" |
- |
- return ${any_failures} |
} |
main $@ |