| 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 |
| 11 # chroot environment. | 11 # chroot environment. |
| 12 # | 12 # |
| 13 | 13 |
| 14 # SCRIPT_DIR="$(cd "$(dirname $0)/.." ; pwd)" | 14 # SCRIPT_DIR="$(cd "$(dirname $0)/.." ; pwd)" |
| 15 SCRIPT_DIR=$HOME/trunk/src/scripts | 15 SCRIPT_DIR=$HOME/trunk/src/scripts |
| 16 . "$SCRIPT_DIR/common.sh" | 16 . "$SCRIPT_DIR/common.sh" |
| 17 | 17 |
| 18 DEFINE_string output_dir "" "output directory for results" o | 18 DEFINE_string output_dir "" "output directory for results" o |
| 19 DEFINE_boolean keep_logs "$FLAGS_FALSE" "keep autotest results" k | 19 DEFINE_boolean keep_logs "$FLAGS_FALSE" "keep autotest results" k |
| 20 | 20 |
| 21 RUN_TEST="$SCRIPT_DIR/run_remote_tests.sh" | 21 RUN_TEST="$SCRIPT_DIR/run_remote_tests.sh" |
| 22 TEST=server/site_tests/platform_BootPerfServer/control | 22 TEST=server/site_tests/platform_BootPerfServer/control |
| 23 TMP_RESULTS="/tmp/bootperf.$(date '+%Y%j%H%M').$$" | 23 TMP_RESULTS="/tmp/bootperf.$(date '+%Y%j%H%M').$$" |
| 24 RESULTS_KEYVAL=platform_BootPerfServer/platform_BootPerfServer/results/keyval | 24 RESULTS_DIR=platform_BootPerfServer/platform_BootPerfServer/results |
| 25 RESULTS_KEYVAL=$RESULTS_DIR/keyval |
| 25 RESULTS_SUMMARY_FILES=( | 26 RESULTS_SUMMARY_FILES=( |
| 26 $RESULTS_KEYVAL | 27 $RESULTS_DIR |
| 27 platform_BootPerfServer/keyval | 28 platform_BootPerfServer/keyval |
| 28 platform_BootPerfServer/platform_BootPerfServer/keyval | 29 platform_BootPerfServer/platform_BootPerfServer/keyval |
| 29 platform_BootPerfServer/platform_BootPerfServer/platform_BootPerf/keyval | 30 platform_BootPerfServer/platform_BootPerfServer/platform_BootPerf/keyval |
| 30 platform_BootPerfServer/platform_BootPerfServer/status | 31 platform_BootPerfServer/platform_BootPerfServer/status |
| 31 platform_BootPerfServer/platform_BootPerfServer/status.log | 32 platform_BootPerfServer/platform_BootPerfServer/status.log |
| 32 platform_BootPerfServer/status | 33 platform_BootPerfServer/status |
| 33 platform_BootPerfServer/status.log | 34 platform_BootPerfServer/status.log |
| 34 platform_BootPerfServer/sysinfo/cmdline | 35 platform_BootPerfServer/sysinfo/cmdline |
| 35 platform_BootPerfServer/sysinfo/cpuinfo | 36 platform_BootPerfServer/sysinfo/cpuinfo |
| 36 platform_BootPerfServer/sysinfo/modules | 37 platform_BootPerfServer/sysinfo/modules |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 129 |
| 129 i=0 | 130 i=0 |
| 130 while [ $i -lt $count ]; do | 131 while [ $i -lt $count ]; do |
| 131 local iter_rundir=$RUNDIR.$iter | 132 local iter_rundir=$RUNDIR.$iter |
| 132 local logfile=$iter_rundir/$RUNDIR_LOG | 133 local logfile=$iter_rundir/$RUNDIR_LOG |
| 133 local summary_dir=$iter_rundir/$RUNDIR_SUMMARY | 134 local summary_dir=$iter_rundir/$RUNDIR_SUMMARY |
| 134 local all_results_dir=$iter_rundir/$RUNDIR_ALL_RESULTS | 135 local all_results_dir=$iter_rundir/$RUNDIR_ALL_RESULTS |
| 135 | 136 |
| 136 mkdir $iter_rundir | 137 mkdir $iter_rundir |
| 137 echo "run $iter start at $(date)" | 138 echo "run $iter start at $(date)" |
| 138 $RUN_TEST --results_dir_root="$TMP_RESULTS" \ | 139 |
| 140 # BEWARE: The --use_emerged option means that you must manually |
| 141 # emerge chromeos-base/autotest-tests if a) you are working on |
| 142 # the package, and b) you also want use this script to test your |
| 143 # changes to the package. (The option is here because IMO the |
| 144 # alternative is a bigger nuisance.) |
| 145 $RUN_TEST --use_emerged --results_dir_root="$TMP_RESULTS" \ |
| 139 --remote="$remote" $TEST >$logfile 2>&1 | 146 --remote="$remote" $TEST >$logfile 2>&1 |
| 140 if [ ! -e "$TMP_RESULTS/$RESULTS_KEYVAL" ]; then | 147 if [ ! -e "$TMP_RESULTS/$RESULTS_KEYVAL" ]; then |
| 141 error "No results file; terminating test runs." | 148 error "No results file; terminating test runs." |
| 142 error "Check $logfile for output from the test run," | 149 error "Check $(pwd)/$logfile for output from the test run," |
| 143 error "and see $TMP_RESULTS for full test logs and output." | 150 error "and see $TMP_RESULTS for full test logs and output." |
| 144 break | 151 return |
| 145 fi | 152 fi |
| 146 mkdir $summary_dir | 153 mkdir $summary_dir |
| 147 tar cf - -C $TMP_RESULTS "${RESULTS_SUMMARY_FILES[@]}" | | 154 tar cf - -C $TMP_RESULTS "${RESULTS_SUMMARY_FILES[@]}" | |
| 148 tar xf - -C $summary_dir | 155 tar xf - -C $summary_dir |
| 149 if [ $FLAGS_keep_logs -eq $FLAGS_TRUE ]; then | 156 if [ $FLAGS_keep_logs -eq $FLAGS_TRUE ]; then |
| 150 mv $TMP_RESULTS $all_results_dir | 157 mv $TMP_RESULTS $all_results_dir |
| 151 chmod 755 $all_results_dir | 158 chmod 755 $all_results_dir |
| 152 else | 159 else |
| 153 rm -rf $TMP_RESULTS | 160 rm -rf $TMP_RESULTS |
| 154 fi | 161 fi |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 # for that case here. | 211 # for that case here. |
| 205 if ! FLAGS "$@"; then | 212 if ! FLAGS "$@"; then |
| 206 if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then | 213 if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then |
| 207 exit 0 | 214 exit 0 |
| 208 else | 215 else |
| 209 usage | 216 usage |
| 210 fi | 217 fi |
| 211 fi | 218 fi |
| 212 | 219 |
| 213 eval main "${FLAGS_ARGV}" | 220 eval main "${FLAGS_ARGV}" |
| OLD | NEW |