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" | |
28 | 27 |
29 function cleanup() { | 28 function cleanup() { |
30 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then | 29 if [[ $FLAGS_cleanup -eq ${FLAGS_TRUE} ]]; then |
31 rm -rf "${TMP}" | 30 rm -rf "${TMP}" |
32 else | 31 else |
33 echo "Left temporary files at ${TMP}" | 32 echo "Left temporary files at ${TMP}" |
34 fi | 33 fi |
35 cleanup_remote_access | 34 cleanup_remote_access |
36 } | 35 } |
37 | 36 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 cd $(dirname "$0") | 88 cd $(dirname "$0") |
90 | 89 |
91 FLAGS "$@" || exit 1 | 90 FLAGS "$@" || exit 1 |
92 | 91 |
93 if [[ -z "${FLAGS_ARGV}" ]]; then | 92 if [[ -z "${FLAGS_ARGV}" ]]; then |
94 echo "Please specify tests to run, like:" | 93 echo "Please specify tests to run, like:" |
95 echo " $0 --remote=MyMachine SystemBootPerf" | 94 echo " $0 --remote=MyMachine SystemBootPerf" |
96 exit 1 | 95 exit 1 |
97 fi | 96 fi |
98 | 97 |
| 98 check_board |
| 99 |
99 local parse_cmd="$(dirname $0)/../third_party/autotest/files/tko/parse.py" | 100 local parse_cmd="$(dirname $0)/../third_party/autotest/files/tko/parse.py" |
100 | 101 |
101 if [[ ${FLAGS_update_db} -eq ${FLAGS_TRUE} && ! -x "${parse_cmd}" ]]; then | 102 if [[ ${FLAGS_update_db} -eq ${FLAGS_TRUE} && ! -x "${parse_cmd}" ]]; then |
102 echo "Cannot find parser ${parse_cmd}" | 103 echo "Cannot find parser ${parse_cmd}" |
103 exit 1 | 104 exit 1 |
104 fi | 105 fi |
105 | 106 |
106 set -e | 107 set -e |
107 | 108 |
108 # Set global TMP for remote_access.sh's sake | 109 # Set global TMP for remote_access.sh's sake |
109 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) | 110 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) |
110 | 111 |
111 rm -f "${FLAGS_output_file}" | 112 rm -f "${FLAGS_output_file}" |
112 | 113 |
113 trap cleanup EXIT | 114 trap cleanup EXIT |
114 | 115 |
115 # Always copy into installed autotest directory. This way if a user | 116 # Always copy into installed autotest directory. This way if a user |
116 # is just modifying scripts, they take effect without having to wait | 117 # is just modifying scripts, they take effect without having to wait |
117 # for the laborious build_autotest.sh command. | 118 # for the laborious build_autotest.sh command. |
118 local original="${GCLIENT_ROOT}/src/third_party/autotest/files" | 119 local original="${GCLIENT_ROOT}/src/third_party/autotest/files" |
119 local autotest_dir="${FLAGS_chroot}/usr/local/autotest/${FLAGS_board}" | 120 local autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" |
120 update_chroot_autotest "${original}" "${autotest_dir}" | 121 update_chroot_autotest "${original}" "${autotest_dir}" |
121 | 122 |
122 local autoserv="${autotest_dir}/server/autoserv" | 123 local autoserv="${autotest_dir}/server/autoserv" |
123 | 124 |
124 local control_files_to_run="" | 125 local control_files_to_run="" |
125 | 126 |
126 # Now search for tests which unambiguously include the given identifier | 127 # Now search for tests which unambiguously include the given identifier |
127 local search_path=$(echo ${autotest_dir}/{client,server}/{tests,site_tests}) | 128 local search_path=$(echo ${autotest_dir}/{client,server}/{tests,site_tests}) |
128 for test_request in $FLAGS_ARGV; do | 129 for test_request in $FLAGS_ARGV; do |
129 test_request=$(remove_quotes "${test_request}") | 130 test_request=$(remove_quotes "${test_request}") |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 echo "Parse failed." | tee -a "${FLAGS_output_file}" | 214 echo "Parse failed." | tee -a "${FLAGS_output_file}" |
214 FLAGS_cleanup=${FLAGS_FALSE} | 215 FLAGS_cleanup=${FLAGS_FALSE} |
215 fi | 216 fi |
216 fi | 217 fi |
217 done | 218 done |
218 | 219 |
219 echo "Output stored to ${FLAGS_output_file}" | 220 echo "Output stored to ${FLAGS_output_file}" |
220 } | 221 } |
221 | 222 |
222 main $@ | 223 main $@ |
OLD | NEW |