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 # This script will check all existing AutoTest control files for correctness. | 7 # This script will check all existing AutoTest control files for correctness. |
8 | 8 |
9 # Set pipefail so it will capture any nonzer exit codes | 9 # Set pipefail so it will capture any nonzer exit codes |
10 set -o pipefail | 10 set -o pipefail |
11 | 11 |
12 . "$(dirname "$0")/common.sh" | 12 # --- BEGIN COMMON.SH BOILERPLATE --- |
| 13 # Load common CrOS utilities. Inside the chroot this file is installed in |
| 14 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 15 # location. |
| 16 find_common_sh() { |
| 17 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 18 local path |
| 19 |
| 20 SCRIPT_ROOT= |
| 21 for path in "${common_paths[@]}"; do |
| 22 if [ -r "${path}/common.sh" ]; then |
| 23 SCRIPT_ROOT=${path} |
| 24 break |
| 25 fi |
| 26 done |
| 27 } |
| 28 |
| 29 find_common_sh |
| 30 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 31 # --- END COMMON.SH BOILERPLATE --- |
13 | 32 |
14 AUTOTEST_ROOT=${SRC_ROOT}/third_party/autotest/files | 33 AUTOTEST_ROOT=${SRC_ROOT}/third_party/autotest/files |
15 CHECKSCRIPT=${AUTOTEST_ROOT}/utils/check_control_file_vars.py | 34 CHECKSCRIPT=${AUTOTEST_ROOT}/utils/check_control_file_vars.py |
16 SITE_TESTS=${AUTOTEST_ROOT}/client/site_tests | 35 SITE_TESTS=${AUTOTEST_ROOT}/client/site_tests |
17 | 36 |
18 find $SITE_TESTS -maxdepth 2 -name control | xargs -n1 $CHECKSCRIPT | 37 find $SITE_TESTS -maxdepth 2 -name control | xargs -n1 $CHECKSCRIPT |
19 | 38 |
20 if [ $? -ne 0 ] | 39 if [ $? -ne 0 ] |
21 then | 40 then |
22 exit 1 | 41 exit 1 |
23 fi | 42 fi |
OLD | NEW |