Add functionality required for perf dashboard.

image_to_live.sh - fix problem where errorvalue is non-zero even when
  reimage was successful.
run_remote_tests.sh - add ability to stow build description in the
  autotest database so we can track the exact build for which
  tests succeed/fail.

Review URL: http://codereview.chromium.org/547018
This commit is contained in:
Ken Mixter 2010-01-18 10:58:25 -08:00
parent 8174ba0782
commit 57d2a6bd12
2 changed files with 31 additions and 3 deletions

View File

@ -20,7 +20,9 @@ DEFINE_boolean update_known_hosts ${FLAGS_FALSE} \
"Update your known_hosts with the new remote instance's key"
function kill_all_devservers {
! pkill -f 'python devserver.py'
# Using ! here to avoid exiting with set -e is insufficient, so use
# || true instead.
pkill -f 'python devserver.py' || true
}
function cleanup {

View File

@ -20,6 +20,7 @@ DEFINE_string output_file "${DEFAULT_OUTPUT_FILE}" "Test run output" o
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"
function cleanup() {
if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then
@ -57,6 +58,26 @@ function remove_quotes() {
echo "$1" | sed -e "s/^'//; s/'$//"
}
# Adds attributes to all tests run
# Arguments:
# $1 - results directory
# $2 - attribute name (key)
# $3 - attribute value (value)
function add_test_attribute() {
local results_dir="$1"
local attribute_name="$2"
local attribute_value="$3"
if [[ -z "$attribute_value" ]]; then
return;
fi
for status_file in $(echo "${results_dir}"/*/status); do
local keyval_file=$(dirname $status_file)/keyval
echo "Updating ${keyval_file}"
echo "${attribute_name}=${attribute_value}" >> "${keyval_file}"
done
}
function main() {
assert_outside_chroot
@ -138,8 +159,8 @@ function main() {
fi
echo "Running ${type} test ${control_file}"
local short_name=$(basename $(dirname "${control_file}"))
local timestamp=$(date '+%s')
local results_dir="${TMP}/${short_name},${FLAGS_machine_desc},${timestamp}"
local start_time=$(date '+%s')
local results_dir="${TMP}/${short_name},${FLAGS_machine_desc},${start_time}"
rm -rf "${results_dir}"
local verbose=""
if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then
@ -162,9 +183,14 @@ function main() {
# Leave around output directory if the test failed.
FLAGS_cleanup=${FLAGS_FALSE}
fi
local end_time=$(date '+%s')
# Update the database with results.
if [[ ${FLAGS_update_db} -eq ${FLAGS_TRUE} ]]; then
add_test_attribute "${results_dir}" machine-desc "${FLAGS_machine_desc}"
add_test_attribute "${results_dir}" build-desc "${FLAGS_build_desc}"
add_test_attribute "${results_dir}" server-start-time "${start_time}"
add_test_attribute "${results_dir}" server-end-time "${end_time}"
if ! "${parse_cmd}" -o "${results_dir}"; then
echo "Parse failed." | tee -a "${FLAGS_output_file}"
FLAGS_cleanup=${FLAGS_FALSE}