OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 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 # Wrapper to run the platform_BootPerfServer autotest, and store the | 7 # Wrapper to run the platform_BootPerfServer autotest, and store the |
8 # results for later analysis by the 'showbootdata' script. | 8 # results for later analysis by the 'showbootdata' script. |
9 # | 9 # |
10 # NOTE: This script must be run from inside the chromeos build | 10 # NOTE: This script must be run from inside the chromeos build |
(...skipping 14 matching lines...) Expand all Loading... |
25 SCRIPT_ROOT=${path} | 25 SCRIPT_ROOT=${path} |
26 break | 26 break |
27 fi | 27 fi |
28 done | 28 done |
29 } | 29 } |
30 | 30 |
31 find_common_sh | 31 find_common_sh |
32 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) | 32 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
33 # --- END COMMON.SH BOILERPLATE --- | 33 # --- END COMMON.SH BOILERPLATE --- |
34 | 34 |
| 35 # TODO(jrbarnette) Although run_remote_tests.sh works outside the |
| 36 # chroot, the log files it produces will be stored inside the |
| 37 # chroot. So, from outside the chroot, this script doesn't work. |
| 38 # Yes, I think it's a bug, too. You're welcome to fix it, if you |
| 39 # think it's so easy. :-) |
| 40 assert_inside_chroot |
| 41 |
35 DEFINE_string output_dir "" "output directory for results" o | 42 DEFINE_string output_dir "" "output directory for results" o |
36 DEFINE_boolean keep_logs "$FLAGS_FALSE" "keep autotest results" k | 43 DEFINE_boolean keep_logs "$FLAGS_FALSE" "keep autotest results" k |
37 | 44 |
38 RUN_TEST="$SCRIPTS_DIR/run_remote_tests.sh" | 45 RUN_TEST="$SCRIPTS_DIR/run_remote_tests.sh" |
39 TEST=server/site_tests/platform_BootPerfServer/control | 46 TEST=server/site_tests/platform_BootPerfServer/control |
40 TMP_RESULTS="/tmp/bootperf.$(date '+%Y%j%H%M').$$" | 47 TMP_RESULTS="/tmp/bootperf.$(date '+%Y%j%H%M').$$" |
41 RESULTS_DIR=platform_BootPerfServer/platform_BootPerfServer/results | 48 RESULTS_DIR=platform_BootPerfServer/platform_BootPerfServer/results |
42 RESULTS_KEYVAL=$RESULTS_DIR/keyval | 49 RESULTS_KEYVAL=$RESULTS_DIR/keyval |
43 RESULTS_SUMMARY_FILES=( | 50 RESULTS_SUMMARY_FILES=( |
44 $RESULTS_DIR | 51 $RESULTS_DIR |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 local iter=$(expr "$(echo $RUNDIR.???)" : '.*\(...\)') | 147 local iter=$(expr "$(echo $RUNDIR.???)" : '.*\(...\)') |
141 if [ "$iter" != "???" ]; then | 148 if [ "$iter" != "???" ]; then |
142 iter=$(echo $iter | awk '{printf "%03d\n", $1 + 1}') | 149 iter=$(echo $iter | awk '{printf "%03d\n", $1 + 1}') |
143 else | 150 else |
144 iter=000 | 151 iter=000 |
145 fi | 152 fi |
146 | 153 |
147 i=0 | 154 i=0 |
148 while [ $i -lt $count ]; do | 155 while [ $i -lt $count ]; do |
149 local iter_rundir=$RUNDIR.$iter | 156 local iter_rundir=$RUNDIR.$iter |
150 local logfile=$iter_rundir/$RUNDIR_LOG | 157 local logfile=$(pwd)/$iter_rundir/$RUNDIR_LOG |
151 local summary_dir=$iter_rundir/$RUNDIR_SUMMARY | 158 local summary_dir=$iter_rundir/$RUNDIR_SUMMARY |
152 local all_results_dir=$iter_rundir/$RUNDIR_ALL_RESULTS | 159 local all_results_dir=$iter_rundir/$RUNDIR_ALL_RESULTS |
153 | 160 |
154 mkdir $iter_rundir | 161 mkdir $iter_rundir |
155 echo "run $iter start at $(date)" | 162 date |
| 163 echo " logging in $logfile" |
156 | 164 |
157 # BEWARE: The --use_emerged option means that you must manually | 165 # BEWARE: The --use_emerged option means that you must manually |
158 # emerge chromeos-base/autotest-tests if a) you are working on | 166 # emerge chromeos-base/autotest-tests if a) you are working on |
159 # the package, and b) you also want use this script to test your | 167 # the package, and b) you also want use this script to test your |
160 # changes to the package. (The option is here because IMO the | 168 # changes to the package. (The option is here because IMO the |
161 # alternative is a bigger nuisance.) | 169 # alternative is a bigger nuisance.) |
162 $RUN_TEST --use_emerged --results_dir_root="$TMP_RESULTS" \ | 170 $RUN_TEST --use_emerged --results_dir_root="$TMP_RESULTS" \ |
163 --remote="$remote" $TEST >$logfile 2>&1 | 171 --remote="$remote" $TEST >$logfile 2>&1 |
164 if [ ! -e "$TMP_RESULTS/$RESULTS_KEYVAL" ]; then | 172 if [ ! -e "$TMP_RESULTS/$RESULTS_KEYVAL" ]; then |
165 error "No results file; terminating test runs." | 173 error "No results file; terminating test runs." |
166 error "Check $(pwd)/$logfile for output from the test run," | 174 error "Check $logfile for output from the test run," |
167 error "and see $TMP_RESULTS for full test logs and output." | 175 error "and see $TMP_RESULTS for full test logs and output." |
168 return | 176 return |
169 fi | 177 fi |
170 mkdir $summary_dir | 178 mkdir $summary_dir |
171 tar cf - -C $TMP_RESULTS "${RESULTS_SUMMARY_FILES[@]}" | | 179 tar cf - -C $TMP_RESULTS "${RESULTS_SUMMARY_FILES[@]}" | |
172 tar xf - -C $summary_dir | 180 tar xf - -C $summary_dir |
173 if [ $FLAGS_keep_logs -eq $FLAGS_TRUE ]; then | 181 if [ $FLAGS_keep_logs -eq $FLAGS_TRUE ]; then |
174 mv $TMP_RESULTS $all_results_dir | 182 mv $TMP_RESULTS $all_results_dir |
175 chmod 755 $all_results_dir | 183 chmod 755 $all_results_dir |
176 else | 184 else |
177 rm -rf $TMP_RESULTS | 185 rm -rf $TMP_RESULTS |
178 fi | 186 fi |
179 i=$(expr $i + 1) | 187 i=$(expr $i + 1) |
180 iter=$(echo $iter | awk '{printf "%03d\n", $1 + 1}') | 188 iter=$(echo $iter | awk '{printf "%03d\n", $1 + 1}') |
181 done | 189 done |
182 # "run 000 start at $(date)" | 190 date |
183 echo " ... end at $(date)" | |
184 cat $RUNDIR.???/$RUNDIR_SUMMARY/$RESULTS_KEYVAL >$KEYVAL_SUMMARY | 191 cat $RUNDIR.???/$RUNDIR_SUMMARY/$RESULTS_KEYVAL >$KEYVAL_SUMMARY |
185 } | 192 } |
186 | 193 |
187 # Main routine - check validity of the (already parsed) command line | 194 # Main routine - check validity of the (already parsed) command line |
188 # options. 'cd' to the results directory, if it was specified. If | 195 # options. 'cd' to the results directory, if it was specified. If |
189 # all the arguments checks pass, hand control to run_boot_test | 196 # all the arguments checks pass, hand control to run_boot_test |
190 main() { | 197 main() { |
191 if [ $# -lt 1 ]; then | 198 if [ $# -lt 1 ]; then |
192 usage "Missing target host address" | 199 usage "Missing target host address" |
193 elif [ $# -gt 2 ]; then | 200 elif [ $# -gt 2 ]; then |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 # for that case here. | 235 # for that case here. |
229 if ! FLAGS "$@"; then | 236 if ! FLAGS "$@"; then |
230 if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then | 237 if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then |
231 exit 0 | 238 exit 0 |
232 else | 239 else |
233 usage | 240 usage |
234 fi | 241 fi |
235 fi | 242 fi |
236 | 243 |
237 eval main "${FLAGS_ARGV}" | 244 eval main "${FLAGS_ARGV}" |
OLD | NEW |