| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Script to run client or server tests on a live remote image. | 7 # Script to run client or server tests on a live remote image. |
| 8 | 8 |
| 9 # Load common constants. This should be the first executable line. | 9 # Load common constants. This should be the first executable line. |
| 10 # The path to common.sh should be relative to your script's location. | 10 # The path to common.sh should be relative to your script's location. |
| 11 | 11 |
| 12 . "$(dirname $0)/common.sh" | 12 . "$(dirname $0)/common.sh" |
| 13 . "$(dirname $0)/autotest_lib.sh" | 13 . "$(dirname $0)/autotest_lib.sh" |
| 14 . "$(dirname $0)/remote_access.sh" | 14 . "$(dirname $0)/remote_access.sh" |
| 15 | 15 |
| 16 DEFAULT_OUTPUT_FILE=test-output-$(date '+%Y%m%d.%H%M%S') | 16 DEFAULT_OUTPUT_FILE=test-output-$(date '+%Y%m%d.%H%M%S') |
| 17 | 17 |
| 18 DEFINE_boolean cleanup ${FLAGS_TRUE} "Clean up temp directory" | 18 DEFINE_boolean cleanup ${FLAGS_TRUE} "Clean up temp directory" |
| 19 DEFINE_integer iterations 1 "Iterations to run every top level test" i | 19 DEFINE_integer iterations 1 "Iterations to run every top level test" i |
| 20 DEFINE_string output_file "${DEFAULT_OUTPUT_FILE}" "Test run output" o | 20 DEFINE_string output_file "${DEFAULT_OUTPUT_FILE}" "Test run output" o |
| 21 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v | 21 DEFINE_boolean verbose ${FLAGS_FALSE} "Show verbose autoserv output" v |
| 22 DEFINE_boolean update_db ${FLAGS_FALSE} "Put results in autotest database" u | 22 DEFINE_boolean update_db ${FLAGS_FALSE} "Put results in autotest database" u |
| 23 DEFINE_string machine_desc "" "Machine description used in database" | 23 DEFINE_string machine_desc "" "Machine description used in database" |
| 24 DEFINE_string build_desc "" "Build description used in database" | 24 DEFINE_string build_desc "" "Build description used in database" |
| 25 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c | 25 DEFINE_string chroot "${DEFAULT_CHROOT_DIR}" "alternate chroot location" c |
| 26 DEFINE_string results_dir_root "" "alternate root results directory" | 26 DEFINE_string results_dir_root "" "alternate root results directory" |
| 27 DEFINE_string board "" "Desired board you are running the test against" |
| 27 | 28 |
| 28 function cleanup() { | 29 function cleanup() { |
| 29 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then | 30 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then |
| 30 rm -rf "${TMP}" | 31 rm -rf "${TMP}" |
| 31 else | 32 else |
| 32 echo "Left temporary files at ${TMP}" | 33 echo "Left temporary files at ${TMP}" |
| 33 fi | 34 fi |
| 34 cleanup_remote_access | 35 cleanup_remote_access |
| 35 } | 36 } |
| 36 | 37 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) | 109 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) |
| 109 | 110 |
| 110 rm -f "${FLAGS_output_file}" | 111 rm -f "${FLAGS_output_file}" |
| 111 | 112 |
| 112 trap cleanup EXIT | 113 trap cleanup EXIT |
| 113 | 114 |
| 114 # Always copy into installed autotest directory. This way if a user | 115 # Always copy into installed autotest directory. This way if a user |
| 115 # is just modifying scripts, they take effect without having to wait | 116 # is just modifying scripts, they take effect without having to wait |
| 116 # for the laborious build_autotest.sh command. | 117 # for the laborious build_autotest.sh command. |
| 117 local original="${GCLIENT_ROOT}/src/third_party/autotest/files" | 118 local original="${GCLIENT_ROOT}/src/third_party/autotest/files" |
| 118 local autotest_dir="${FLAGS_chroot}/usr/local/autotest" | 119 local autotest_dir="${FLAGS_chroot}/usr/local/autotest/${FLAGS_board}" |
| 119 update_chroot_autotest "${original}" "${autotest_dir}" | 120 update_chroot_autotest "${original}" "${autotest_dir}" |
| 120 | 121 |
| 121 local autoserv="${autotest_dir}/server/autoserv" | 122 local autoserv="${autotest_dir}/server/autoserv" |
| 122 | 123 |
| 123 local control_files_to_run="" | 124 local control_files_to_run="" |
| 124 | 125 |
| 125 # Now search for tests which unambiguously include the given identifier | 126 # Now search for tests which unambiguously include the given identifier |
| 126 local search_path=$(echo ${autotest_dir}/{client,server}/{tests,site_tests}) | 127 local search_path=$(echo ${autotest_dir}/{client,server}/{tests,site_tests}) |
| 127 for test_request in $FLAGS_ARGV; do | 128 for test_request in $FLAGS_ARGV; do |
| 128 test_request=$(remove_quotes "${test_request}") | 129 test_request=$(remove_quotes "${test_request}") |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 echo "Parse failed." | tee -a "${FLAGS_output_file}" | 213 echo "Parse failed." | tee -a "${FLAGS_output_file}" |
| 213 FLAGS_cleanup=${FLAGS_FALSE} | 214 FLAGS_cleanup=${FLAGS_FALSE} |
| 214 fi | 215 fi |
| 215 fi | 216 fi |
| 216 done | 217 done |
| 217 | 218 |
| 218 echo "Output stored to ${FLAGS_output_file}" | 219 echo "Output stored to ${FLAGS_output_file}" |
| 219 } | 220 } |
| 220 | 221 |
| 221 main $@ | 222 main $@ |
| OLD | NEW |