| 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. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return; | 76 return; |
| 77 fi | 77 fi |
| 78 | 78 |
| 79 for status_file in $(echo "${results_dir}"/*/status); do | 79 for status_file in $(echo "${results_dir}"/*/status); do |
| 80 local keyval_file=$(dirname $status_file)/keyval | 80 local keyval_file=$(dirname $status_file)/keyval |
| 81 echo "Updating ${keyval_file}" | 81 echo "Updating ${keyval_file}" |
| 82 echo "${attribute_name}=${attribute_value}" >> "${keyval_file}" | 82 echo "${attribute_name}=${attribute_value}" >> "${keyval_file}" |
| 83 done | 83 done |
| 84 } | 84 } |
| 85 | 85 |
| 86 |
| 87 # Ask the target what board it is |
| 88 function learn_board() { |
| 89 if [[ -n "${FLAGS_board}" ]]; then |
| 90 return |
| 91 fi |
| 92 remote_sh grep CHROMEOS_RELEASE_BOARD /etc/lsb-release |
| 93 FLAGS_board=$(echo "${REMOTE_OUT}" | cut -d= -f2) |
| 94 if [[ -z "${FLAGS_board}" ]]; then |
| 95 check_board |
| 96 fi |
| 97 echo "Target reports board is ${FLAGS_board}" |
| 98 } |
| 99 |
| 100 |
| 86 function main() { | 101 function main() { |
| 87 assert_outside_chroot | 102 assert_outside_chroot |
| 88 | 103 |
| 89 cd $(dirname "$0") | 104 cd $(dirname "$0") |
| 90 | 105 |
| 91 FLAGS "$@" || exit 1 | 106 FLAGS "$@" || exit 1 |
| 92 | 107 |
| 93 if [[ -z "${FLAGS_ARGV}" ]]; then | 108 if [[ -z "${FLAGS_ARGV}" ]]; then |
| 94 echo "Please specify tests to run, like:" | 109 echo "Please specify tests to run, like:" |
| 95 echo " $0 --remote=MyMachine SystemBootPerf" | 110 echo " $0 --remote=MyMachine SystemBootPerf" |
| 96 exit 1 | 111 exit 1 |
| 97 fi | 112 fi |
| 98 | 113 |
| 99 set -e | 114 set -e |
| 100 | 115 |
| 101 # Set global TMP for remote_access.sh's sake | 116 # Set global TMP for remote_access.sh's sake |
| 102 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) | 117 TMP=$(mktemp -d /tmp/run_remote_tests.XXXX) |
| 103 | 118 |
| 104 rm -f "${FLAGS_output_file}" | 119 rm -f "${FLAGS_output_file}" |
| 105 | 120 |
| 106 trap cleanup EXIT | 121 trap cleanup EXIT |
| 107 | 122 |
| 123 remote_access_init |
| 124 |
| 108 local autotest_dir="" | 125 local autotest_dir="" |
| 109 if [[ -z "${FLAGS_prepackaged_autotest}" ]]; then | 126 if [[ -z "${FLAGS_prepackaged_autotest}" ]]; then |
| 110 check_board | 127 learn_board |
| 111 # Always copy into installed autotest directory. This way if a user | 128 # Always copy into installed autotest directory. This way if a user |
| 112 # is just modifying scripts, they take effect without having to wait | 129 # is just modifying scripts, they take effect without having to wait |
| 113 # for the laborious build_autotest.sh command. | 130 # for the laborious build_autotest.sh command. |
| 114 local original="${GCLIENT_ROOT}/src/third_party/autotest/files" | 131 local original="${GCLIENT_ROOT}/src/third_party/autotest/files" |
| 115 autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" | 132 autotest_dir="${FLAGS_chroot}/build/${FLAGS_board}/usr/local/autotest" |
| 116 update_chroot_autotest "${original}" "${autotest_dir}" | 133 update_chroot_autotest "${original}" "${autotest_dir}" |
| 117 else | 134 else |
| 118 autotest_dir="${FLAGS_prepackaged_autotest}" | 135 autotest_dir="${FLAGS_prepackaged_autotest}" |
| 119 fi | 136 fi |
| 120 | 137 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 145 echo "${finds}" | 162 echo "${finds}" |
| 146 exit 1 | 163 exit 1 |
| 147 fi | 164 fi |
| 148 for i in $(seq 1 $FLAGS_iterations); do | 165 for i in $(seq 1 $FLAGS_iterations); do |
| 149 control_files_to_run="${control_files_to_run} '${finds}'" | 166 control_files_to_run="${control_files_to_run} '${finds}'" |
| 150 done | 167 done |
| 151 done | 168 done |
| 152 | 169 |
| 153 echo "Running the following control files: ${control_files_to_run}" | 170 echo "Running the following control files: ${control_files_to_run}" |
| 154 | 171 |
| 155 remote_access_init | |
| 156 | |
| 157 # Set the default machine description to the machine's IP | 172 # Set the default machine description to the machine's IP |
| 158 if [[ -z "${FLAGS_machine_desc}" ]]; then | 173 if [[ -z "${FLAGS_machine_desc}" ]]; then |
| 159 FLAGS_machine_desc="${FLAGS_remote}" | 174 FLAGS_machine_desc="${FLAGS_remote}" |
| 160 fi | 175 fi |
| 161 | 176 |
| 162 if [[ -z "${FLAGS_results_dir_root}" ]]; then | 177 if [[ -z "${FLAGS_results_dir_root}" ]]; then |
| 163 FLAGS_results_dir_root="${TMP}" | 178 FLAGS_results_dir_root="${TMP}" |
| 164 fi | 179 fi |
| 165 | 180 |
| 166 mkdir -p "${FLAGS_results_dir_root}" | 181 mkdir -p "${FLAGS_results_dir_root}" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 185 local results_dir_name="${short_name},${FLAGS_machine_desc},${start_time}" | 200 local results_dir_name="${short_name},${FLAGS_machine_desc},${start_time}" |
| 186 local results_dir="${FLAGS_results_dir_root}/${results_dir_name}" | 201 local results_dir="${FLAGS_results_dir_root}/${results_dir_name}" |
| 187 rm -rf "${results_dir}" | 202 rm -rf "${results_dir}" |
| 188 local verbose="" | 203 local verbose="" |
| 189 if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then | 204 if [[ ${FLAGS_verbose} -eq $FLAGS_TRUE ]]; then |
| 190 verbose="--verbose" | 205 verbose="--verbose" |
| 191 fi | 206 fi |
| 192 | 207 |
| 193 ${autoserv} -m "${FLAGS_remote}" "${option}" "${control_file}" \ | 208 ${autoserv} -m "${FLAGS_remote}" "${option}" "${control_file}" \ |
| 194 -r "${results_dir}" ${verbose} | 209 -r "${results_dir}" ${verbose} |
| 195 local test_status="${results_dir}/status" | 210 local test_status="${results_dir}/status.log" |
| 196 local test_result_dir="${results_dir}/${short_name}" | 211 local test_result_dir="${results_dir}/${short_name}" |
| 197 local keyval_file="${test_result_dir}/results/keyval" | 212 local keyval_file="${test_result_dir}/results/keyval" |
| 198 if is_successful_test "${test_status}"; then | 213 if is_successful_test "${test_status}"; then |
| 199 echo "${control_file} succeeded." | tee -a "${FLAGS_output_file}" | 214 echo "${control_file} succeeded." | tee -a "${FLAGS_output_file}" |
| 200 if [[ -f "${keyval_file}" ]]; then | 215 if [[ -f "${keyval_file}" ]]; then |
| 201 echo "Keyval was:" | tee -a "${FLAGS_output_file}" | 216 echo "Keyval was:" | tee -a "${FLAGS_output_file}" |
| 202 cat "${keyval_file}" | tee -a "${FLAGS_output_file}" | 217 cat "${keyval_file}" | tee -a "${FLAGS_output_file}" |
| 203 fi | 218 fi |
| 204 else | 219 else |
| 205 echo "${control_file} failed:" | tee -a "${FLAGS_output_file}" | 220 echo "${control_file} failed:" | tee -a "${FLAGS_output_file}" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 219 echo "Parse failed." | tee -a "${FLAGS_output_file}" | 234 echo "Parse failed." | tee -a "${FLAGS_output_file}" |
| 220 FLAGS_cleanup=${FLAGS_FALSE} | 235 FLAGS_cleanup=${FLAGS_FALSE} |
| 221 fi | 236 fi |
| 222 fi | 237 fi |
| 223 done | 238 done |
| 224 | 239 |
| 225 echo "Output stored to ${FLAGS_output_file}" | 240 echo "Output stored to ${FLAGS_output_file}" |
| 226 } | 241 } |
| 227 | 242 |
| 228 main $@ | 243 main $@ |
| OLD | NEW |