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